Bug 1430756 - Remove check for unshare(), which we're no longer using. r?gcp draft
authorJed Davis <jld@mozilla.com>
Mon, 22 Jan 2018 14:32:48 -0700
changeset 723365 2e181ee4f077d5f0c40c23e34e041e9421bdff87
parent 723364 c4ebc8c28a33b785dfbfa533810517cc707d1ad0
child 723367 0a048b32a3bc7bc61392671aa9306a69048d7cad
push id96409
push userbmo:jld@mozilla.com
push dateTue, 23 Jan 2018 02:15:52 +0000
reviewersgcp
bugs1430756
milestone60.0a1
Bug 1430756 - Remove check for unshare(), which we're no longer using. r?gcp This also removes an assertion that was failing under external sandboxes that deny unshare() even when it's a no-op. MozReview-Commit-ID: KBEPJyDGU7M
security/sandbox/linux/SandboxInfo.cpp
--- a/security/sandbox/linux/SandboxInfo.cpp
+++ b/security/sandbox/linux/SandboxInfo.cpp
@@ -132,31 +132,16 @@ CanCreateUserNamespace()
   // This is run at static initializer time, while single-threaded, so
   // locking isn't needed to access the environment.
   static const char kCacheEnvName[] = "MOZ_ASSUME_USER_NS";
   const char* cached = getenv(kCacheEnvName);
   if (cached) {
     return cached[0] > '0';
   }
 
-  // Valgrind might allow the clone, but doesn't know what to do with
-  // unshare.  Check for that by unsharing nothing.  (Valgrind will
-  // probably need sandboxing disabled entirely, but no need to break
-  // things worse than strictly necessary.)
-  if (syscall(__NR_unshare, 0) != 0) {
-#ifdef MOZ_VALGRIND
-    MOZ_ASSERT(errno == ENOSYS);
-#else
-    // If something else can cause that call to fail, we's like to know
-    // about it; the right way to handle it might not be the same.
-    MOZ_ASSERT(false);
-#endif
-    return false;
-  }
-
   pid_t pid = syscall(__NR_clone, SIGCHLD | CLONE_NEWUSER,
                       nullptr, nullptr, nullptr, nullptr);
   if (pid == 0) {
     // In the child.  Do as little as possible.
     _exit(0);
   }
   if (pid == -1) {
     // Failure.