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

Unified Diff: content/common/sandbox_policy.cc

Issue 10081018: Revert 132218 - Convert plugin and GPU process to brokered handle duplication. (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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/common/np_channel_base.h ('k') | content/plugin/plugin_channel.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/common/sandbox_policy.cc
===================================================================
--- content/common/sandbox_policy.cc (revision 132251)
+++ content/common/sandbox_policy.cc (working copy)
@@ -374,34 +374,22 @@
if (result != sandbox::SBOX_ALL_OK)
return false;
- // GPU needs to copy sections to renderers.
- result = policy->AddRule(sandbox::TargetPolicy::SUBSYS_HANDLES,
- sandbox::TargetPolicy::HANDLES_DUP_ANY,
- L"Section");
- if (result != sandbox::SBOX_ALL_OK)
- return false;
-
AddGenericDllEvictionPolicy(policy);
#endif
return true;
}
bool AddPolicyForRenderer(sandbox::TargetPolicy* policy) {
- // Renderers need to copy sections for plugin DIBs and GPU.
+ // Renderers need to copy sections for plugin DIBs.
sandbox::ResultCode result;
result = policy->AddRule(sandbox::TargetPolicy::SUBSYS_HANDLES,
sandbox::TargetPolicy::HANDLES_DUP_ANY,
L"Section");
- if (result != sandbox::SBOX_ALL_OK)
+ if (result != sandbox::SBOX_ALL_OK) {
+ NOTREACHED();
return false;
+ }
- // Renderers need to share events with plugins.
- result = policy->AddRule(sandbox::TargetPolicy::SUBSYS_HANDLES,
- sandbox::TargetPolicy::HANDLES_DUP_ANY,
- L"Event");
- if (result != sandbox::SBOX_ALL_OK)
- return false;
-
policy->SetJobLevel(sandbox::JOB_LOCKDOWN, 0);
sandbox::TokenLevel initial_token = sandbox::USER_UNPROTECTED;
@@ -463,33 +451,30 @@
HANDLE* target_handle,
DWORD desired_access,
DWORD options) {
- // If our process is the target just duplicate the handle.
- if (::GetCurrentProcessId() == target_process_id) {
- return !!::DuplicateHandle(::GetCurrentProcess(), source_handle,
- ::GetCurrentProcess(), target_handle,
- desired_access, FALSE, options);
+ // Just use DuplicateHandle() if we aren't in the sandbox.
+ if (!g_target_services) {
+ base::win::ScopedHandle target_process(::OpenProcess(PROCESS_DUP_HANDLE,
+ FALSE,
+ target_process_id));
+ if (!target_process.IsValid())
+ return false;
- }
+ if (!::DuplicateHandle(::GetCurrentProcess(), source_handle,
+ target_process, target_handle,
+ desired_access, FALSE,
+ options)) {
+ return false;
+ }
- // Try the broker next
- if (g_target_services &&
- g_target_services->DuplicateHandle(source_handle, target_process_id,
- target_handle, desired_access,
- options) == SBOX_ALL_OK) {
return true;
}
- // Finally, see if we already have access to the process.
- base::win::ScopedHandle target_process;
- target_process.Set(::OpenProcess(PROCESS_DUP_HANDLE, FALSE,
- target_process_id));
- if (target_process.IsValid()) {
- return !!::DuplicateHandle(::GetCurrentProcess(), source_handle,
- target_process, target_handle,
- desired_access, FALSE, options);
- }
-
- return false;
+ ResultCode result = g_target_services->DuplicateHandle(source_handle,
+ target_process_id,
+ target_handle,
+ desired_access,
+ options);
+ return SBOX_ALL_OK == result;
}
@@ -588,7 +573,6 @@
policy->Release();
base::ProcessHandle process = 0;
base::LaunchProcess(*cmd_line, base::LaunchOptions(), &process);
- g_broker_services->AddTargetPeer(process);
return process;
}
« no previous file with comments | « content/common/np_channel_base.h ('k') | content/plugin/plugin_channel.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698