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

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

Issue 10836118: Clean up GPU process seccomp-bpf sandbox policies. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Final agreement with jln re: policies. Created 8 years, 4 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 <string> 5 #include <string>
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "content/common/sandbox_linux.h" 9 #include "content/common/sandbox_linux.h"
10 #include "content/public/common/content_switches.h" 10 #include "content/public/common/content_switches.h"
11 #include "content/public/common/sandbox_init.h" 11 #include "content/public/common/sandbox_init.h"
12 12
13 namespace content { 13 namespace content {
14 14
15 // TODO(jln): have call sites provide a process / policy type to 15 // TODO(jln): have call sites provide a process / policy type to
16 // InitializeSandbox(). 16 // InitializeSandbox().
17 void InitializeSandbox() { 17 void InitializeSandbox() {
18 bool seccomp_legacy_started = false; 18 bool seccomp_legacy_started = false;
19 LinuxSandbox* linux_sandbox = LinuxSandbox::GetInstance(); 19 LinuxSandbox* linux_sandbox = LinuxSandbox::GetInstance();
20 const std::string process_type = 20 const std::string process_type =
21 CommandLine::ForCurrentProcess()->GetSwitchValueASCII( 21 CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
22 switches::kProcessType); 22 switches::kProcessType);
23 23
24
25 // No matter what, it's always an error to call InitializeSandbox() after 24 // No matter what, it's always an error to call InitializeSandbox() after
26 // threads have been created. 25 // threads have been created.
27 if (!linux_sandbox->IsSingleThreaded()) { 26 if (!linux_sandbox->IsSingleThreaded()) {
28 std::string error_message = "InitializeSandbox() called with multiple " 27 std::string error_message = "InitializeSandbox() called with multiple "
29 "threads in process " + process_type; 28 "threads in process " + process_type;
30 // TODO(jln): change this into a CHECK() once we are more comfortable it 29 // TODO(jln): change this into a CHECK() once we are more comfortable it
31 // does not trigger. 30 // does not trigger.
32 LOG(ERROR) << error_message; 31 LOG(ERROR) << error_message;
33 return; 32 return;
34 } 33 }
35 34
36 // First, try to enable seccomp-legacy. 35 // First, try to enable seccomp-legacy.
37 seccomp_legacy_started = linux_sandbox->StartSeccompLegacy(process_type); 36 seccomp_legacy_started = linux_sandbox->StartSeccompLegacy(process_type);
38 37
39 // Then, try to enable seccomp-bpf. 38 // Then, try to enable seccomp-bpf.
40 // If seccomp-legacy is enabled, seccomp-bpf initialization will crash 39 // If seccomp-legacy is enabled, seccomp-bpf initialization will crash
41 // instead of failing gracefully. 40 // instead of failing gracefully.
42 // TODO(markus): fix this (crbug.com/139872). 41 // TODO(markus): fix this (crbug.com/139872).
43 if (!seccomp_legacy_started) { 42 if (!seccomp_legacy_started) {
44 linux_sandbox->StartSeccompBpf(process_type); 43 linux_sandbox->StartSeccompBpf(process_type);
45 } 44 }
46 } 45 }
47 46
48 } // namespace content 47 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/common/sandbox_seccomp_bpf_linux.cc » ('j') | content/common/sandbox_seccomp_bpf_linux.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698