CVE: Pending (kernel fix and liburing test both merged)
Affected: Linux kernels with IORING_SETUP_SQE_MIXED (introduced by commit 1cba30bf9fdd)
Fix: c76e0f1d77f8 — merged into io_uring-7.0 on 2026-03-10
Impact: 64-byte OOB read past the SQE array from unprivileged userspace
Discoverer: Tom Ryan
When IORING_SETUP_SQE_MIXED is used without IORING_SETUP_NO_SQARRAY, the boundary check for 128-byte SQE operations in io_init_req() validated the logical SQ head position rather than the physical SQE index. Since sq_array allows userspace to remap logical positions to arbitrary physical indices, an unprivileged user can place a 128-byte operation at the last physical SQE slot, causing io_uring_cmd_sqe_copy() to memcpy 64 bytes past the end of the SQE array into adjacent kernel memory.
IORING_SETUP_SQE_MIXED allows mixing 64-byte and 128-byte SQEs in the same ring. Unlike IORING_SETUP_SQE128 (which doubles the array), SQE_MIXED allocates standard 64-byte slots. A 128-byte operation consumes two consecutive physical slots.
For sq_entries=64: the SQE array is 64 * 64 = 4096 bytes (one page). Valid physical indices for 128-byte ops are 0 through 62. Index 63 (the last slot) only has 64 bytes before the array boundary.
io_get_sqe() uses sq_array to remap logical SQ positions to physical SQE indices:
// io_uring/io_uring.c - io_get_sqe()
unsigned head = ctx->cached_sq_head++ & mask; // logical position
head = READ_ONCE(ctx->sq_array[head]); // user-controlled remap
if (unlikely(head >= ctx->sq_entries))
return false; // bounds check: physical index < sq_entries
*sqe = &ctx->sq_sqes[head]; // physical SQE pointerThe bounds check ensures head < sq_entries (0 to 63), which is correct for 64-byte operations. But for 128-byte operations, the valid range is head < sq_entries - 1 (0 to 62).
io_init_req() had a check intended to prevent 128-byte ops at the ring boundary:
// io_uring/io_uring.c - io_init_req()
if (def->is_128 && !(ctx->flags & IORING_SETUP_SQE128)) {
if (!(ctx->flags & IORING_SETUP_SQE_MIXED) || *left < 2 ||
!(ctx->cached_sq_head & (ctx->sq_entries - 1))) // <-- THE BUG
return io_init_fail_req(req, -EINVAL);!(ctx->cached_sq_head & (ctx->sq_entries - 1)) checks the logical position. This is correct for NO_SQARRAY rings where physical == logical. But when sq_array is present, an attacker sets sq_array[N] = sq_entries - 1, passing the logical check while placing the 128-byte operation at the last physical slot.
io_uring_cmd_sqe_copy() copies 128 bytes from the SQE:
// io_uring/uring_cmd.c
memcpy(ac->sqes, ioucmd->sqe, uring_sqe_size(req)); // 128 bytesWhen ioucmd->sqe points to sq_sqes[sq_entries - 1] (the last 64-byte slot), this reads:
- Bytes 0-63: valid SQE data
- Bytes 64-127: 64 bytes past the SQE array (adjacent kernel heap)
sq_array[0] = 0 → NOP at physical index 0 (passes position-0 check)
sq_array[1] = sq_entries-1 → URING_CMD128 at LAST physical slot
sq_array[2] = 1 → consumed by 128-byte op's second slot
io_uring_enter(fd, 3, ...)
→ io_get_sqe reads sq_array[1] = 63 (last physical index)
→ io_init_req: logical check passes (cached_sq_head=2, 2 & 63 != 0)
→ io_uring_cmd_prep: sets REQ_F_SQE_COPY
→ io_uring_cmd_sqe_copy: memcpy(dst, &sq_sqes[63], 128) ← 64 bytes OOB
Deterministic. Unprivileged. No race condition.
Commit c76e0f1d77f8 replaces the logical position check with a physical index validation:
if (!(ctx->flags & IORING_SETUP_SQE_MIXED) || *left < 2 ||
- !(ctx->cached_sq_head & (ctx->sq_entries - 1)))
+ (unsigned)(sqe - ctx->sq_sqes) >= ctx->sq_entries - 1)sqe - ctx->sq_sqes computes the physical index directly from the SQE pointer (which was already resolved through sq_array by io_get_sqe()). This correctly handles both sq_array and NO_SQARRAY cases, since the pointer arithmetic reflects the actual physical position regardless of how it was derived.
The original submission proposed adding a separate physical index check alongside the existing logical check. Caleb Sander Mateos observed that the physical index validation subsumes the logical check entirely, and Keith Busch suggested folding it into the existing conditional. The final patch is a single-line replacement.
The SQE array is allocated via alloc_pages (order 0 for 64 entries = 1 page). KASAN uses page-granularity tracking for the page allocator, so the OOB read into the adjacent direct-map page appears valid. A kmalloc-based allocation with KASAN slab quarantine would catch this, but io_uring uses page-level allocations for the SQE ring.
See sqe_mixed_oob.c in the full repository, or sqe_mixed_oob_v2.c attached to this gist.
Output on vulnerable kernel (Linux 7.0-rc2, ARM64):
Ring created: fd=3 sq_entries=64 (SQE array = 4096 bytes)
Submitting: NOP@phys[0], URING_CMD128@phys[63] (LAST)
Expected: 128-byte memcpy at sq_sqes[63] reads 64 bytes OOB
io_uring_enter: ret=3
CQEs (2):
user_data=0xaaaa res=0 flags=0x0 (NOP: success)
user_data=0xbbbb res=-95 flags=0x0 (URING_CMD128: EOPNOTSUPP)
The -EOPNOTSUPP confirms the full path executed through io_uring_cmd_sqe_copy() — the pipe fd doesn't support uring_cmd, but the 128-byte memcpy already ran.
- 2026-03-08: Reported to security@kernel.org
- 2026-03-09: Greg KH and Jens Axboe responded, requested formal patch. v1 patch sent. Jens noted it's not particularly nefarious (6.19+ only), asked to resend publicly to io-uring@vger.kernel.org
- 2026-03-09: v2 patch sent to io-uring@vger.kernel.org incorporating review feedback from Caleb Sander Mateos and Keith Busch
- 2026-03-10: Kernel patch applied by Jens Axboe, commit c76e0f1d77f8
- 2026-03-11: liburing test patch (v2) applied by Jens Axboe, commit a35e4943ec95