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

Side by Side Diff: content/common/sandbox_linux/sandbox_linux.cc

Issue 2851473005: zygote: Don't CHECK if browser gone during zygote startup (Closed)
Patch Set: Created 3 years, 7 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
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/common/sandbox_linux/sandbox_linux.h" 5 #include "content/common/sandbox_linux/sandbox_linux.h"
6 6
7 #include <dirent.h> 7 #include <dirent.h>
8 #include <fcntl.h> 8 #include <fcntl.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 #include <sys/resource.h> 10 #include <sys/resource.h>
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 103
104 LinuxSandbox::LinuxSandbox() 104 LinuxSandbox::LinuxSandbox()
105 : proc_fd_(-1), 105 : proc_fd_(-1),
106 seccomp_bpf_started_(false), 106 seccomp_bpf_started_(false),
107 sandbox_status_flags_(kSandboxLinuxInvalid), 107 sandbox_status_flags_(kSandboxLinuxInvalid),
108 pre_initialized_(false), 108 pre_initialized_(false),
109 seccomp_bpf_supported_(false), 109 seccomp_bpf_supported_(false),
110 seccomp_bpf_with_tsync_supported_(false), 110 seccomp_bpf_with_tsync_supported_(false),
111 yama_is_enforcing_(false), 111 yama_is_enforcing_(false),
112 initialize_sandbox_ran_(false), 112 initialize_sandbox_ran_(false),
113 exiting_before_initialize_sandbox_(false),
113 setuid_sandbox_client_(sandbox::SetuidSandboxClient::Create()) { 114 setuid_sandbox_client_(sandbox::SetuidSandboxClient::Create()) {
114 if (setuid_sandbox_client_ == NULL) { 115 if (setuid_sandbox_client_ == NULL) {
115 LOG(FATAL) << "Failed to instantiate the setuid sandbox client."; 116 LOG(FATAL) << "Failed to instantiate the setuid sandbox client.";
116 } 117 }
117 #if defined(ANY_OF_AMTLU_SANITIZER) 118 #if defined(ANY_OF_AMTLU_SANITIZER)
118 sanitizer_args_ = base::WrapUnique(new __sanitizer_sandbox_arguments); 119 sanitizer_args_ = base::WrapUnique(new __sanitizer_sandbox_arguments);
119 *sanitizer_args_ = {0}; 120 *sanitizer_args_ = {0};
120 #endif 121 #endif
121 } 122 }
122 123
123 LinuxSandbox::~LinuxSandbox() { 124 LinuxSandbox::~LinuxSandbox() {
124 if (pre_initialized_) { 125 if (pre_initialized_ && !exiting_before_initialize_sandbox_) {
125 CHECK(initialize_sandbox_ran_); 126 CHECK(initialize_sandbox_ran_);
126 } 127 }
127 } 128 }
128 129
129 LinuxSandbox* LinuxSandbox::GetInstance() { 130 LinuxSandbox* LinuxSandbox::GetInstance() {
130 LinuxSandbox* instance = base::Singleton<LinuxSandbox>::get(); 131 LinuxSandbox* instance = base::Singleton<LinuxSandbox>::get();
131 CHECK(instance); 132 CHECK(instance);
132 return instance; 133 return instance;
133 } 134 }
134 135
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
452 453
453 void LinuxSandbox::StopThreadAndEnsureNotCounted(base::Thread* thread) const { 454 void LinuxSandbox::StopThreadAndEnsureNotCounted(base::Thread* thread) const {
454 DCHECK(thread); 455 DCHECK(thread);
455 base::ScopedFD proc_fd(OpenProc(proc_fd_)); 456 base::ScopedFD proc_fd(OpenProc(proc_fd_));
456 PCHECK(proc_fd.is_valid()); 457 PCHECK(proc_fd.is_valid());
457 CHECK( 458 CHECK(
458 sandbox::ThreadHelpers::StopThreadAndWatchProcFS(proc_fd.get(), thread)); 459 sandbox::ThreadHelpers::StopThreadAndWatchProcFS(proc_fd.get(), thread));
459 } 460 }
460 461
461 } // namespace content 462 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698