diff --git a/sandboxed_api/sandbox2/policybuilder.cc b/sandboxed_api/sandbox2/policybuilder.cc index 5e562f3..69feb42 100644 --- a/sandboxed_api/sandbox2/policybuilder.cc +++ b/sandboxed_api/sandbox2/policybuilder.cc @@ -844,6 +844,16 @@ PolicyBuilder& PolicyBuilder::AllowRename() { return *this; } +PolicyBuilder& PolicyBuilder::AllowEventFd() { + AllowSyscalls({ +#ifdef __NR_eventfd + __NR_eventfd, +#endif + __NR_eventfd2, + }); + return *this; +} + PolicyBuilder& PolicyBuilder::AllowPrctlSetName() { AddPolicyOnSyscall(__NR_prctl, {ARG_32(0), JEQ32(PR_SET_NAME, ALLOW)}); return *this; diff --git a/sandboxed_api/sandbox2/policybuilder.h b/sandboxed_api/sandbox2/policybuilder.h index b265a39..cd228a4 100644 --- a/sandboxed_api/sandbox2/policybuilder.h +++ b/sandboxed_api/sandbox2/policybuilder.h @@ -474,6 +474,12 @@ class PolicyBuilder final { // - renameat2 PolicyBuilder& AllowRename(); + // Appends code to allow creating event notification file descriptors. + // Allows these syscalls: + // - eventfd (if available) + // - eventfd2 + PolicyBuilder& AllowEventFd(); + // Appends code to allow polling files. // Allows these syscalls: // - poll (if available)