@@ -196,6 +196,11 @@ syscall(long number, ...) {
&& number != SYS_landlock_create_ruleset
&& number != SYS_landlock_add_rule
&& number != SYS_landlock_restrict_self
+#endif
+#ifdef SYS_io_uring_setup
+ && number != SYS_io_uring_setup
+ && number != SYS_io_uring_enter
+ && number != SYS_io_uring_register
#endif
) {
if (!real_syscall)
@@ -242,6 +247,21 @@ syscall(long number, ...) {
}
#endif
+#ifdef SYS_io_uring_setup
+ /* Operations submitted through an io_uring never pass through
+ * libpseudo, so files they create or change aren't tracked
+ * (YOCTO #15244). Report io_uring as unsupported, as a kernel
+ * without it does, so callers fall back to ordinary calls.
+ */
+ if (number == SYS_io_uring_setup ||
+ number == SYS_io_uring_enter ||
+ number == SYS_io_uring_register) {
+ pseudo_debug(PDBGF_SYSCALL, "syscall, refusing io_uring.\n");
+ errno = ENOSYS;
+ return -1;
+ }
+#endif
+
#ifdef SYS_openat2
/* There is a CVE patch (CVE-2025-45582) to tar 1.34 in Centos Stream which
* uses syscall to access openat2() and breaks builds if we don't redirect.
new file mode 100644
@@ -0,0 +1,47 @@
+/*
+ * SPDX-License-Identifier: LGPL-2.1-only
+ *
+ * Operations submitted through an io_uring bypass libpseudo, so pseudo
+ * reports io_uring as unsupported to callers using syscall(), such as
+ * libuv, which then fall back to ordinary calls.
+ */
+#define _GNU_SOURCE
+
+#include <errno.h>
+#include <stdio.h>
+#include <string.h>
+#include <sys/syscall.h>
+#include <unistd.h>
+
+/* The numbers are the same on every architecture using the common table. */
+#ifndef __NR_io_uring_setup
+#define __NR_io_uring_setup 425
+#endif
+#ifndef __NR_io_uring_enter
+#define __NR_io_uring_enter 426
+#endif
+#ifndef __NR_io_uring_register
+#define __NR_io_uring_register 427
+#endif
+
+static int
+check(const char *name, long rc) {
+ if (rc != -1 || errno != ENOSYS) {
+ printf("%s: expected ENOSYS, got %ld (%s)\n", name, rc, strerror(errno));
+ if (rc >= 0)
+ close(rc);
+ return 1;
+ }
+ return 0;
+}
+
+int
+main(void) {
+ char params[120] = { 0 }; /* struct io_uring_params */
+ int rc = 0;
+
+ rc |= check("io_uring_setup", syscall(__NR_io_uring_setup, 1, params));
+ rc |= check("io_uring_enter", syscall(__NR_io_uring_enter, -1, 0, 0, 0, NULL, 0));
+ rc |= check("io_uring_register", syscall(__NR_io_uring_register, -1, 0, NULL, 0));
+ return rc;
+}
new file mode 100755
@@ -0,0 +1,7 @@
+#!/bin/sh
+#
+# SPDX-License-Identifier: LGPL-2.1-only
+#
+# io_uring through syscall() is reported as unsupported under pseudo.
+
+./test/test-io-uring-syscall
Operations submitted through an io_uring are carried out by the kernel without passing through libpseudo, so files they create or change are not tracked, and end up with the build user's ownership. libuv, used by nodejs, and the meta-selftest reproducer set up a ring with syscall(). Refuse io_uring_setup(), io_uring_enter() and io_uring_register() with ENOSYS, as a kernel without io_uring does, so callers fall back to the ordinary calls pseudo can see. This doesn't cover callers that make the system call themselves, such as liburing. test-io-uring-syscall checks that all three fail with ENOSYS under pseudo. [YOCTO #15244] Reported-by: Martin Jansa <Martin.Jansa@gmail.com> AI-Generated: Uses GitHub Copilot Signed-off-by: Mark Hatle <mark.hatle@amd.com> --- ports/linux/pseudo_wrappers.c | 20 +++++++++++++++ test/test-io-uring-syscall.c | 47 +++++++++++++++++++++++++++++++++++ test/test-io-uring-syscall.sh | 7 ++++++ 3 files changed, 74 insertions(+) create mode 100644 test/test-io-uring-syscall.c create mode 100755 test/test-io-uring-syscall.sh