public inbox for io-uring@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Cyber_black <Cyberblackk@proton.me>
Cc: "io-uring@vger.kernel.org" <io-uring@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"axboe@kernel.dk" <axboe@kernel.dk>,
	"stable@vger.kernel.org" <stable@vger.kernel.org>
Subject: Re: [BUG] io_uring: possible CQE32 overflow flush inconsistency in __io_cqring_overflow_flush()
Date: Fri, 19 Jun 2026 08:00:03 +0200	[thread overview]
Message-ID: <2026061918-symphonic-glass-17ca@gregkh> (raw)
In-Reply-To: <wK6w40HQFWE32Zzw_hyI9ctCQpBgXgOxWsfBFc2ptY-VZFPHBE5_wzDIu4AT-8ZX2wdr-C3-T6g3mUblIqOMqjCvBhTyMRg0BvOCwmh7E-E=@proton.me>

On Fri, Jun 19, 2026 at 04:49:32AM +0000, Cyber_black wrote:
> 
> Hi,
> 
> I believe there is a bug in __io_cqring_overflow_flush() in io_uring/io_uring.c
> where `is_cqe32` and `cqe_size` are left in an inconsistent state when
> IORING_SETUP_CQE32 is set, potentially leading to an out-of-bounds write into
> the CQ ring.
> 
> AFFECTED FILE
> =============
> io_uring/io_uring.c
> Function: __io_cqring_overflow_flush()
> 
> KERNEL VERSION
> ==============
> Observed in current upstream (v6.8+). Please confirm against your tree.

Huh?  Was this written by a LLM?

> PROPOSED FIX
> ============
> If Block B is intentional (i.e. io_get_cqe_overflow already handles CQE32 slot
> sizing internally when IORING_SETUP_CQE32 is set), then cqe_size must also be
> reset:
> 
>     if (ctx->flags & IORING_SETUP_CQE32) {
> 
> is_cqe32 = false;
>         cqe_size = sizeof(struct io_uring_cqe); /* undo Block A */
>     }
> 
> Alternatively, if Block B is dead/incorrect code, it should be removed entirely
> and io_get_cqe_overflow() called with is_cqe32 = true when appropriate.
> 
> The correct fix depends on the intended semantics of is_cqe32 vs ctx flag
> inside io_get_cqe_overflow(), which the maintainer is best placed to confirm.

Please turn this into a real patch that you have tested to verify it
resolves the issue so you get full credit for the fix.

thanks,

greg k-h

  reply	other threads:[~2026-06-19  6:01 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-19  4:49 [BUG] io_uring: possible CQE32 overflow flush inconsistency in __io_cqring_overflow_flush() Cyber_black
2026-06-19  6:00 ` Greg KH [this message]
  -- strict thread matches above, loose matches on Subject: below --
2026-06-19  8:05 Cyber_black
2026-06-19 16:07 ` Gabriel Krisman Bertazi
2026-06-20  6:13 Cyber_black
2026-06-20  6:17 ` gregkh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2026061918-symphonic-glass-17ca@gregkh \
    --to=gregkh@linuxfoundation.org \
    --cc=Cyberblackk@proton.me \
    --cc=axboe@kernel.dk \
    --cc=io-uring@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox