From 2bf80f0ac6daaa28c0ad2c7d3ed1def59ae243e8 Mon Sep 17 00:00:00 2001 From: Motoyuki Kimura Date: Sat, 8 Nov 2025 18:13:12 +0900 Subject: [PATCH] runtime: disable io-uring on `EPERM` (#7724) --- tokio/src/runtime/io/driver/uring.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tokio/src/runtime/io/driver/uring.rs b/tokio/src/runtime/io/driver/uring.rs index 2df69cbbe..f3de56b76 100644 --- a/tokio/src/runtime/io/driver/uring.rs +++ b/tokio/src/runtime/io/driver/uring.rs @@ -194,6 +194,13 @@ impl Handle { self.set_uring_state(State::Unsupported); Ok(false) } + // If we get EPERM, io-uring syscalls may be blocked (for example, by seccomp). + // In this case, we try to fall back to spawn_blocking for this and future operations. + // See also: https://github.com/tokio-rs/tokio/issues/7691 + Err(e) if e.raw_os_error() == Some(libc::EPERM) => { + self.set_uring_state(State::Unsupported); + Ok(false) + } // For other system errors, we just return it. Err(e) => Err(e), },