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

Side by Side Diff: sandbox/win/src/interception.cc

Issue 1814863004: Cleanup/Remove Windows XP/Vista version checks from Windows sandbox code (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: revert disabled reparse point check Created 4 years, 9 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 | « sandbox/win/src/integrity_level_test.cc ('k') | sandbox/win/src/lpc_policy_test.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 // For information about interceptions as a whole see 5 // For information about interceptions as a whole see
6 // http://dev.chromium.org/developers/design-documents/sandbox . 6 // http://dev.chromium.org/developers/design-documents/sandbox .
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <set> 10 #include <set>
11 11
12 #include "sandbox/win/src/interception.h" 12 #include "sandbox/win/src/interception.h"
13 13
14 #include "base/logging.h" 14 #include "base/logging.h"
15 #include "base/memory/scoped_ptr.h" 15 #include "base/memory/scoped_ptr.h"
16 #include "base/strings/string16.h" 16 #include "base/strings/string16.h"
17 #include "base/win/pe_image.h" 17 #include "base/win/pe_image.h"
18 #include "base/win/windows_version.h" 18 #include "base/win/windows_version.h"
19 #include "sandbox/win/src/interception_internal.h" 19 #include "sandbox/win/src/interception_internal.h"
20 #include "sandbox/win/src/interceptors.h" 20 #include "sandbox/win/src/interceptors.h"
21 #include "sandbox/win/src/sandbox.h" 21 #include "sandbox/win/src/sandbox.h"
22 #include "sandbox/win/src/sandbox_rand.h" 22 #include "sandbox/win/src/sandbox_rand.h"
23 #include "sandbox/win/src/service_resolver.h" 23 #include "sandbox/win/src/service_resolver.h"
24 #include "sandbox/win/src/target_interceptions.h" 24 #include "sandbox/win/src/target_interceptions.h"
25 #include "sandbox/win/src/target_process.h" 25 #include "sandbox/win/src/target_process.h"
26 #include "sandbox/win/src/wow64.h"
27 26
28 namespace sandbox { 27 namespace sandbox {
29 28
30 namespace { 29 namespace {
31 30
32 // Standard allocation granularity and page size for Windows. 31 // Standard allocation granularity and page size for Windows.
33 const size_t kAllocGranularity = 65536; 32 const size_t kAllocGranularity = 65536;
34 const size_t kPageSize = 4096; 33 const size_t kPageSize = 4096;
35 34
36 } // namespace 35 } // namespace
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after
462 // Bypass purify's interception. 461 // Bypass purify's interception.
463 wchar_t* loader_get = reinterpret_cast<wchar_t*>( 462 wchar_t* loader_get = reinterpret_cast<wchar_t*>(
464 ntdll_image.GetProcAddress("LdrGetDllHandle")); 463 ntdll_image.GetProcAddress("LdrGetDllHandle"));
465 if (loader_get) { 464 if (loader_get) {
466 if (!GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | 465 if (!GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS |
467 GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT, 466 GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT,
468 loader_get, &ntdll_base)) 467 loader_get, &ntdll_base))
469 return false; 468 return false;
470 } 469 }
471 470
472 if (base::win::GetVersion() <= base::win::VERSION_VISTA) {
473 Wow64 WowHelper(child_, ntdll_base);
474 if (!WowHelper.WaitForNtdll())
475 return false;
476 }
477
478 char* interceptor_base = NULL; 471 char* interceptor_base = NULL;
479 472
480 #if SANDBOX_EXPORTS 473 #if SANDBOX_EXPORTS
481 interceptor_base = reinterpret_cast<char*>(child_->MainModule()); 474 interceptor_base = reinterpret_cast<char*>(child_->MainModule());
482 HMODULE local_interceptor = ::LoadLibrary(child_->Name()); 475 HMODULE local_interceptor = ::LoadLibrary(child_->Name());
483 #endif 476 #endif
484 477
485 ServiceResolverThunk* thunk; 478 ServiceResolverThunk* thunk;
486 #if defined(_WIN64) 479 #if defined(_WIN64)
487 thunk = new ServiceResolverThunk(child_->Process(), relaxed_); 480 thunk = new ServiceResolverThunk(child_->Process(), relaxed_);
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
551 ::FreeLibrary(local_interceptor); 544 ::FreeLibrary(local_interceptor);
552 #endif 545 #endif
553 546
554 if (it != interceptions_.end()) 547 if (it != interceptions_.end())
555 return false; 548 return false;
556 549
557 return true; 550 return true;
558 } 551 }
559 552
560 } // namespace sandbox 553 } // namespace sandbox
OLDNEW
« no previous file with comments | « sandbox/win/src/integrity_level_test.cc ('k') | sandbox/win/src/lpc_policy_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698