[PATCH] test_aio: Skip io_uring tests when kernel disables it

From: Henson Choi <assam258(at)gmail(dot)com>
To: pgsql-hackers(at)lists(dot)postgresql(dot)org
Cc: Andres Freund <andres(at)anarazel(dot)de>, Nazir Bilal Yavuz <byavuz81(at)gmail(dot)com>
Subject: [PATCH] test_aio: Skip io_uring tests when kernel disables it
Date: 2025-12-08 02:12:35
Message-ID: CAAAe_zAwukEBR+Yahga4v0dR2FJtRt=cd-Fh0p=NE16WT-ZepA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi hackers,

I encountered test_aio failures on RHEL 9 / Rocky Linux 9 systems where
io_uring is disabled by default (io_uring_disabled=2). This is increasingly
common in enterprise environments.

Background:
Red Hat disabled io_uring in 2021 and maintains this policy in RHEL 9
for security reasons. Many critical CVEs have been found (CVE-2021-41073,
CVE-2022-2602, CVE-2024-0582, etc.), and Google reported that 60% of their
2022 kernel exploit submissions targeted io_uring, leading them to disable
it across Android, ChromeOS, and production servers.

Current behavior:
The test_aio module only checks if PostgreSQL was compiled with io_uring
support (have_io_uring) but doesn't check if the kernel allows it.
This causes test failures on RHEL 9 and similar distributions.

Proposed solution:
Add io_uring_enabled() to check /proc/sys/kernel/io_uring_disabled.
Only run io_uring tests when the value is 0 (fully enabled).

Why skip io_uring_disabled=1 (CAP_SYS_ADMIN required) as well:
- Checking for CAP_SYS_ADMIN capability adds complexity
- Most test users don't have CAP_SYS_ADMIN
- High probability of failure, safer to skip
- Prioritize test simplicity and stability over coverage

Testing:
- ✓ RHEL 9 (io_uring_disabled=2): Tests skip correctly
- ✓ Ubuntu 24 (io_uring_disabled=0): Tests run normally

The patch is minimal (adds one function, modifies one condition) and
follows the existing pattern used for injection points testing.

Thoughts?

Best regards,
Henson Choi

Attachment Content-Type Size
0001-test_aio-Skip-io_uring-tests-when-kernel-disables-it.patch application/octet-stream 2.7 KB

Browse pgsql-hackers by date

  From Date Subject
Next Message Chao Li 2025-12-08 02:52:02 Re: tuple radix sort
Previous Message cca5507 2025-12-08 02:07:53 Re: Fix incorrect comments in tuplesort.c