Bug 1376910 - Unshare the SysV IPC namespace in content processes. r?gcp draft
authorJed Davis <jld@mozilla.com>
Wed, 28 Jun 2017 07:11:55 -0700
changeset 610917 7b5b8d3b1c5a8756ba9d6e8b93b22964f86ec08b
parent 610916 be0587e7ec6ad6509d8abd8d2fe565122cb3a6c2
child 637996 ea4a95e45f82b96fbd38d83f2cc93d4634d358a6
push id69044
push userbmo:jld@mozilla.com
push dateTue, 18 Jul 2017 23:08:32 +0000
reviewersgcp
bugs1376910
milestone56.0a1
Bug 1376910 - Unshare the SysV IPC namespace in content processes. r?gcp MozReview-Commit-ID: 1Uajj68rEuC
security/sandbox/linux/Sandbox.cpp
--- a/security/sandbox/linux/Sandbox.cpp
+++ b/security/sandbox/linux/Sandbox.cpp
@@ -560,29 +560,40 @@ SandboxEarlyInit(GeckoProcessType aType)
   bool canChroot = false;
   bool canUnshareNet = false;
   bool canUnshareIPC = false;
 
   switch (aType) {
   case GeckoProcessType_Default:
     MOZ_ASSERT(false, "SandboxEarlyInit in parent process");
     return;
+
 #ifdef MOZ_GMP_SANDBOX
   case GeckoProcessType_GMPlugin:
     if (!info.Test(SandboxInfo::kEnabledForMedia)) {
       break;
     }
     canUnshareNet = true;
     canUnshareIPC = true;
     // Need seccomp-bpf to intercept open().
     canChroot = info.Test(SandboxInfo::kHasSeccompBPF);
     break;
 #endif
-    // In the future, content processes will be able to use some of
-    // these.
+
+#ifdef MOZ_CONTENT_SANDBOX
+  case GeckoProcessType_Content:
+    if (!info.Test(SandboxInfo::kEnabledForContent)) {
+      break;
+    }
+#ifndef MOZ_ALSA
+    canUnshareIPC = true;
+#endif
+    break;
+#endif
+
   default:
     // Other cases intentionally left blank.
     break;
   }
 
   // If TSYNC is not supported, set up signal handler
   // used to enable seccomp on each thread.
   if (!info.Test(SandboxInfo::kHasSeccompTSync)) {