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

Unified Diff: chrome_elf/chrome_elf_util.cc

Issue 1656453002: [Chrome ELF] Early browser security support. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Code review changes, part 1. Created 4 years, 11 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 | « chrome_elf/chrome_elf_util.h ('k') | chrome_elf/chrome_elf_util_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome_elf/chrome_elf_util.cc
diff --git a/chrome_elf/chrome_elf_util.cc b/chrome_elf/chrome_elf_util.cc
index a3fd727e9d2ebdf54d795bf3bd3b76e0d97bca86..8264c35076b5a1c0c5db6ead99a7c90bc6de3faf 100644
--- a/chrome_elf/chrome_elf_util.cc
+++ b/chrome_elf/chrome_elf_util.cc
@@ -5,8 +5,9 @@
#include "chrome_elf/chrome_elf_util.h"
#include <assert.h>
-#include <windows.h>
#include <stddef.h>
+#include <windows.h>
+#include <versionhelpers.h> // windows.h must be before.
#include "base/macros.h"
#include "base/strings/string16.h"
@@ -222,3 +223,26 @@ bool IsNonBrowserProcess() {
assert(g_process_type != ProcessType::UNINITIALIZED);
return g_process_type == ProcessType::NON_BROWSER_PROCESS;
}
+
+typedef decltype(SetProcessMitigationPolicy)* SetProcessMitigationPolicyFunc;
+
+void EarlyBrowserSecurity() {
+ // This function is called from within DllMain.
+ // Don't do anything naughty while we have the loader lock.
+ if (::IsWindows8OrGreater()) {
+ SetProcessMitigationPolicyFunc set_process_mitigation_policy =
+ reinterpret_cast<SetProcessMitigationPolicyFunc>(::GetProcAddress(
+ ::GetModuleHandleW(L"kernel32.dll"), "SetProcessMitigationPolicy"));
+ if (set_process_mitigation_policy) {
+ // Disable extension DLLs in this process.
+ // (Legacy hooking.)
+ PROCESS_MITIGATION_EXTENSION_POINT_DISABLE_POLICY policy = {};
+ policy.DisableExtensionPoints = true;
+
+ if (!set_process_mitigation_policy(ProcessExtensionPointDisablePolicy,
+ &policy, sizeof(policy)))
robertshield 2016/02/01 22:40:50 It would be nice to UMA this. Two ways come to m
+ __debugbreak();
+ }
+ }
+ return;
+}
« no previous file with comments | « chrome_elf/chrome_elf_util.h ('k') | chrome_elf/chrome_elf_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698