OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/blacklist/blacklist.h" | 5 #include "chrome_elf/blacklist/blacklist.h" |
6 | 6 |
7 #include <string.h> | 7 #include <string.h> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "chrome_elf/blacklist/blacklist_interceptions.h" | 10 #include "chrome_elf/blacklist/blacklist_interceptions.h" |
(...skipping 11 matching lines...) Expand all Loading... | |
22 const wchar_t* g_troublesome_dlls[kTroublesomeDllsMaxCount] = { | 22 const wchar_t* g_troublesome_dlls[kTroublesomeDllsMaxCount] = { |
23 L"libsvn_tsvn32.dll", | 23 L"libsvn_tsvn32.dll", |
24 // Keep this null pointer here to mark the end of the list. | 24 // Keep this null pointer here to mark the end of the list. |
25 NULL, | 25 NULL, |
26 }; | 26 }; |
27 | 27 |
28 const wchar_t kRegistryBeaconPath[] = L"SOFTWARE\\Google\\Chrome\\BLBeacon"; | 28 const wchar_t kRegistryBeaconPath[] = L"SOFTWARE\\Google\\Chrome\\BLBeacon"; |
29 const wchar_t kBeaconVersion[] = L"version"; | 29 const wchar_t kBeaconVersion[] = L"version"; |
30 const wchar_t kBeaconState[] = L"state"; | 30 const wchar_t kBeaconState[] = L"state"; |
31 | 31 |
32 bool blacklist_patched = false; | |
robertshield
2014/02/06 18:55:23
g_blacklist_patched
csharp
2014/02/06 20:03:58
Done.
| |
33 | |
32 } // namespace blacklist | 34 } // namespace blacklist |
33 | 35 |
34 // Allocate storage for thunks in a page of this module to save on doing | 36 // Allocate storage for thunks in a page of this module to save on doing |
35 // an extra allocation at run time. | 37 // an extra allocation at run time. |
36 #pragma section(".crthunk",read,execute) | 38 #pragma section(".crthunk",read,execute) |
37 __declspec(allocate(".crthunk")) sandbox::ThunkData g_thunk_storage; | 39 __declspec(allocate(".crthunk")) sandbox::ThunkData g_thunk_storage; |
38 | 40 |
39 namespace { | 41 namespace { |
40 | 42 |
41 enum Version { | 43 enum Version { |
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
317 thunk = new sandbox::Wow64W8ResolverThunk(current_process, kRelaxed); | 319 thunk = new sandbox::Wow64W8ResolverThunk(current_process, kRelaxed); |
318 else | 320 else |
319 thunk = new sandbox::Wow64ResolverThunk(current_process, kRelaxed); | 321 thunk = new sandbox::Wow64ResolverThunk(current_process, kRelaxed); |
320 } else if (os_info.version() >= VERSION_WIN8) { | 322 } else if (os_info.version() >= VERSION_WIN8) { |
321 thunk = new sandbox::Win8ResolverThunk(current_process, kRelaxed); | 323 thunk = new sandbox::Win8ResolverThunk(current_process, kRelaxed); |
322 } else { | 324 } else { |
323 thunk = new sandbox::ServiceResolverThunk(current_process, kRelaxed); | 325 thunk = new sandbox::ServiceResolverThunk(current_process, kRelaxed); |
324 } | 326 } |
325 #endif | 327 #endif |
326 | 328 |
329 // Record that we have patched in the blacklist. | |
330 blacklist_patched = true; | |
331 | |
327 BYTE* thunk_storage = reinterpret_cast<BYTE*>(&g_thunk_storage); | 332 BYTE* thunk_storage = reinterpret_cast<BYTE*>(&g_thunk_storage); |
328 | 333 |
329 // Mark the thunk storage as readable and writeable, since we | 334 // Mark the thunk storage as readable and writeable, since we |
330 // ready to write to it. | 335 // ready to write to it. |
331 DWORD old_protect = 0; | 336 DWORD old_protect = 0; |
332 if (!VirtualProtect(&g_thunk_storage, | 337 if (!VirtualProtect(&g_thunk_storage, |
333 sizeof(g_thunk_storage), | 338 sizeof(g_thunk_storage), |
334 PAGE_EXECUTE_READWRITE, | 339 PAGE_EXECUTE_READWRITE, |
335 &old_protect)) | 340 &old_protect)) |
336 return false; | 341 return false; |
(...skipping 15 matching lines...) Expand all Loading... | |
352 // Mark the thunk storage as executable and prevent any future writes to it. | 357 // Mark the thunk storage as executable and prevent any future writes to it. |
353 BOOL page_executable = VirtualProtect(&g_thunk_storage, | 358 BOOL page_executable = VirtualProtect(&g_thunk_storage, |
354 sizeof(g_thunk_storage), | 359 sizeof(g_thunk_storage), |
355 PAGE_EXECUTE_READ, | 360 PAGE_EXECUTE_READ, |
356 &old_protect); | 361 &old_protect); |
357 | 362 |
358 return NT_SUCCESS(ret) && page_executable; | 363 return NT_SUCCESS(ret) && page_executable; |
359 } | 364 } |
360 | 365 |
361 } // namespace blacklist | 366 } // namespace blacklist |
OLD | NEW |