ladybird/Libraries/LibSandbox/Seccomp.h
Andreas Kling a69fd61eaf Compositor: Sandbox the process on Linux
Add opt-in Linux sandbox support to Compositor. Ladybird and test-web
pass --enable-sandbox through when requested, and Compositor only
installs the sandbox when that flag is present.

Install the sandbox after Compositor has initialized platform, font, and
GPU state so startup probing can complete before filesystem access is
removed. Compose the runtime seccomp policy from LibSandbox building
blocks and add an explicit GPU device operations group for driver IPC
through already-open descriptors.
2026-06-09 19:35:09 +02:00

43 lines
889 B
C++

/*
* Copyright (c) 2026-present, the Ladybird developers.
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/Error.h>
#include <AK/Vector.h>
#include <linux/filter.h>
namespace Sandbox {
class SeccompPolicy {
public:
SeccompPolicy();
void deny_readonly_filesystem_probes();
void allow_file_descriptor_operations();
void allow_ipc();
void allow_memory_without_executable_mappings();
void allow_threads();
void allow_signals();
void allow_clocks();
void allow_gpu_device_operations();
void allow_process_metadata();
void allow_common_runtime();
void allow_prctl();
void allow_exit();
[[nodiscard]] ErrorOr<void> install();
private:
void append(sock_filter);
void append_architecture_check();
void append_load_syscall_number();
void append_kill();
Vector<sock_filter> m_filter;
};
}