Index: /trunk/src/VBox/Runtime/r3/init.cpp
===================================================================
--- /trunk/src/VBox/Runtime/r3/init.cpp	(revision 23868)
+++ /trunk/src/VBox/Runtime/r3/init.cpp	(revision 23869)
@@ -42,4 +42,7 @@
 # ifndef RT_OS_OS2
 #  include <pthread.h>
+#  include <signal.h>
+#  include <errno.h>
+#  define IPRT_USE_SIG_CHILD_DUMMY
 # endif
 #endif
@@ -204,4 +207,19 @@
 }
 
+
+#ifdef IPRT_USE_SIG_CHILD_DUMMY
+/**
+ * Dummy SIGCHILD handler.
+ *
+ * Assigned on rtR3Init only when SIGCHILD handler is set SIGIGN or SIGDEF to
+ * ensure waitpid works properly for the terminated processes.
+ */
+static void rtR3SigChildHandler(int iSignal)
+{
+    NOREF(iSignal);
+}
+#endif /* IPRT_USE_SIG_CHILD_DUMMY */
+
+
 /**
  * rtR3Init worker.
@@ -296,4 +314,39 @@
     atexit(rtR3ExitCallback);
 
+#ifdef IPRT_USE_SIG_CHILD_DUMMY
+    /*
+     * SIGCHLD must not be ignored (that's default), otherwise posix compliant waitpid
+     * implementations won't work right.
+     */
+    for (;;)
+    {
+        struct sigaction saOld;
+        rc = sigaction(SIGCHLD, 0, &saOld);         AssertMsg(rc == 0, ("%d/%d\n", rc, errno));
+        if (    rc != 0
+            ||  (saOld.sa_flags & SA_SIGINFO)
+            || (   saOld.sa_handler != SIG_IGN
+                && saOld.sa_handler != SIG_DFL)
+           )
+            break;
+
+        /* Try install dummy handler. */
+        struct sigaction saNew = saOld;
+        saNew.sa_flags   = SA_NOCLDSTOP | SA_RESTART;
+        saNew.sa_handler = rtR3SigChildHandler;
+        rc = sigemptyset(&saNew.sa_mask);           AssertMsg(rc == 0, ("%d/%d\n", rc, errno));
+        struct sigaction saOld2;
+        rc = sigaction(SIGCHLD, &saNew, &saOld2);   AssertMsg(rc == 0, ("%d/%d\n", rc, errno));
+        if (    rc != 0
+            ||  (   saOld2.sa_handler == saOld.sa_handler
+                 && saOld2.sa_flags == saOld.sa_flags)
+           )
+            break;
+
+        /* Race during dynamic load, restore and try again... */
+        sigaction(SIGCHLD, &saOld2, NULL);
+        RTThreadYield();
+    }
+#endif /* IPRT_USE_SIG_CHILD_DUMMY */
+
 #ifdef IPRT_WITH_ALIGNMENT_CHECKS
     /*
Index: /trunk/src/VBox/Runtime/r3/posix/process-posix.cpp
===================================================================
--- /trunk/src/VBox/Runtime/r3/posix/process-posix.cpp	(revision 23868)
+++ /trunk/src/VBox/Runtime/r3/posix/process-posix.cpp	(revision 23869)
@@ -110,4 +110,9 @@
     /*
      * Spawn the child.
+     *
+     * HACK ALERT! Put the process into a new process group with pgid = pid
+     * to make sure it differs from that of the parent process to ensure that
+     * the IPRT waipit call doesn't race anyone (read XPCOM) doing group wide
+     * waits.
      */
     pid_t pid;
@@ -115,12 +120,33 @@
     if (!(fFlags & RTPROC_FLAGS_DAEMONIZE))
     {
-        /** @todo check if it requires any of those two attributes, don't remember atm. */
-        rc = posix_spawn(&pid, pszExec, NULL, NULL, (char * const *)papszArgs,
-                         (char * const *)papszEnv);
+        posix_spawnattr_t Attr;
+
+        rc = posix_spawnattr_init(&Attr);
         if (!rc)
         {
-            if (pProcess)
-                *pProcess = pid;
-            return VINF_SUCCESS;
+# ifndef RT_OS_OS2 /* We don't need this on OS/2 and I don't recall if it's actually implemented. */
+            rc = posix_spawnattr_setflags(&Attr, POSIX_SPAWN_SETPGROUP);
+            Assert(rc == 0);
+            if (!rc)
+            {
+                rc = posix_spawnattr_setpgroup(&Attr, 0 /* pg == child pid */);
+                Assert(rc == 0);
+            }
+# endif
+            if (!rc)
+            {
+                /** @todo check if it requires any mandatory attributes or something, don't
+                 *        remember atm. */
+                rc = posix_spawn(&pid, pszExec, NULL, &Attr, (char * const *)papszArgs,
+                                 (char * const *)papszEnv);
+                if (!rc)
+                {
+                    int rc2 = posix_spawnattr_destroy(&Attr); Assert(rc2 == 0); NOREF(rc2);
+                    if (pProcess)
+                        *pProcess = pid;
+                    return VINF_SUCCESS;
+                }
+            }
+            int rc2 = posix_spawnattr_destroy(&Attr); Assert(rc2 == 0); NOREF(rc2);
         }
     }
@@ -131,4 +157,6 @@
         if (!pid)
         {
+            setpgid(0, 0); /* see comment above */
+
             if (fFlags & RTPROC_FLAGS_DAEMONIZE)
             {
Index: /trunk/src/libs/xpcom18a4/nsprpub/pr/src/md/unix/uxproces.c
===================================================================
--- /trunk/src/libs/xpcom18a4/nsprpub/pr/src/md/unix/uxproces.c	(revision 23868)
+++ /trunk/src/libs/xpcom18a4/nsprpub/pr/src/md/unix/uxproces.c	(revision 23869)
@@ -674,5 +674,13 @@
 	while (1) {
 	    do {
+#ifdef VBOX
+	        /*
+	         * make sure we wait only for child of our group
+	         * to ensure we do not interfere with RT
+	         */
+	        pid = waitpid((pid_t) 0, &status, 0);
+#else
 	        pid = waitpid((pid_t) -1, &status, 0);
+#endif
 	    } while ((pid_t) -1 == pid && EINTR == errno);
 
@@ -764,5 +772,13 @@
 	while (1) {
 	    do {
+#ifdef VBOX
+	        /*
+	         * make sure we wait only for child of our group
+	         * to ensure we do not interfere with RT
+	         */
+	        pid = waitpid((pid_t) 0, &status, WNOHANG);
+#else
 	        pid = waitpid((pid_t) -1, &status, WNOHANG);
+#endif
 	    } while ((pid_t) -1 == pid && EINTR == errno);
 	    if (0 == pid) break;
