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

Unified Diff: chrome/common/sandbox_policy.cc

Issue 6930059: Make Pepper work out-of-process in the windows sandbox (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 9 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
Index: chrome/common/sandbox_policy.cc
===================================================================
--- chrome/common/sandbox_policy.cc (revision 83426)
+++ chrome/common/sandbox_policy.cc (working copy)
@@ -531,8 +531,7 @@
return true;
}
-void AddPolicyForRenderer(sandbox::TargetPolicy* policy,
- bool* on_sandbox_desktop) {
+void AddPolicyForRenderer(sandbox::TargetPolicy* policy) {
policy->SetJobLevel(sandbox::JOB_LOCKDOWN, 0);
sandbox::TokenLevel initial_token = sandbox::USER_UNPROTECTED;
@@ -548,16 +547,28 @@
bool use_winsta = !CommandLine::ForCurrentProcess()->HasSwitch(
switches::kDisableAltWinstation);
- if (sandbox::SBOX_ALL_OK == policy->SetAlternateDesktop(use_winsta)) {
- *on_sandbox_desktop = true;
- } else {
- *on_sandbox_desktop = false;
+ if (sandbox::SBOX_ALL_OK != policy->SetAlternateDesktop(use_winsta)) {
DLOG(WARNING) << "Failed to apply desktop security to the renderer";
}
AddDllEvictionPolicy(policy);
}
+// The Pepper process as locked-down as a renderer execpt that it can
+// create the server side of chrome pipes.
+bool AddPolicyForPepperPlugin(sandbox::TargetPolicy* policy) {
+ sandbox::ResultCode result;
+ result = policy->AddRule(sandbox::TargetPolicy::SUBSYS_NAMED_PIPES,
+ sandbox::TargetPolicy::NAMEDPIPES_ALLOW_ANY,
+ L"\\\\.\\pipe\\chrome.*");
+ if (result != sandbox::SBOX_ALL_OK) {
+ NOTREACHED();
+ return false;
+ }
+ AddPolicyForRenderer(policy);
+ return true;
+}
+
} // namespace
namespace sandbox {
@@ -670,15 +681,17 @@
PROCESS_INFORMATION target = {0};
sandbox::TargetPolicy* policy = g_broker_services->CreatePolicy();
- bool on_sandbox_desktop = false;
if (type == ChildProcessInfo::PLUGIN_PROCESS) {
if (!AddPolicyForPlugin(cmd_line, policy))
return 0;
} else if (type == ChildProcessInfo::GPU_PROCESS) {
if (!AddPolicyForGPU(cmd_line, policy))
return 0;
+ } else if (type == ChildProcessInfo::PPAPI_PLUGIN_PROCESS) {
+ if (!AddPolicyForPepperPlugin(policy))
+ return 0;
} else {
- AddPolicyForRenderer(policy, &on_sandbox_desktop);
+ AddPolicyForRenderer(policy);
if (type_str != switches::kRendererProcess) {
// Hack for Google Desktop crash. Trick GD into not injecting its DLL into
« no previous file with comments | « no previous file | content/browser/ppapi_plugin_process_host.cc » ('j') | content/ppapi_plugin/ppapi_plugin_main.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698