Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(213)

Side by Side Diff: chrome/browser/zygote_host_linux.cc

Issue 159124: linux: add command-line flag to allow debugging of sandboxed processes (Closed)
Patch Set: merge Created 11 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/zygote_main_linux.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/zygote_host_linux.h" 5 #include "chrome/browser/zygote_host_linux.h"
6 6
7 #include <unistd.h> 7 #include <unistd.h>
8 #include <sys/types.h> 8 #include <sys/types.h>
9 #include <sys/socket.h> 9 #include <sys/socket.h>
10 #include <sys/stat.h> 10 #include <sys/stat.h>
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 CHECK(socketpair(PF_UNIX, SOCK_SEQPACKET, 0, fds) == 0); 57 CHECK(socketpair(PF_UNIX, SOCK_SEQPACKET, 0, fds) == 0);
58 base::file_handle_mapping_vector fds_to_map; 58 base::file_handle_mapping_vector fds_to_map;
59 fds_to_map.push_back(std::make_pair(fds[1], 3)); 59 fds_to_map.push_back(std::make_pair(fds[1], 3));
60 60
61 const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess(); 61 const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess();
62 if (browser_command_line.HasSwitch(switches::kZygoteCmdPrefix)) { 62 if (browser_command_line.HasSwitch(switches::kZygoteCmdPrefix)) {
63 const std::wstring prefix = 63 const std::wstring prefix =
64 browser_command_line.GetSwitchValue(switches::kZygoteCmdPrefix); 64 browser_command_line.GetSwitchValue(switches::kZygoteCmdPrefix);
65 cmd_line.PrependWrapper(prefix); 65 cmd_line.PrependWrapper(prefix);
66 } 66 }
67 if (browser_command_line.HasSwitch(switches::kAllowSandboxDebugging)) {
68 cmd_line.AppendSwitch(switches::kAllowSandboxDebugging);
69 }
67 70
68 const char* sandbox_binary = NULL; 71 const char* sandbox_binary = NULL;
69 struct stat st; 72 struct stat st;
70 73
71 // In Chromium branded builds, developers can set an environment variable to 74 // In Chromium branded builds, developers can set an environment variable to
72 // use the development sandbox. See 75 // use the development sandbox. See
73 // http://code.google.com/p/chromium/wiki/LinuxSUIDSandboxDevelopment 76 // http://code.google.com/p/chromium/wiki/LinuxSUIDSandboxDevelopment
74 if (stat("/proc/self/exe", &st) == 0 && 77 if (stat("/proc/self/exe", &st) == 0 &&
75 st.st_uid == getuid()) { 78 st.st_uid == getuid()) {
76 sandbox_binary = getenv("CHROME_DEVEL_SANDBOX"); 79 sandbox_binary = getenv("CHROME_DEVEL_SANDBOX");
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 !read_pickle.ReadBool(&iter, &tmp_child_exited)) { 182 !read_pickle.ReadBool(&iter, &tmp_child_exited)) {
180 LOG(WARNING) << "Error parsing DidProcessCrash response from zygote."; 183 LOG(WARNING) << "Error parsing DidProcessCrash response from zygote.";
181 return false; 184 return false;
182 } 185 }
183 186
184 if (child_exited) 187 if (child_exited)
185 *child_exited = tmp_child_exited; 188 *child_exited = tmp_child_exited;
186 189
187 return did_crash; 190 return did_crash;
188 } 191 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/zygote_main_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698