| OLD | NEW |
| 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 <set> | 8 #include <set> |
| 9 | 9 |
| 10 #include "sandbox/win/src/interception.h" | 10 #include "sandbox/win/src/interception.h" |
| 11 | 11 |
| 12 #include "base/logging.h" | 12 #include "base/logging.h" |
| 13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 14 #include "base/strings/string16.h" | 14 #include "base/strings/string16.h" |
| 15 #include "base/win/pe_image.h" | 15 #include "base/win/pe_image.h" |
| 16 #include "base/win/windows_version.h" | 16 #include "base/win/windows_version.h" |
| 17 #include "sandbox/win/src/interception_internal.h" | 17 #include "sandbox/win/src/interception_internal.h" |
| 18 #include "sandbox/win/src/interceptors.h" | 18 #include "sandbox/win/src/interceptors.h" |
| 19 #include "sandbox/win/src/sandbox.h" | 19 #include "sandbox/win/src/sandbox.h" |
| 20 #include "sandbox/win/src/service_resolver.h" | 20 #include "sandbox/win/src/service_resolver.h" |
| 21 #include "sandbox/win/src/target_interceptions.h" | 21 #include "sandbox/win/src/target_interceptions.h" |
| 22 #include "sandbox/win/src/target_process.h" | 22 #include "sandbox/win/src/target_process.h" |
| 23 #include "sandbox/win/src/wow64.h" | 23 #include "sandbox/win/src/wow64.h" |
| 24 | 24 |
| 25 namespace { | 25 namespace { |
| 26 | 26 |
| 27 const char kMapViewOfSectionName[] = "NtMapViewOfSection"; | |
| 28 const char kUnmapViewOfSectionName[] = "NtUnmapViewOfSection"; | |
| 29 | |
| 30 // Standard allocation granularity and page size for Windows. | 27 // Standard allocation granularity and page size for Windows. |
| 31 const size_t kAllocGranularity = 65536; | 28 const size_t kAllocGranularity = 65536; |
| 32 const size_t kPageSize = 4096; | 29 const size_t kPageSize = 4096; |
| 33 | 30 |
| 34 // Find a random offset within 64k and aligned to ceil(log2(size)). | 31 // Find a random offset within 64k and aligned to ceil(log2(size)). |
| 35 size_t GetGranularAlignedRandomOffset(size_t size) { | 32 size_t GetGranularAlignedRandomOffset(size_t size) { |
| 36 CHECK_LE(size, kAllocGranularity); | 33 CHECK_LE(size, kAllocGranularity); |
| 37 unsigned int offset; | 34 unsigned int offset; |
| 38 | 35 |
| 39 do { | 36 do { |
| (...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 545 ::FreeLibrary(local_interceptor); | 542 ::FreeLibrary(local_interceptor); |
| 546 #endif | 543 #endif |
| 547 | 544 |
| 548 if (it != interceptions_.end()) | 545 if (it != interceptions_.end()) |
| 549 return false; | 546 return false; |
| 550 | 547 |
| 551 return true; | 548 return true; |
| 552 } | 549 } |
| 553 | 550 |
| 554 } // namespace sandbox | 551 } // namespace sandbox |
| OLD | NEW |