Bug 1041775 Part 3: Re-apply pre-vista stdout/err process inheritance change to Chromium code after merge. r=tabraldes
☠☠ backed out by a500a8bf99f9 ☠ ☠
authorBob Owen <bobowencode@gmail.com>
Tue, 18 Nov 2014 15:11:47 +0000
changeset 216620 ebe866ff8a445ddd36b471621ced3ee8015706a2
parent 216619 ec63befb3ad7c4e06568fa5ab98c7a1239d14909
child 216621 586cdaf7dd204d5b61d10a0b7353ab61b48cbb07
push idunknown
push userunknown
push dateunknown
reviewerstabraldes
bugs1041775
milestone36.0a1
Bug 1041775 Part 3: Re-apply pre-vista stdout/err process inheritance change to Chromium code after merge. r=tabraldes Originally landed as changsets: https://hg.mozilla.org/mozilla-central/rev/f94a07671389
security/sandbox/modifications-to-chromium-to-reapply-after-upstream-merge.txt
security/sandbox/win/src/broker_services.cc
--- a/security/sandbox/modifications-to-chromium-to-reapply-after-upstream-merge.txt
+++ b/security/sandbox/modifications-to-chromium-to-reapply-after-upstream-merge.txt
@@ -1,5 +1,5 @@
 Please add a link to the bugzilla bug and patch name that should be re-applied.
 Also, please update any existing links to their actual mozilla-central changeset.
 
-https://hg.mozilla.org/mozilla-central/rev/f94a07671389
 https://bugzilla.mozilla.org/show_bug.cgi?id=1041775 bug1041775part2.patch
+https://bugzilla.mozilla.org/show_bug.cgi?id=1041775 bug1041775part3.patch
--- a/security/sandbox/win/src/broker_services.cc
+++ b/security/sandbox/win/src/broker_services.cc
@@ -440,16 +440,24 @@ ResultCode BrokerServicesBase::SpawnTarg
       startup_info.startup_info()->dwFlags |= STARTF_USESTDHANDLES;
       startup_info.startup_info()->hStdInput = INVALID_HANDLE_VALUE;
       startup_info.startup_info()->hStdOutput = stdout_handle;
       startup_info.startup_info()->hStdError = stderr_handle;
       // Allowing inheritance of handles is only secure now that we
       // have limited which handles will be inherited.
       inherit_handles = true;
     }
+  } else if (getenv("MOZ_WIN_INHERIT_STD_HANDLES_PRE_VISTA")) {
+    // On pre-Vista versions even if we can't limit what gets inherited, we
+    // sometimes want to inherit stdout/err for testing purposes.
+    startup_info.startup_info()->dwFlags |= STARTF_USESTDHANDLES;
+    startup_info.startup_info()->hStdInput = INVALID_HANDLE_VALUE;
+    startup_info.startup_info()->hStdOutput = policy_base->GetStdoutHandle();
+    startup_info.startup_info()->hStdError = policy_base->GetStderrHandle();
+    inherit_handles = true;
   }
 
   // Construct the thread pool here in case it is expensive.
   // The thread pool is shared by all the targets
   if (NULL == thread_pool_)
     thread_pool_ = new Win2kThreadPool();
 
   // Create the TargetProces object and spawn the target suspended. Note that