OLD | NEW |
1 // Copyright 2014 Google Inc. All Rights Reserved. | 1 // Copyright 2014 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 25 matching lines...) Expand all Loading... |
36 | 36 |
37 } // namespace | 37 } // namespace |
38 | 38 |
39 Shadow* SetMemoryInterceptorShadow(Shadow* shadow) { | 39 Shadow* SetMemoryInterceptorShadow(Shadow* shadow) { |
40 Shadow* old_shadow = memory_interceptor_shadow_; | 40 Shadow* old_shadow = memory_interceptor_shadow_; |
41 memory_interceptor_shadow_ = shadow; | 41 memory_interceptor_shadow_ = shadow; |
42 return old_shadow; | 42 return old_shadow; |
43 } | 43 } |
44 | 44 |
45 const MemoryAccessorVariants kMemoryAccessorVariants[] = { | 45 const MemoryAccessorVariants kMemoryAccessorVariants[] = { |
| 46 #ifndef _WIN64 |
46 #define ENUM_MEM_INTERCEPT_FUNCTION_VARIANTS(access_size, access_mode_str, \ | 47 #define ENUM_MEM_INTERCEPT_FUNCTION_VARIANTS(access_size, access_mode_str, \ |
47 access_mode_value) \ | 48 access_mode_value) \ |
48 { "asan_check_" #access_size "_byte_" #access_mode_str, \ | 49 { "asan_check_" #access_size "_byte_" #access_mode_str, \ |
49 asan_redirect_##access_size##_byte_##access_mode_str, asan_no_check, \ | 50 asan_redirect_##access_size##_byte_##access_mode_str, asan_no_check, \ |
50 asan_check_##access_size##_byte_##access_mode_str##_2gb, \ | 51 asan_check_##access_size##_byte_##access_mode_str##_2gb, \ |
51 asan_check_##access_size##_byte_##access_mode_str##_4gb \ | 52 asan_check_##access_size##_byte_##access_mode_str##_4gb \ |
52 }, \ | 53 }, \ |
53 { "asan_check_" #access_size "_byte_" #access_mode_str "_no_flags", \ | 54 { "asan_check_" #access_size "_byte_" #access_mode_str "_no_flags", \ |
54 asan_redirect_##access_size##_byte_##access_mode_str##_no_flags, \ | 55 asan_redirect_##access_size##_byte_##access_mode_str##_no_flags, \ |
55 asan_no_check, \ | 56 asan_no_check, \ |
56 asan_check_##access_size##_byte_##access_mode_str##_no_flags_2gb, \ | 57 asan_check_##access_size##_byte_##access_mode_str##_no_flags_2gb, \ |
57 asan_check_##access_size##_byte_##access_mode_str##_no_flags_4gb}, | 58 asan_check_##access_size##_byte_##access_mode_str##_no_flags_4gb}, |
| 59 #else |
| 60 #define ENUM_MEM_INTERCEPT_FUNCTION_VARIANTS(access_size, access_mode_str, \ |
| 61 access_mode_value) \ |
| 62 { "asan_check_" #access_size "_byte_" #access_mode_str}, \ |
| 63 { "asan_check_" #access_size "_byte_" #access_mode_str "_no_flags", \ |
| 64 asan_no_check}, |
| 65 #endif |
58 | 66 |
59 ASAN_MEM_INTERCEPT_FUNCTIONS(ENUM_MEM_INTERCEPT_FUNCTION_VARIANTS) | 67 ASAN_MEM_INTERCEPT_FUNCTIONS(ENUM_MEM_INTERCEPT_FUNCTION_VARIANTS) |
60 | 68 |
61 #undef ENUM_MEM_INTERCEPT_FUNCTION_VARIANTS | 69 #undef ENUM_MEM_INTERCEPT_FUNCTION_VARIANTS |
62 | 70 |
| 71 #ifndef _WIN64 |
63 #define ENUM_STRING_INTERCEPT_FUNCTION_VARIANTS( \ | 72 #define ENUM_STRING_INTERCEPT_FUNCTION_VARIANTS( \ |
64 func, prefix, counter, dst_mode, src_mode, access_size, compare) \ | 73 func, prefix, counter, dst_mode, src_mode, access_size, compare) \ |
65 { "asan_check" #prefix #access_size "_byte_" #func "_access", \ | 74 { "asan_check" #prefix #access_size "_byte_" #func "_access", \ |
66 asan_redirect ## prefix ## access_size ## _byte_ ## func ## _access, \ | 75 asan_redirect ## prefix ## access_size ## _byte_ ## func ## _access, \ |
67 asan_string_no_check, \ | 76 asan_string_no_check, \ |
68 asan_check ## prefix ## access_size ## _byte_ ## func ## _access, \ | 77 asan_check ## prefix ## access_size ## _byte_ ## func ## _access, \ |
69 asan_check ## prefix ## access_size ## _byte_ ## func ## _access, \ | 78 asan_check ## prefix ## access_size ## _byte_ ## func ## _access, \ |
70 }, | 79 }, |
71 | 80 |
72 ASAN_STRING_INTERCEPT_FUNCTIONS(ENUM_STRING_INTERCEPT_FUNCTION_VARIANTS) | 81 ASAN_STRING_INTERCEPT_FUNCTIONS(ENUM_STRING_INTERCEPT_FUNCTION_VARIANTS) |
73 | 82 |
74 #undef ENUM_STRING_INTERCEPT_FUNCTION_VARIANTS | 83 #undef ENUM_STRING_INTERCEPT_FUNCTION_VARIANTS |
| 84 #endif |
75 }; | 85 }; |
76 | 86 |
77 const size_t kNumMemoryAccessorVariants = arraysize(kMemoryAccessorVariants); | 87 const size_t kNumMemoryAccessorVariants = arraysize(kMemoryAccessorVariants); |
78 | 88 |
79 void SetRedirectEntryCallback(const RedirectEntryCallback& callback) { | 89 void SetRedirectEntryCallback(const RedirectEntryCallback& callback) { |
80 redirect_entry_callback = callback; | 90 redirect_entry_callback = callback; |
81 } | 91 } |
82 | 92 |
83 // Check if the memory location is accessible and report an error on bad memory | 93 // Check if the memory location is accessible and report an error on bad memory |
84 // accesses. | 94 // accesses. |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 size_t access_size, | 203 size_t access_size, |
194 const AsanContext& asan_context) { | 204 const AsanContext& asan_context) { |
195 return agent::asan::ReportBadMemoryAccess(location, access_mode, access_size, | 205 return agent::asan::ReportBadMemoryAccess(location, access_mode, access_size, |
196 asan_context); | 206 asan_context); |
197 } | 207 } |
198 | 208 |
199 } // extern "C" | 209 } // extern "C" |
200 | 210 |
201 } // namespace asan | 211 } // namespace asan |
202 } // namespace agent | 212 } // namespace agent |
OLD | NEW |