Skip to content

Commit b07efbd

Browse files
committed
fix(sandbox): fall back to plain seccomp listener when WAIT_KILLABLE_RECV is unavailable
SECCOMP_FILTER_FLAG_WAIT_KILLABLE_RECV was added in Linux 5.19. On older kernels (for example RHEL 9.x / 5.14 nodes such as RHCOS on OpenShift) the flag is rejected with EINVAL, which made the capability-free sandbox fail to start during the notification probe with "notification launcher disappeared". Install the notification listener with WAIT_KILLABLE_RECV when the kernel supports it and fall back to a plain NEW_LISTENER on EINVAL. The fallback listener records wait_killable_recv = false: its notification receive is uninterruptible, but the sandbox is otherwise fully functional. Signed-off-by: Akram <akram.benaissi@gmail.com>
1 parent 6d496f5 commit b07efbd

1 file changed

Lines changed: 13 additions & 9 deletions

File tree

‎crates/openshell-isolation-interface/src/linux/seccomp_notify.rs‎

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -330,16 +330,20 @@ pub fn install_listener(syscalls: &[i64]) -> io::Result<NotificationListener> {
330330
verify_notification_sizes()?;
331331
set_no_new_privileges()?;
332332

333-
install_listener_with_flags(syscalls, true).map_err(|error| {
334-
if error.raw_os_error() == Some(libc::EINVAL) {
335-
io::Error::new(
336-
io::ErrorKind::Unsupported,
337-
"seccomp WAIT_KILLABLE_RECV is required (Linux 5.19 or newer)",
338-
)
339-
} else {
340-
error
333+
// WAIT_KILLABLE_RECV (Linux 5.19+) makes the supervisor's notification
334+
// receive interruptible by a fatal signal. Kernels older than 5.19 (for
335+
// example RHEL 9.x / 5.14 nodes) reject the flag with EINVAL. Rather than
336+
// refusing to start there, fall back to a plain listener: the notification
337+
// receive is then uninterruptible, but the sandbox is otherwise fully
338+
// functional. The resulting listener records `wait_killable_recv = false`
339+
// so callers can observe the degraded cancellation semantics.
340+
match install_listener_with_flags(syscalls, true) {
341+
Ok(listener) => Ok(listener),
342+
Err(error) if error.raw_os_error() == Some(libc::EINVAL) => {
343+
install_listener_with_flags(syscalls, false)
341344
}
342-
})
345+
Err(error) => Err(error),
346+
}
343347
}
344348

345349
/// Install the capability-free workload networking listener on the calling

0 commit comments

Comments
 (0)