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

Side by Side Diff: content/browser/zygote_main_linux.cc

Issue 10165015: Correct process id for sandbox'd trace events. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "content/browser/zygote_host_impl_linux.h" 5 #include "content/browser/zygote_host_impl_linux.h"
6 6
7 #include <dlfcn.h> 7 #include <dlfcn.h>
8 #include <fcntl.h> 8 #include <fcntl.h>
9 #include <pthread.h> 9 #include <pthread.h>
10 #include <stdio.h> 10 #include <stdio.h>
11 #include <sys/socket.h> 11 #include <sys/socket.h>
12 #include <sys/stat.h> 12 #include <sys/stat.h>
13 #include <sys/types.h> 13 #include <sys/types.h>
14 #include <sys/wait.h> 14 #include <sys/wait.h>
15 #include <unistd.h> 15 #include <unistd.h>
16 16
17 #include "base/basictypes.h" 17 #include "base/basictypes.h"
18 #include "base/command_line.h" 18 #include "base/command_line.h"
19 #include "base/debug/trace_event.h"
19 #include "base/eintr_wrapper.h" 20 #include "base/eintr_wrapper.h"
20 #include "base/file_path.h" 21 #include "base/file_path.h"
21 #include "base/file_util.h" 22 #include "base/file_util.h"
22 #include "base/global_descriptors_posix.h" 23 #include "base/global_descriptors_posix.h"
23 #include "base/hash_tables.h" 24 #include "base/hash_tables.h"
24 #include "base/linux_util.h" 25 #include "base/linux_util.h"
25 #include "base/memory/scoped_ptr.h" 26 #include "base/memory/scoped_ptr.h"
26 #include "base/pickle.h" 27 #include "base/pickle.h"
27 #include "base/process_util.h" 28 #include "base/process_util.h"
28 #include "base/rand_util.h" 29 #include "base/rand_util.h"
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 sizeof(real_pid))) { 321 sizeof(real_pid))) {
321 LOG(FATAL) << "Failed to synchronise with parent zygote process"; 322 LOG(FATAL) << "Failed to synchronise with parent zygote process";
322 } 323 }
323 if (real_pid <= 0) { 324 if (real_pid <= 0) {
324 LOG(FATAL) << "Invalid pid from parent zygote"; 325 LOG(FATAL) << "Invalid pid from parent zygote";
325 } 326 }
326 #if defined(OS_LINUX) 327 #if defined(OS_LINUX)
327 // Sandboxed processes need to send the global, non-namespaced PID when 328 // Sandboxed processes need to send the global, non-namespaced PID when
328 // setting up an IPC channel to their parent. 329 // setting up an IPC channel to their parent.
329 IPC::Channel::SetGlobalPid(real_pid); 330 IPC::Channel::SetGlobalPid(real_pid);
331 // Force the real PID so chrome event data have a PID that corresponds
332 // to system trace event data.
333 base::debug::TraceLog::GetInstance()->SetProcessID(
334 static_cast<int>(real_pid));
Markus (顧孟勤) 2012/04/20 21:13:29 You mentioned that this is currently something tha
330 #endif 335 #endif
331 close(pipe_fds[0]); 336 close(pipe_fds[0]);
332 close(dummy_fd); 337 close(dummy_fd);
333 return 0; 338 return 0;
334 } else { 339 } else {
335 // In the parent process. 340 // In the parent process.
336 close(dummy_fd); 341 close(dummy_fd);
337 dummy_fd = -1; 342 dummy_fd = -1;
338 close(pipe_fds[0]); 343 close(pipe_fds[0]);
339 pipe_fds[0] = -1; 344 pipe_fds[0] = -1;
(...skipping 658 matching lines...) Expand 10 before | Expand all | Expand 10 after
998 VLOG(1) << "Enabling experimental Seccomp sandbox."; 1003 VLOG(1) << "Enabling experimental Seccomp sandbox.";
999 sandbox_flags |= ZygoteHostImpl::kSandboxSeccomp; 1004 sandbox_flags |= ZygoteHostImpl::kSandboxSeccomp;
1000 } 1005 }
1001 } 1006 }
1002 #endif // SECCOMP_SANDBOX 1007 #endif // SECCOMP_SANDBOX
1003 1008
1004 Zygote zygote(sandbox_flags, forkdelegate); 1009 Zygote zygote(sandbox_flags, forkdelegate);
1005 // This function call can return multiple times, once per fork(). 1010 // This function call can return multiple times, once per fork().
1006 return zygote.ProcessRequests(); 1011 return zygote.ProcessRequests();
1007 } 1012 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698