No description
Find a file
David Howells 794d8cf3a8
netfs: Report on NULL folioq in netfs_writeback_unlock_folios()
It seems that it's possible to get to netfs_writeback_unlock_folios() with
an empty rolling buffer during buffered writes.  This should not be
possible as the rolling buffer is initialised as the write request is set
up and thereafter maintains at least one folio_queue struct therein until
it gets destroyed.  This allows lockless addition and removal of
folio_queue structs in the buffer because, unlike with a ring buffer, the
producer and consumer each only need to look at and alter one pointer into
the buffer.

Now, the rolling buffer is only used for buffered I/O operations as
netfs_collect_write_results() should only call
netfs_writeback_unlock_folios() if the request is of origin type
NETFS_WRITEBACK, NETFS_WRITETHROUGH or NETFS_PGPRIV2_COPY_TO_CACHE.

So it would seem that one of the following occurred: (1) I/O started before
the request was fully initialised, (2) the origin got switched mid-flow or
(3) the request has already been freed and this is a UAF error.  I think
the last is the most likely.

Make netfs_writeback_unlock_folios() report information about the request
and subrequests if folioq is seen to be NULL to try and help debug this,
throw a warning and return.

Note that this does not try to fix the problem.

Reported-by: syzbot+af5c06208fa71bf31b16@syzkaller.appspotmail.com
Link: https://syzkaller.appspot.com/bug?extid=af5c06208fa71bf31b16
Signed-off-by: David Howells <dhowells@redhat.com>
Link: https://lore.kernel.org/r/ZxshMEW4U7MTgQYa@gmail.com/
Link: https://lore.kernel.org/r/20241216204124.3752367-33-dhowells@redhat.com
cc: Chang Yu <marcus.yu.56@gmail.com>
cc: Jeff Layton <jlayton@kernel.org>
cc: netfs@lists.linux.dev
cc: linux-fsdevel@vger.kernel.org
Signed-off-by: Christian Brauner <brauner@kernel.org>
2024-12-20 22:34:10 +01:00
arch i2c-for-6.13-rc1-part3 2024-12-01 13:38:24 -08:00
block block-6.13-20242901 2024-11-30 15:47:29 -08:00
certs
crypto
Documentation - Move the ->select callback to the correct ops structure in irq-mvebu-sei to 2024-12-01 12:37:58 -08:00
drivers i2c-for-6.13-rc1-part3 2024-12-01 13:38:24 -08:00
fs netfs: Report on NULL folioq in netfs_writeback_unlock_folios() 2024-12-20 22:34:10 +01:00
include afs: Add a tracepoint for afs_read_receive() 2024-12-20 22:34:09 +01:00
init
io_uring io_uring-6.13-20242901 2024-11-30 15:43:02 -08:00
ipc
kernel kheaders: Ignore silly-rename files 2024-12-20 22:07:55 +01:00
lib netfs: Add a tracepoint to log the lifespan of folio_queue structs 2024-12-20 22:34:02 +01:00
LICENSES
mm Kbuild updates for v6.13 2024-11-30 13:41:50 -08:00
net 9p update for 6.13-rc1 2024-11-30 10:28:14 -08:00
rust block-6.13-20242901 2024-11-30 15:47:29 -08:00
samples TTY / Serial driver updates for 6.13-rc1 2024-11-30 09:03:16 -08:00
scripts Kbuild updates for v6.13 2024-11-30 13:41:50 -08:00
security lsm/stable-6.13 PR 20241129 2024-11-30 18:14:56 -08:00
sound sound fixes for 6.13-rc1 2024-11-29 13:01:05 -08:00
tools turbostat version 2024.11.30 2024-11-30 18:30:22 -08:00
usr
virt
.clang-format
.clippy.toml
.cocciconfig
.editorconfig
.get_maintainer.ignore
.gitattributes
.gitignore Kbuild updates for v6.13 2024-11-30 13:41:50 -08:00
.mailmap
.rustfmt.toml
COPYING
CREDITS
Kbuild
Kconfig
MAINTAINERS i2c-for-6.13-rc1-part3 2024-12-01 13:38:24 -08:00
Makefile Linux 6.13-rc1 2024-12-01 14:28:56 -08:00
README

Linux kernel
============

There are several guides for kernel developers and users. These guides can
be rendered in a number of formats, like HTML and PDF. Please read
Documentation/admin-guide/README.rst first.

In order to build the documentation, use ``make htmldocs`` or
``make pdfdocs``.  The formatted documentation can also be read online at:

    https://www.kernel.org/doc/html/latest/

There are various text files in the Documentation/ subdirectory,
several of them using the reStructuredText markup notation.

Please read the Documentation/process/changes.rst file, as it contains the
requirements for building and running the kernel, and information about
the problems which may result by upgrading your kernel.