mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-02-23 07:27:42 +01:00
Windows: Fix sub-process CreateProcess error due to job object permissions (issue #1092).
git-svn-id: https://chromiumembedded.googlecode.com/svn/branches/1453@1453 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
parent
d96b30f1bd
commit
c384a19748
@ -2,7 +2,7 @@ Index: sandbox_win.cc
|
|||||||
===================================================================
|
===================================================================
|
||||||
--- sandbox_win.cc (revision 202711)
|
--- sandbox_win.cc (revision 202711)
|
||||||
+++ sandbox_win.cc (working copy)
|
+++ sandbox_win.cc (working copy)
|
||||||
@@ -589,8 +589,17 @@
|
@@ -589,8 +589,23 @@
|
||||||
cmd_line->AppendArg(base::StringPrintf("/prefetch:%d", base::Hash(type_str)));
|
cmd_line->AppendArg(base::StringPrintf("/prefetch:%d", base::Hash(type_str)));
|
||||||
|
|
||||||
if (!in_sandbox) {
|
if (!in_sandbox) {
|
||||||
@ -11,7 +11,13 @@ Index: sandbox_win.cc
|
|||||||
- base::LaunchProcess(*cmd_line, base::LaunchOptions(), &process);
|
- base::LaunchProcess(*cmd_line, base::LaunchOptions(), &process);
|
||||||
+
|
+
|
||||||
+ static HANDLE hJobObject = NULL;
|
+ static HANDLE hJobObject = NULL;
|
||||||
+ if (!hJobObject) {
|
+ JOBOBJECT_BASIC_LIMIT_INFORMATION jblinfo = {0};
|
||||||
|
+ // Create an object for child processes only if the current job allows this,
|
||||||
|
+ // otherwise CreateProcess with CREATE_BREAKAWAY_FROM_JOB will fail with 'access denied'.
|
||||||
|
+ bool createObject = !hJobObject &&
|
||||||
|
+ (!::QueryInformationJobObject(NULL, JobObjectBasicLimitInformation, &jblinfo, sizeof(jblinfo), NULL) ||
|
||||||
|
+ (jblinfo.LimitFlags & JOB_OBJECT_LIMIT_BREAKAWAY_OK));
|
||||||
|
+ if (createObject) {
|
||||||
+ hJobObject = CreateJobObject(NULL, NULL);
|
+ hJobObject = CreateJobObject(NULL, NULL);
|
||||||
+ base::SetJobObjectAsKillOnJobClose(hJobObject);
|
+ base::SetJobObjectAsKillOnJobClose(hJobObject);
|
||||||
+ }
|
+ }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user