aboutsummaryrefslogtreecommitdiff
path: root/www/chromium/files/patch-sandbox_policy_sandbox.cc
blob: 855f4344dff67c3e309d3e6b8d040a9894d5930e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
--- sandbox/policy/sandbox.cc.orig	2021-06-11 14:21:39 UTC
+++ sandbox/policy/sandbox.cc
@@ -12,6 +12,10 @@
 #include "base/android/jni_android.h"
 #endif  // defined(OS_ANDROID)
 
+#if defined(OS_FREEBSD)
+#include "sandbox/policy/freebsd/sandbox_freebsd.h"
+#endif  // defined(OS_FREEBSD)
+
 #if defined(OS_LINUX) || defined(OS_CHROMEOS)
 #include "sandbox/policy/linux/sandbox_linux.h"
 #endif  // defined(OS_LINUX) || defined(OS_CHROMEOS)
@@ -29,6 +33,12 @@
 namespace sandbox {
 namespace policy {
 
+#if defined(OS_FREEBSD)
+bool Sandbox::Initialize(SandboxType sandbox_type) {
+  return SandboxFreeBSD::GetInstance()->InitializeSandbox(sandbox_type);
+}
+#endif  // defined(OS_FREEBSD)
+
 #if defined(OS_LINUX) || defined(OS_CHROMEOS)
 bool Sandbox::Initialize(SandboxType sandbox_type,
                          SandboxLinux::PreSandboxHook hook,
@@ -89,6 +99,8 @@ bool Sandbox::IsProcessSandboxed() {
       base::android::MethodID::Get<base::android::MethodID::TYPE_STATIC>(
           env, process_class.obj(), "isIsolated", "()Z");
   return env->CallStaticBooleanMethod(process_class.obj(), is_isolated);
+#elif defined(OS_FREEBSD)
+  return SandboxFreeBSD::GetInstance()->IsSandboxed();
 #elif defined(OS_FUCHSIA)
   // TODO(https://crbug.com/1071420): Figure out what to do here. Process
   // launching controls the sandbox and there are no ambient capabilities, so