]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
io_uring/kbuf: use READ_ONCE() for userspace-mapped memory
authorCaleb Sander Mateos <csander@purestorage.com>
Thu, 4 Dec 2025 22:43:31 +0000 (15:43 -0700)
committerJens Axboe <axboe@kernel.dk>
Thu, 4 Dec 2025 22:46:23 +0000 (15:46 -0700)
commit78385c7299f7514697d196b3233a91bd5e485591
tree4f67ad6d7d08c36e09cc3ef6fb1425d7c89fd79e
parent525916ce496615f531091855604eab9ca573b195
io_uring/kbuf: use READ_ONCE() for userspace-mapped memory

The struct io_uring_buf elements in a buffer ring are in a memory region
accessible from userspace. A malicious/buggy userspace program could
therefore write to them at any time, so they should be accessed with
READ_ONCE() in the kernel. Commit 98b6fa62c84f ("io_uring/kbuf: always
use READ_ONCE() to read ring provided buffer lengths") already switched
the reads of the len field to READ_ONCE(). Do the same for bid and addr.

Signed-off-by: Caleb Sander Mateos <csander@purestorage.com>
Fixes: c7fb19428d67 ("io_uring: add support for ring mapped supplied buffers")
Cc: Joanne Koong <joannelkoong@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
io_uring/kbuf.c