OLD | NEW |
1 // Copyright 2012 Google Inc. All Rights Reserved. | 1 // Copyright 2012 Google Inc. All Rights Reserved. |
2 // | 2 // |
3 // Licensed under the Apache License, Version 2.0 (the "License"); | 3 // Licensed under the Apache License, Version 2.0 (the "License"); |
4 // you may not use this file except in compliance with the License. | 4 // you may not use this file except in compliance with the License. |
5 // You may obtain a copy of the License at | 5 // You may obtain a copy of the License at |
6 // | 6 // |
7 // http://www.apache.org/licenses/LICENSE-2.0 | 7 // http://www.apache.org/licenses/LICENSE-2.0 |
8 // | 8 // |
9 // Unless required by applicable law or agreed to in writing, software | 9 // Unless required by applicable law or agreed to in writing, software |
10 // distributed under the License is distributed on an "AS IS" BASIS, | 10 // distributed under the License is distributed on an "AS IS" BASIS, |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 DCHECK_NE(static_cast<size_t*>(nullptr), index); | 88 DCHECK_NE(static_cast<size_t*>(nullptr), index); |
89 DCHECK_NE(static_cast<uint8_t*>(nullptr), mask); | 89 DCHECK_NE(static_cast<uint8_t*>(nullptr), mask); |
90 | 90 |
91 size_t i = reinterpret_cast<uintptr_t>(address) / kPageSize; | 91 size_t i = reinterpret_cast<uintptr_t>(address) / kPageSize; |
92 *index = i / 8; | 92 *index = i / 8; |
93 *mask = 1 << (i % 8); | 93 *mask = 1 << (i % 8); |
94 } | 94 } |
95 | 95 |
96 } // namespace | 96 } // namespace |
97 | 97 |
| 98 extern "C" { |
| 99 // Provides a dummy static shadow memory array. This is simply to be used as |
| 100 // a pointer for the probes to be anchored to. If any of the probes referring |
| 101 // to this dummy shadow memory are run they will behave badly until they have |
| 102 // been patched using 'PatchMemoryInterceptorShadowReferences'. |
| 103 uint8_t asan_memory_interceptors_shadow_memory[1] = {}; |
| 104 } |
| 105 |
98 Shadow::Shadow() : own_memory_(false), shadow_(nullptr), length_(0) { | 106 Shadow::Shadow() : own_memory_(false), shadow_(nullptr), length_(0) { |
99 Init(RequiredLength()); | 107 Init(RequiredLength()); |
100 } | 108 } |
101 | 109 |
102 Shadow::Shadow(size_t length) | 110 Shadow::Shadow(size_t length) |
103 : own_memory_(false), shadow_(nullptr), length_(0) { | 111 : own_memory_(false), shadow_(nullptr), length_(0) { |
104 Init(length); | 112 Init(length); |
105 } | 113 } |
106 | 114 |
107 Shadow::Shadow(void* shadow, size_t length) | 115 Shadow::Shadow(void* shadow, size_t length) |
(...skipping 1030 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1138 // Advance the shadow cursor. | 1146 // Advance the shadow cursor. |
1139 ++shadow_cursor_; | 1147 ++shadow_cursor_; |
1140 } // while (shadow_cursor_ < end_of_region) | 1148 } // while (shadow_cursor_ < end_of_region) |
1141 } | 1149 } |
1142 | 1150 |
1143 return false; | 1151 return false; |
1144 } | 1152 } |
1145 | 1153 |
1146 } // namespace asan | 1154 } // namespace asan |
1147 } // namespace agent | 1155 } // namespace agent |
OLD | NEW |