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

Unified Diff: content/common/sandbox_linux.h

Issue 13814027: Linux: make current InitializeSandbox() private. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/common/sandbox_init_linux.cc ('k') | content/common/sandbox_linux.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/common/sandbox_linux.h
diff --git a/content/common/sandbox_linux.h b/content/common/sandbox_linux.h
index 3df65ea27a4d5d64bbbaac11c18ad1a074f19fd9..ab3df496b2f9c514f6388553af5cad737a75e759 100644
--- a/content/common/sandbox_linux.h
+++ b/content/common/sandbox_linux.h
@@ -33,6 +33,17 @@ class LinuxSandbox {
METHOD_MATCH_WITH_FALLBACK = 37,
};
+ // A list of sandbox configuration for content's process types.
+ enum SandboxConfig {
+ SANDBOX_CONFIG_INVALID = 0,
+ SANDBOX_CONFIG_GENERIC, // Exact sandbox unspecified, useful for pre-init.
+ SANDBOX_CONFIG_RENDERER,
+ SANDBOX_CONFIG_WORKER,
+ SANDBOX_CONFIG_GPU,
+ SANDBOX_CONFIG_PPAPI,
+ SANDBOX_CONFIG_UTILITY,
+ };
+
// Get our singleton instance.
static LinuxSandbox* GetInstance();
@@ -47,14 +58,22 @@ class LinuxSandbox {
// called for every child process.
// TODO(markus, jln) we know this is not always done at the moment
// (crbug.com/139877).
- void PreinitializeSandbox(const std::string& process_type);
+ // These functions can accept SANDBOX_CONFIG_GENERIC as a parameter if the
+ // full type of the sandbox isn't known yet.
+ void PreinitializeSandbox(LinuxSandbox::SandboxConfig sandbox_config);
// These should be called together.
void PreinitializeSandboxBegin();
- void PreinitializeSandboxFinish(const std::string& process_type);
+ void PreinitializeSandboxFinish(LinuxSandbox::SandboxConfig sandbox_config);
+
+ // Initialize the sandbox with the given pre-built configuration. Currently
+ // seccomp-legacy, seccomp-bpf, address space limitations (the setuid sandbox
+ // works differently and is set-up in the Zygote). This will instanciate the
Markus (顧孟勤) 2013/04/10 23:39:50 s/instanciate/instantiate/
+ // LinuxSandbox singleton if it doesn't already exist.
+ static bool InitializeSandbox(LinuxSandbox::SandboxConfig sandbox_config);
- // Returns the Status of the sandbox. Can only be queried if we went through
- // PreinitializeSandbox() or PreinitializeSandboxBegin(). This is a bitmask
- // and uses the constants defined in "enum LinuxSandboxStatus".
+ // Returns the Status of the renderers' sandbox. Can only be queried if we
+ // went through PreinitializeSandbox() or PreinitializeSandboxBegin(). This
+ // is a bitmask and uses the constants defined in "enum LinuxSandboxStatus".
// Since we need to provide the status before the sandboxes are actually
// started, this returns what will actually happen once the various Start*
// functions are called from inside a renderer.
@@ -71,15 +90,15 @@ class LinuxSandbox {
sandbox::SetuidSandboxClient* setuid_sandbox_client() const;
// Check the policy and eventually start the seccomp-legacy sandbox.
- bool StartSeccompLegacy(const std::string& process_type);
+ bool StartSeccompLegacy(LinuxSandbox::SandboxConfig sandbox_config);
// Check the policy and eventually start the seccomp-bpf sandbox. This should
// never be called with threads started. If we detect that thread have
// started we will crash.
- bool StartSeccompBpf(const std::string& process_type);
+ bool StartSeccompBpf(LinuxSandbox::SandboxConfig sandbox_config);
// Limit the address space of the current process (and its children).
// to make some vulnerabilities harder to exploit.
- bool LimitAddressSpace(const std::string& process_type);
+ bool LimitAddressSpace(LinuxSandbox::SandboxConfig sandbox_config);
private:
friend struct DefaultSingletonTraits<LinuxSandbox>;
« no previous file with comments | « content/common/sandbox_init_linux.cc ('k') | content/common/sandbox_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698