Fix: bind interrupted by seccomp signal race (#14554)
* Use wait_for_completion_killable instead of the default wait_for_completion_interruptible * retry if kernel does not support the new flag
Feng Wang committed
Apr 1, 2026 at 09:35 UTC
49e245cc4d2302ec2103e10a80c732628fe7ec46
1 file changed
+7
-1
src/linux/init/main.cpp
+7
-1
@@ -3615,7 +3615,13 @@ Return Value:
3615
.filter = Filter,
3616
};
3617
3618
- wil::unique_fd Fd{syscall(__NR_seccomp, SECCOMP_SET_MODE_FILTER, SECCOMP_FILTER_FLAG_NEW_LISTENER, &Prog)};
3618
+ wil::unique_fd Fd{syscall(
3619
+ __NR_seccomp, SECCOMP_SET_MODE_FILTER, SECCOMP_FILTER_FLAG_NEW_LISTENER | SECCOMP_FILTER_FLAG_WAIT_KILLABLE_RECV, &Prog)};
3620
+ if (!Fd && errno == EINVAL)
3621
+ {
3622
+ LOG_INFO("seccomp failed with EINVAL with SECCOMP_FILTER_FLAG_WAIT_KILLABLE_RECV, retrying without it.");
3623
+ Fd = syscall(__NR_seccomp, SECCOMP_SET_MODE_FILTER, SECCOMP_FILTER_FLAG_NEW_LISTENER, &Prog);
3624
+ }
3625
if (!Fd)
3626
{
3627
LOG_ERROR("Failed to register bpf syscall hook, {}", errno);