Re: [PATCH v4 1/5] io_uring: use release-acquire ordering for IORING_SETUP_R_DISABLED

From: Caleb Sander Mateos

Date: Mon Dec 15 2025 - 11:29:59 EST


On Mon, Dec 15, 2025 at 3:31 AM Joanne Koong <joannelkoong@xxxxxxxxx> wrote:
>
> On Wed, Dec 3, 2025 at 12:41 AM Caleb Sander Mateos
> <csander@xxxxxxxxxxxxxxx> wrote:
> >
> > io_uring_enter() and io_msg_ring() read ctx->flags and
> > ctx->submitter_task without holding the ctx's uring_lock. This means
> > they may race with the assignment to ctx->submitter_task and the
> > clearing of IORING_SETUP_R_DISABLED from ctx->flags in
> > io_register_enable_rings(). Ensure the correct ordering of the
> > ctx->flags and ctx->submitter_task memory accesses by storing to
> > ctx->flags using release ordering and loading it using acquire ordering.
> >
> > Signed-off-by: Caleb Sander Mateos <csander@xxxxxxxxxxxxxxx>
> > Fixes: 7e84e1c7566a ("io_uring: allow disabling rings during the creation")
>
> This LGTM. But should the fixes be commit 7cae596bc31f ("io_uring:
> register single issuer task at creation")? AFAICT, that's the commit
> that introduces the ctx->submitter_task assignment in
> io_register_enable_rings() that causes the memory reordering issue
> with the unlocked read in io_uring_add_tctx_node(). I don't see this
> issue in 7e84e1c7566a.

Yes, that looks correct to me. Thanks for taking a look.

--Caleb