| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef RUNTIME_PLATFORM_ADDRESS_SANITIZER_H_ | 5 #ifndef RUNTIME_PLATFORM_ADDRESS_SANITIZER_H_ |
| 6 #define RUNTIME_PLATFORM_ADDRESS_SANITIZER_H_ | 6 #define RUNTIME_PLATFORM_ADDRESS_SANITIZER_H_ |
| 7 | 7 |
| 8 #include "platform/globals.h" | 8 #include "platform/globals.h" |
| 9 | 9 |
| 10 // Allow the use of ASan (AddressSanitizer). This is needed as ASan needs to be | 10 // Allow the use of ASan (AddressSanitizer). This is needed as ASan needs to be |
| 11 // told about areas where the VM does the equivalent of a long-jump. | 11 // told about areas where the VM does the equivalent of a long-jump. |
| 12 #if defined(__has_feature) | 12 #if defined(__has_feature) |
| 13 |
| 13 #if __has_feature(address_sanitizer) | 14 #if __has_feature(address_sanitizer) |
| 14 extern "C" void __asan_unpoison_memory_region(void*, size_t); | 15 extern "C" void __asan_unpoison_memory_region(void*, size_t); |
| 16 extern "C" void __lsan_register_root_region(const void* p, size_t size); |
| 17 extern "C" void __lsan_unregister_root_region(const void* p, size_t size); |
| 15 #define ASAN_UNPOISON(ptr, len) __asan_unpoison_memory_region(ptr, len) | 18 #define ASAN_UNPOISON(ptr, len) __asan_unpoison_memory_region(ptr, len) |
| 19 #define LSAN_REGISTER_ROOT_REGION(ptr, len) \ |
| 20 __lsan_register_root_region(ptr, len) |
| 21 #define LSAN_UNREGISTER_ROOT_REGION(ptr, len) \ |
| 22 __lsan_unregister_root_region(ptr, len) |
| 16 #else // __has_feature(address_sanitizer) | 23 #else // __has_feature(address_sanitizer) |
| 17 #define ASAN_UNPOISON(ptr, len) \ | 24 #define ASAN_UNPOISON(ptr, len) \ |
| 18 do { \ | 25 do { \ |
| 19 } while (false && (ptr) == 0 && (len) == 0) | 26 } while (false && (ptr) == 0 && (len) == 0) |
| 27 #define LSAN_REGISTER_ROOT_REGION(ptr, len) \ |
| 28 do { \ |
| 29 } while (false && (ptr) == 0 && (len) == 0) |
| 30 #define LSAN_UNREGISTER_ROOT_REGION(ptr, len) \ |
| 31 do { \ |
| 32 } while (false && (ptr) == 0 && (len) == 0) |
| 20 #endif // __has_feature(address_sanitizer) | 33 #endif // __has_feature(address_sanitizer) |
| 34 |
| 21 #else // defined(__has_feature) | 35 #else // defined(__has_feature) |
| 36 |
| 22 #define ASAN_UNPOISON(ptr, len) \ | 37 #define ASAN_UNPOISON(ptr, len) \ |
| 23 do { \ | 38 do { \ |
| 24 } while (false && (ptr) == 0 && (len) == 0) | 39 } while (false && (ptr) == 0 && (len) == 0) |
| 40 #define LSAN_REGISTER_ROOT_REGION(ptr, len) \ |
| 41 do { \ |
| 42 } while (false && (ptr) == 0 && (len) == 0) |
| 43 #define LSAN_UNREGISTER_ROOT_REGION(ptr, len) \ |
| 44 do { \ |
| 45 } while (false && (ptr) == 0 && (len) == 0) |
| 46 |
| 25 #endif // defined(__has_feature) | 47 #endif // defined(__has_feature) |
| 26 | 48 |
| 27 #endif // RUNTIME_PLATFORM_ADDRESS_SANITIZER_H_ | 49 #endif // RUNTIME_PLATFORM_ADDRESS_SANITIZER_H_ |
| OLD | NEW |