Skip to content

Truly independent web browser

LibSandbox: Add a seccomp group for epoll

Ali Mohammad Pur4cf72ed7e2db
diff --git a/Libraries/LibSandbox/Seccomp.cpp b/Libraries/LibSandbox/Seccomp.cpp
index df326aee151..f27f670f463 100644
--- a/Libraries/LibSandbox/Seccomp.cpp
+++ b/Libraries/LibSandbox/Seccomp.cpp
@@ -1493,6 +1493,15 @@ void SeccompPolicy::allow_ipc()
#endif
}
+// Event loops outside of LibCore, such as Rust's tokio, wait on their descriptors with epoll.
+void SeccompPolicy::allow_epoll()
+{
+ SECCOMP_APPEND_ALLOW_SYSCALL_IF_DEFINED(*this, epoll_create1);
+ SECCOMP_APPEND_ALLOW_SYSCALL_IF_DEFINED(*this, epoll_ctl);
+ SECCOMP_APPEND_ALLOW_SYSCALL_IF_DEFINED(*this, epoll_wait);
+ SECCOMP_APPEND_ALLOW_SYSCALL_IF_DEFINED(*this, epoll_pwait);
+}
+
// NB: A helper mints a socket pair to hand one end of a new IPC channel to another process. A helper that only ever
// uses the channels the Browser handed it does not need this.
void SeccompPolicy::allow_socket_pairs()
diff --git a/Libraries/LibSandbox/Seccomp.h b/Libraries/LibSandbox/Seccomp.h
index 3cb6c101ead..d68fb806319 100644
--- a/Libraries/LibSandbox/Seccomp.h
+++ b/Libraries/LibSandbox/Seccomp.h
@@ -25,6 +25,7 @@ public:
void allow_file_descriptor_operations();
void allow_process_creation();
void allow_ipc();
+ void allow_epoll();
void allow_socket_pairs();
void broker_unix_socket_connections();
void allow_pulseaudio_client_file_operations();