Re: [Linux kernel bug] KASAN: slab-out-of-bounds Read in xlog_cksum

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Apr 25, 2024 at 11:13:05PM -0700, Christoph Hellwig wrote:
> On Thu, Apr 25, 2024 at 09:57:54AM -0400, Brian Foster wrote:
> > On Thu, Apr 25, 2024 at 06:12:23AM -0700, Christoph Hellwig wrote:
> > > This triggers the workaround for really old xfsprogs putting in a
> > > bogus h_size:
> > > 
> > > [   12.101992] XFS (loop0): invalid iclog size (0 bytes), using lsunit (65536 bytes)
> > > 
> > > but then calculates the log recovery buffer size based on the actual
> > > on-disk h_size value.  The patch below open codes xlog_logrec_hblks and
> > > fixes this particular reproducer.  But I wonder if we should limit the
> > > workaround.  Brian, you don't happpen to remember how old xfsprogs had
> > > to be to require your workaround (commit a70f9fe52daa8)?
> > > 
> > 
> > No, but a little digging turns up xfsprogs commit 20fbd4593ff2 ("libxfs:
> > format the log with valid log record headers"), which I think is what
> > you're looking for..? That went in around v4.5 or so, so I suppose
> > anything earlier than that is affected.
> 
> Thanks.  I was kinda hoping we could exclude v5 file systems from that
> workaround, but it is needed way too recent for that.
> 
> Maybe we can specificly check for the wrongly hardcoded
> XLOG_HEADER_CYCLE_SIZE instead of allowing any value?
> 

That seems like a reasonable option to me if you wanted to make it a bit
more limited to its purpose. You might just want to double check that
the size used in libxfs hadn't changed at any point previously, because
that 1. apparently wouldn't have been an issue up until the record
verification stuff and 2. the existing size-agnostic check in the kernel
would have still handled it (prior to being broken).

It might also be worth a separately named macro or something in the
kernel just for extra indication that this particular check is unique
and warrants extra thought on future changes. Not so much that I'd
expect the original macro value to change, but just that I suspect
something like that might have helped flag this logic as semi-special
and maybe helped avoid breaking it in commit 0c771b99d6c9. In hindsight,
maybe it would have been a little better even to just put that logic
into its own special fixup function or something. Anyways, just some
random thoughts..

Brian





[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux