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

Unified Diff: content/common/sandbox_win.cc

Issue 1856993003: Implement sandbox hooks to forward OPM related GDI system calls. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Replaced shared memory implementation. Created 4 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: content/common/sandbox_win.cc
diff --git a/content/common/sandbox_win.cc b/content/common/sandbox_win.cc
index fe266227ad899e66d818b19bc4c2aa97975a0838..a181d13e99abd0b3a9039d6bacf1a7574f3cd51b 100644
--- a/content/common/sandbox_win.cc
+++ b/content/common/sandbox_win.cc
@@ -590,7 +590,7 @@ void AddAppContainerPolicy(sandbox::TargetPolicy* policy, const wchar_t* sid) {
policy->SetLowBox(sid);
}
-bool AddWin32kLockdownPolicy(sandbox::TargetPolicy* policy) {
+bool AddWin32kLockdownPolicy(sandbox::TargetPolicy* policy, bool enable_opm) {
#if !defined(NACL_WIN64)
if (!IsWin32kRendererLockdownEnabled())
return true;
@@ -603,10 +603,13 @@ bool AddWin32kLockdownPolicy(sandbox::TargetPolicy* policy) {
sandbox::ResultCode result =
policy->AddRule(sandbox::TargetPolicy::SUBSYS_WIN32K_LOCKDOWN,
- sandbox::TargetPolicy::FAKE_USER_GDI_INIT, nullptr);
+ enable_opm ? sandbox::TargetPolicy::IMPLEMENT_OPM_APIS
+ : sandbox::TargetPolicy::FAKE_USER_GDI_INIT,
+ nullptr);
if (result != sandbox::SBOX_ALL_OK)
return false;
-
+ if (enable_opm)
+ policy->SetEnableOPMRedirection();
flags |= sandbox::MITIGATION_WIN32K_DISABLE;
result = policy->SetProcessMitigations(flags);
if (result != sandbox::SBOX_ALL_OK)
@@ -726,7 +729,7 @@ base::Process StartSandboxedProcess(
#if !defined(NACL_WIN64)
if (type_str == switches::kRendererProcess &&
IsWin32kRendererLockdownEnabled()) {
- if (!AddWin32kLockdownPolicy(policy))
+ if (!AddWin32kLockdownPolicy(policy, false))
return base::Process();
}
#endif

Powered by Google App Engine
This is Rietveld 408576698