Truly independent web browser
VideoDecoderServer: Load the system FFmpeg before sandboxing
Zaggy1024b59cd788f4b1
diff --git a/Services/VideoDecoderServer/SandboxLinux.cpp b/Services/VideoDecoderServer/SandboxLinux.cppindex 5e2f3cc40aa..475a05270c0 100644--- a/Services/VideoDecoderServer/SandboxLinux.cpp+++ b/Services/VideoDecoderServer/SandboxLinux.cpp@@ -24,6 +24,7 @@ ErrorOr<void> restrict_filesystem(bool allow_gpu_driver)// cpptrace opens loaded ELF objects when symbolizing in-process stack traces.TRY(Sandbox::add_path_if_exists(paths, executable_path, Sandbox::PathRule::Access::ReadOnly));TRY(Sandbox::add_path_if_exists(paths, LexicalPath::join(build_root, "lib"sv).string(), Sandbox::PathRule::Access::ReadOnly));+ TRY(Sandbox::add_loaded_library_directories(paths, build_root));TRY(Sandbox::add_path_if_exists(paths, "/proc/self"sv, Sandbox::PathRule::Access::ReadOnly));if (allow_gpu_driver)TRY(Sandbox::add_gpu_driver_paths(paths));diff --git a/Services/VideoDecoderServer/main.cpp b/Services/VideoDecoderServer/main.cppindex 08739f29213..cf647c50aba 100644--- a/Services/VideoDecoderServer/main.cpp+++ b/Services/VideoDecoderServer/main.cpp@@ -86,6 +86,12 @@ ErrorOr<int> ladybird_main(Main::Arguments arguments)return Error::from_string_literal("Malformed GPU device identity");}+#if defined(AK_OS_LINUX) && !defined(AK_OS_ANDROID)+ // H.264 and HEVC decode through the system library, which loads before the sandbox would keep it from reading its+ // files or making the syscalls its dependencies make.+ Media::FFmpeg::SystemFFmpeg::load();+#endif+#if defined(AK_OS_LINUX)if (!disable_sandbox)TRY(VideoDecoderServer::restrict_filesystem(gpu_device_identity.has_value()));@@ -99,12 +105,6 @@ ErrorOr<int> ladybird_main(Main::Arguments arguments)}#endif-#if defined(USE_VULKAN_DMABUF_IMAGES) && defined(AK_OS_LINUX) && !defined(AK_OS_ANDROID)- // H.264 and HEVC decode through the system library, whose dependencies make syscalls the sandbox will not allow.- if (Media::VulkanVideoDevice::the() != nullptr)- Media::FFmpeg::SystemFFmpeg::load();-#endif-Vector<Media::VideoDecoderRegistration> hosted_decoders;auto hardware_decoders = Media::hardware_video_decoders();hosted_decoders.append(hardware_decoders.data(), hardware_decoders.size());