1 --- content/zygote/zygote_main_linux.cc.orig 2022-06-17 14:20:10 UTC 2 +++ content/zygote/zygote_main_linux.cc 3 @@ -11,7 +11,9 @@ 4 #include <stddef.h> 5 #include <stdint.h> 6 #include <string.h> 7 +#if !defined(OS_BSD) 8 #include <sys/prctl.h> 9 +#endif 10 #include <sys/socket.h> 11 #include <sys/types.h> 12 #include <unistd.h> 13 @@ -41,7 +43,9 @@ 14 #include "sandbox/linux/services/thread_helpers.h" 15 #include "sandbox/linux/suid/client/setuid_sandbox_client.h" 16 #include "sandbox/policy/linux/sandbox_debug_handling_linux.h" 17 +#if !defined(OS_BSD) 18 #include "sandbox/policy/linux/sandbox_linux.h" 19 +#endif 20 #include "sandbox/policy/sandbox.h" 21 #include "sandbox/policy/switches.h" 22 #include "third_party/icu/source/i18n/unicode/timezone.h" 23 @@ -50,6 +54,7 @@ namespace content { 24 25 namespace { 26 27 +#if !defined(OS_BSD) 28 void CloseFds(const std::vector<int>& fds) { 29 for (const auto& it : fds) { 30 PCHECK(0 == IGNORE_EINTR(close(it))); 31 @@ -67,9 +72,11 @@ base::OnceClosure ClosureFromTwoClosures(base::OnceClo 32 }, 33 std::move(one), std::move(two)); 34 } 35 +#endif 36 37 } // namespace 38 39 +#if !defined(OS_BSD) 40 // This function triggers the static and lazy construction of objects that need 41 // to be created before imposing the sandbox. 42 static void ZygotePreSandboxInit() { 43 @@ -174,9 +181,11 @@ static void EnterLayerOneSandbox(sandbox::policy::Sand 44 CHECK(!using_layer1_sandbox); 45 } 46 } 47 +#endif 48 49 bool ZygoteMain( 50 std::vector<std::unique_ptr<ZygoteForkDelegate>> fork_delegates) { 51 +#if !defined(OS_BSD) 52 sandbox::SetAmZygoteOrRenderer(true, GetSandboxFD()); 53 54 auto* linux_sandbox = sandbox::policy::SandboxLinux::GetInstance(); 55 @@ -241,6 +250,9 @@ bool ZygoteMain( 56 57 // This function call can return multiple times, once per fork(). 58 return zygote.ProcessRequests(); 59 +#else 60 + return false; 61 +#endif 62 } 63 64 } // namespace content 65