Re: [PATCH v3 5/5] shmem, overlayfs, coda, tty, proc, kernfs, random: Fix splice-read

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

 



On Tue, Feb 14, 2023 at 09:54:08AM +0100, Greg Kroah-Hartman wrote:
> On Tue, Feb 14, 2023 at 08:37:10AM +0000, David Howells wrote:
> > The new filemap_splice_read() has an implicit expectation via
> > filemap_get_pages() that ->read_folio() exists if ->readahead() doesn't
> > fully populate the pagecache of the file it is reading from[1], potentially
> > leading to a jump to NULL if this doesn't exist.
> > 
> > A filesystem or driver shouldn't suffer from this if:
> > 
> >   - It doesn't set ->splice_read()
> >   - It implements ->read_folio()
> >   - It implements its own ->splice_read()
> > 
> > Note that some filesystems set generic_file_splice_read() and
> > generic_file_read_iter() but don't set ->read_folio().  g_f_read_iter()
> > will fall back to filemap_read_iter() which looks like it should suffer
> > from the same issue.
> > 
> > Certain drivers, can just use direct_splice_read() rather than
> > generic_file_splice_read() as that creates an output buffer and then just
> > calls their ->read_iter() function:
> > 
> >   - random & urandom
> >   - tty
> >   - kernfs
> >   - proc
> >   - proc_namespace
> > 
> > Stacked filesystems just need to pass the operation down a layer:
> > 
> >   - coda
> >   - overlayfs
> > 
> > And finally, there's shmem (used in tmpfs, ramfs, rootfs).  This needs its
> > own splice-read implementation, based on filemap_splice_read(), but able to
> > paste in zero_page when there's a page missing.
> > 
> > Fixes: d9722a475711 ("splice: Do splice read from a buffered file without using ITER_PIPE")
> > Signed-off-by: David Howells <dhowells@xxxxxxxxxx>
> > cc: Daniel Golle <daniel@xxxxxxxxxxxxxx>
> > cc: Guenter Roeck <groeck7@xxxxxxxxx>
> > cc: Christoph Hellwig <hch@xxxxxx>
> > cc: Jens Axboe <axboe@xxxxxxxxx>
> > cc: Al Viro <viro@xxxxxxxxxxxxxxxxxx>
> > cc: John Hubbard <jhubbard@xxxxxxxxxx>
> > cc: David Hildenbrand <david@xxxxxxxxxx>
> > cc: Matthew Wilcox <willy@xxxxxxxxxxxxx>
> > cc: Miklos Szeredi <miklos@xxxxxxxxxx>
> > cc: Hugh Dickins <hughd@xxxxxxxxxx>
> > cc: Jan Harkes <jaharkes@xxxxxxxxxx>
> > cc: Arnd Bergmann <arnd@xxxxxxxx>
> > cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
> > cc: coda@xxxxxxxxxx
> > cc: codalist@xxxxxxxxxxxxxxx
> > cc: linux-unionfs@xxxxxxxxxxxxxxx
> > cc: linux-block@xxxxxxxxxxxxxxx
> > cc: linux-fsdevel@xxxxxxxxxxxxxxx
> > cc: linux-mm@xxxxxxxxx
> > Link: https://lore.kernel.org/r/Y+pdHFFTk1TTEBsO@xxxxxxxxxxxxxx/ [1]
> > ---
> 
> Acked-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>

Confirming that the above indeed fixes the NULL pointer bug.

Tested-by: Daniel Golle <daniel@xxxxxxxxxxxxxx>



[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux