Truly independent web browser
Compositor: Start fontconfig before the sandbox on Linux
Andreas Kling053ed2292e43
diff --git a/Services/Compositor/SandboxLinux.cpp b/Services/Compositor/SandboxLinux.cppindex 23bb7e2a2e8..725b5fd0f07 100644--- a/Services/Compositor/SandboxLinux.cpp+++ b/Services/Compositor/SandboxLinux.cpp@@ -9,6 +9,10 @@#include <LibSandbox/Sandbox.h>#include <LibSandbox/Seccomp.h>+#if defined(USE_FONTCONFIG)+# include <LibGfx/Font/GlobalFontConfig.h>+#endif+namespace Compositor {ErrorOr<void> restrict_filesystem(StringView resource_root)@@ -16,6 +20,12 @@ ErrorOr<void> restrict_filesystem(StringView resource_root)TRY(Sandbox::install_no_new_privileges());TRY(Sandbox::configure_runtime());+#if defined(USE_FONTCONFIG)+ // We ask fontconfig how to hint each font that we draw. It reads its configuration files when it starts, and they+ // can be anywhere, so it has to start before the sandbox is in place.+ (void)Gfx::GlobalFontConfig::the();+#endif+Vector<Sandbox::PathRule> paths;TRY(Sandbox::add_path_if_exists(paths, TRY(String::formatted("{}/fonts", resource_root)), Sandbox::PathRule::Access::ReadOnly));TRY(Sandbox::add_gpu_driver_paths(paths));