| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #ifndef WTF_AddressSanitizer_h | 5 #ifndef WTF_AddressSanitizer_h |
| 6 #define WTF_AddressSanitizer_h | 6 #define WTF_AddressSanitizer_h |
| 7 // TODO(kojii): This file will need to be renamed, because it's no more | |
| 8 // specific to AddressSanitizer. | |
| 9 | 7 |
| 10 // TODO(sof): Add SyZyASan support? | 8 // TODO(sof): Add SyZyASan support? |
| 11 #if defined(ADDRESS_SANITIZER) | 9 #if defined(ADDRESS_SANITIZER) |
| 12 #include <sanitizer/asan_interface.h> | 10 #include <sanitizer/asan_interface.h> |
| 13 #else | 11 #else |
| 14 #define ASAN_POISON_MEMORY_REGION(addr, size) \ | 12 #define ASAN_POISON_MEMORY_REGION(addr, size) \ |
| 15 ((void)(addr), (void)(size)) | 13 ((void)(addr), (void)(size)) |
| 16 #define ASAN_UNPOISON_MEMORY_REGION(addr, size) \ | 14 #define ASAN_UNPOISON_MEMORY_REGION(addr, size) \ |
| 17 ((void)(addr), (void)(size)) | 15 ((void)(addr), (void)(size)) |
| 18 #endif | 16 #endif |
| 19 | 17 |
| 20 #if defined(LEAK_SANITIZER) | 18 #if defined(LEAK_SANITIZER) |
| 21 #include <sanitizer/lsan_interface.h> | 19 #include <sanitizer/lsan_interface.h> |
| 22 #else | 20 #else |
| 23 #define __lsan_register_root_region(addr, size) ((void)(addr), (void)(size)) | 21 #define __lsan_register_root_region(addr, size) ((void)(addr), (void)(size)) |
| 24 #define __lsan_unregister_root_region(addr, size) ((void)(addr), (void)(size)) | 22 #define __lsan_unregister_root_region(addr, size) ((void)(addr), (void)(size)) |
| 25 #endif | 23 #endif |
| 26 | 24 |
| 27 #if defined(MEMORY_SANITIZER) | |
| 28 #include <sanitizer/msan_interface.h> | |
| 29 #endif | |
| 30 | |
| 31 // TODO(sof): Have to handle (ADDRESS_SANITIZER && _WIN32) differently as it | 25 // TODO(sof): Have to handle (ADDRESS_SANITIZER && _WIN32) differently as it |
| 32 // uses both Clang (which supports the __attribute__ syntax) and CL (which doesn
't) | 26 // uses both Clang (which supports the __attribute__ syntax) and CL (which doesn
't) |
| 33 // as long as we use "clang-cl /fallback". This shouldn't be needed when Clang | 27 // as long as we use "clang-cl /fallback". This shouldn't be needed when Clang |
| 34 // handles all the code without falling back to CL. | 28 // handles all the code without falling back to CL. |
| 35 #if defined(ADDRESS_SANITIZER) && (!OS(WIN) || COMPILER(CLANG)) | 29 #if defined(ADDRESS_SANITIZER) && (!OS(WIN) || COMPILER(CLANG)) |
| 36 #define NO_SANITIZE_ADDRESS __attribute__((no_sanitize_address)) | 30 #define NO_SANITIZE_ADDRESS __attribute__((no_sanitize_address)) |
| 37 #if ENABLE(LAZY_SWEEPING) | 31 #if ENABLE(LAZY_SWEEPING) |
| 38 #define NO_LAZY_SWEEP_SANITIZE_ADDRESS NO_SANITIZE_ADDRESS | 32 #define NO_LAZY_SWEEP_SANITIZE_ADDRESS NO_SANITIZE_ADDRESS |
| 39 #else | 33 #else |
| 40 #define NO_LAZY_SWEEP_SANITIZE_ADDRESS | 34 #define NO_LAZY_SWEEP_SANITIZE_ADDRESS |
| 41 #endif | 35 #endif |
| 42 #else | 36 #else |
| 43 #define NO_SANITIZE_ADDRESS | 37 #define NO_SANITIZE_ADDRESS |
| 44 #define NO_LAZY_SWEEP_SANITIZE_ADDRESS | 38 #define NO_LAZY_SWEEP_SANITIZE_ADDRESS |
| 45 #endif | 39 #endif |
| 46 | 40 |
| 47 #if defined(MEMORY_SANITIZER) && (!OS(WIN) || COMPILER(CLANG)) | |
| 48 #define NO_SANITIZE_MEMORY __attribute__((no_sanitize_memory)) | |
| 49 #else | |
| 50 #define NO_SANITIZE_MEMORY | |
| 51 #endif | |
| 52 | |
| 53 #endif // WTF_AddressSanitizer_h | 41 #endif // WTF_AddressSanitizer_h |
| OLD | NEW |