lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y+uT1SGEzjMrUbFI@makrotopia.org>
Date:   Tue, 14 Feb 2023 13:59:49 +0000
From:   Daniel Golle <daniel@...rotopia.org>
To:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc:     David Howells <dhowells@...hat.com>, Jens Axboe <axboe@...nel.dk>,
        Al Viro <viro@...iv.linux.org.uk>,
        Christoph Hellwig <hch@...radead.org>,
        Matthew Wilcox <willy@...radead.org>, Jan Kara <jack@...e.cz>,
        Jeff Layton <jlayton@...nel.org>,
        David Hildenbrand <david@...hat.com>,
        Jason Gunthorpe <jgg@...dia.com>,
        Logan Gunthorpe <logang@...tatee.com>,
        Hillf Danton <hdanton@...a.com>, linux-fsdevel@...r.kernel.org,
        linux-block@...r.kernel.org, linux-kernel@...r.kernel.org,
        linux-mm@...ck.org, Guenter Roeck <groeck7@...il.com>,
        Christoph Hellwig <hch@....de>,
        John Hubbard <jhubbard@...dia.com>,
        Miklos Szeredi <miklos@...redi.hu>,
        Hugh Dickins <hughd@...gle.com>,
        Jan Harkes <jaharkes@...cmu.edu>,
        Arnd Bergmann <arnd@...db.de>, coda@...cmu.edu,
        codalist@...a.cs.cmu.edu, linux-unionfs@...r.kernel.org
Subject: Re: [PATCH v3 5/5] shmem, overlayfs, coda, tty, proc, kernfs,
 random: Fix splice-read

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@...hat.com>
> > cc: Daniel Golle <daniel@...rotopia.org>
> > cc: Guenter Roeck <groeck7@...il.com>
> > cc: Christoph Hellwig <hch@....de>
> > cc: Jens Axboe <axboe@...nel.dk>
> > cc: Al Viro <viro@...iv.linux.org.uk>
> > cc: John Hubbard <jhubbard@...dia.com>
> > cc: David Hildenbrand <david@...hat.com>
> > cc: Matthew Wilcox <willy@...radead.org>
> > cc: Miklos Szeredi <miklos@...redi.hu>
> > cc: Hugh Dickins <hughd@...gle.com>
> > cc: Jan Harkes <jaharkes@...cmu.edu>
> > cc: Arnd Bergmann <arnd@...db.de>
> > cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
> > cc: coda@...cmu.edu
> > cc: codalist@...a.cs.cmu.edu
> > cc: linux-unionfs@...r.kernel.org
> > cc: linux-block@...r.kernel.org
> > cc: linux-fsdevel@...r.kernel.org
> > cc: linux-mm@...ck.org
> > Link: https://lore.kernel.org/r/Y+pdHFFTk1TTEBsO@makrotopia.org/ [1]
> > ---
> 
> Acked-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>

Confirming that the above indeed fixes the NULL pointer bug.

Tested-by: Daniel Golle <daniel@...rotopia.org>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ