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