Thread: pgsql: aio: Be more paranoid about interrupts

pgsql: aio: Be more paranoid about interrupts

From
Andres Freund
Date:
aio: Be more paranoid about interrupts

As reported by Noah, it's possible, although practically very unlikely, that
interrupts could be processed in between pgaio_io_reopen() and
pgaio_io_perform_synchronously(). Prevent that by explicitly holding
interrupts.

It also seems good to add an assertion to pgaio_io_before_prep() to ensure
that interrupts are held, as otherwise FDs referenced by the IO could be
closed during interrupt processing. All code in the aio series currently runs
the code with interrupts held, but it seems better to be paranoid.

Reviewed-by: Noah Misch <noah@leadboat.com>
Reported-by: Noah Misch <noah@leadboat.com>
Discussion: https://postgr.es/m/20250324002939.5c.nmisch@google.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/96da9050a57aece4a48ab34a84bc3b3412708a20

Modified Files
--------------
src/backend/storage/aio/aio_io.c        | 6 ++++++
src/backend/storage/aio/method_worker.c | 9 +++++++++
2 files changed, 15 insertions(+)