summaryrefslogtreecommitdiff
path: root/rust/kernel/alloc/kvec/errors.rs
diff options
context:
space:
mode:
authorJann Horn <jannh@google.com>2026-09-11 19:56:13 +0200
committerJens Axboe <axboe@kernel.dk>2026-09-21 10:50:56 -0600
commitf26f49600c9ae7b4b2a30958c3f7f08d350dc3db (patch)
tree3dd9bc28b040fdfc464b85b9159f46ac1d5d40fb /rust/kernel/alloc/kvec/errors.rs
parent23246634bf243cd1fe327995bf08602c54eb5bd4 (diff)
io_uring/fdinfo: ignore IORING_CQE_F_32 in last CQ array slot
A cqe32 entry spans two CQ array slots, so the last CQ array slot can't contain a cqe32 entry. If the CQ tail points at the last CQ array slot and the kernel wants to write a cqe32 entry, it uses io_fill_nop_cqe() to pad the last CQ array slot with a dummy entry and make the tail wrap around. However, malicious userspace can directly set IORING_CQE_F_32 on the last CQ array slot, causing __io_uring_show_fdinfo() to read the second cqe32 half from beyond the CQ array. Change __io_uring_show_fdinfo() to explicitly ignore the IORING_CQE_F_32 flag in this case. This is not a real bugfix, just tightening the code a bit, because: 1. the number of CQE slots is always a power of 2, see io_uring_fill_params 2. the ring_region region consists of: - a 64-byte header - pow(2, N) CQE slots (each 0x10 bytes) - optionally, the SQ array 3. the ring_region size must be page-aligned because it is shared memory Together, these properties imply that the last CQE slot can't be close before the end of a page, so the "out-of-bounds" data is in memory that is anyway accessible to userspace. Reported-by: Dominik Maier <dmnk+artist@google.com> Fixes: 82ceb7fcc5ff ("io_uring/fdinfo: handle mixed sized CQEs") Cc: stable+noautosel@kernel.org # no impact due to memory layout Reviewed-by: Gabriel Krisman Bertazi <krisman@suse.de> Signed-off-by: Jann Horn <jannh@google.com> Link: https://patch.msgid.link/20260911-uring-fdinfo-tighten-v2-1-fa24d517035e@google.com [axboe: fix wrap condition check] Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'rust/kernel/alloc/kvec/errors.rs')
0 files changed, 0 insertions, 0 deletions