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

Side by Side 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, 10 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome_elf/chrome_elf_util.h" 5 #include "chrome_elf/chrome_elf_util.h"
6 6
7 #include <assert.h> 7 #include <assert.h>
8 #include <stddef.h>
8 #include <windows.h> 9 #include <windows.h>
9 #include <stddef.h> 10 #include <versionhelpers.h> // windows.h must be before.
10 11
11 #include "base/macros.h" 12 #include "base/macros.h"
12 #include "base/strings/string16.h" 13 #include "base/strings/string16.h"
13 14
14 ProcessType g_process_type = ProcessType::UNINITIALIZED; 15 ProcessType g_process_type = ProcessType::UNINITIALIZED;
15 16
16 namespace { 17 namespace {
17 18
18 const wchar_t kRegPathClientState[] = L"Software\\Google\\Update\\ClientState"; 19 const wchar_t kRegPathClientState[] = L"Software\\Google\\Update\\ClientState";
19 const wchar_t kRegPathClientStateMedium[] = 20 const wchar_t kRegPathClientStateMedium[] =
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 return; 216 return;
216 } 217 }
217 218
218 g_process_type = ProcessType::BROWSER_PROCESS; 219 g_process_type = ProcessType::BROWSER_PROCESS;
219 } 220 }
220 221
221 bool IsNonBrowserProcess() { 222 bool IsNonBrowserProcess() {
222 assert(g_process_type != ProcessType::UNINITIALIZED); 223 assert(g_process_type != ProcessType::UNINITIALIZED);
223 return g_process_type == ProcessType::NON_BROWSER_PROCESS; 224 return g_process_type == ProcessType::NON_BROWSER_PROCESS;
224 } 225 }
226
227 typedef decltype(SetProcessMitigationPolicy)* SetProcessMitigationPolicyFunc;
228
229 void EarlyBrowserSecurity() {
230 // This function is called from within DllMain.
231 // Don't do anything naughty while we have the loader lock.
232 if (::IsWindows8OrGreater()) {
233 SetProcessMitigationPolicyFunc set_process_mitigation_policy =
234 reinterpret_cast<SetProcessMitigationPolicyFunc>(::GetProcAddress(
235 ::GetModuleHandleW(L"kernel32.dll"), "SetProcessMitigationPolicy"));
236 if (set_process_mitigation_policy) {
237 // Disable extension DLLs in this process.
238 // (Legacy hooking.)
239 PROCESS_MITIGATION_EXTENSION_POINT_DISABLE_POLICY policy = {};
240 policy.DisableExtensionPoints = true;
241
242 if (!set_process_mitigation_policy(ProcessExtensionPointDisablePolicy,
243 &policy, sizeof(policy)))
robertshield 2016/02/01 22:40:50 It would be nice to UMA this. Two ways come to m
244 __debugbreak();
245 }
246 }
247 return;
248 }
OLDNEW
« 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