Bug 1436882 - Fix termination signal when clone()ing child processes. r?gcp draft
authorJed Davis <jld@mozilla.com>
Thu, 08 Feb 2018 17:30:03 -0700
changeset 752800 449d7e86e51fee141285cc17c5b4fd25f42eb990
parent 752350 8cc2427a322caa1e2c09ca3957335f88e573dc7a
push id98397
push userbmo:jld@mozilla.com
push dateFri, 09 Feb 2018 00:37:26 +0000
reviewersgcp
bugs1436882, 1401062
milestone60.0a1
Bug 1436882 - Fix termination signal when clone()ing child processes. r?gcp This fixes a mistake in bug 1401062: the termination signal was omitted, so it's 0, and if it isn't exactly SIGCHLD, then a tracer/debugger will receive PTRACE_EVENT_CLONE rather than PTRACE_EVENT_FORK. This causes GDB to see the child process as a thread instead of a separate process, and it becomes very confused after the process calls execve(). MozReview-Commit-ID: Baf2RFHVWRU
security/sandbox/linux/launch/SandboxLaunch.cpp
--- a/security/sandbox/linux/launch/SandboxLaunch.cpp
+++ b/security/sandbox/linux/launch/SandboxLaunch.cpp
@@ -385,17 +385,17 @@ ForkWithFlags(int aFlags)
   // require clone() arguments we're not passing:
   static const int kBadFlags = CLONE_VM | CLONE_VFORK | CLONE_SETTLS
     | CLONE_PARENT_SETTID | CLONE_CHILD_SETTID | CLONE_CHILD_CLEARTID;
   MOZ_RELEASE_ASSERT((aFlags & kBadFlags) == 0);
 
   jmp_buf ctx;
   if (setjmp(ctx) == 0) {
     // In the parent and just called setjmp:
-    return DoClone(aFlags, &ctx);
+    return DoClone(aFlags | SIGCHLD, &ctx);
   }
   // In the child and have longjmp'ed:
   return 0;
 }
 
 static bool
 WriteStringToFile(const char* aPath, const char* aStr, const size_t aLen)
 {