Re: io_uring: Fix danger of completion getting reused before being read

From: Kirill Reshke <reshkekirill(at)gmail(dot)com>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: io_uring: Fix danger of completion getting reused before being read
Date: 2026-01-15 18:53:56
Message-ID: CALdSSPgLT1PP5hzqr1o+fGV_HjMSThvPsSSPiGOeLBwUaWO1eg@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, 15 Jan 2026 at 20:38, Andres Freund <andres(at)anarazel(dot)de> wrote:
>
> Hi,
>
> I privately got a report about a bug in method_io_uring.c:
>
> We are calling io_uring_cqe_seen(..., cqe) before reading cqe->res. That
> allows the completion to be reused, which in turn could lead to cqe->res being
> overwritten. The window for that is very narrow and the likelihood of it
> happening is very low, as we should never actually utilize all CQEs, but the
> consequences would be bad.
>
> I plan to push the fix soon-ish.
>
> Greetings,
>
> Andres Freund

I see this is already committed as 807764990. Just pointing in case
somebody wants to review.

--
Best regards,
Kirill Reshke

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2026-01-15 18:55:35 Re: Optimize LISTEN/NOTIFY
Previous Message Benjamin Leff 2026-01-15 18:53:51 Re: Client-only Meson Build From Sources