OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2014 Google Inc. All rights reserved. | 2 * Copyright (C) 2014 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 16 matching lines...) Expand all Loading... |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 #ifndef AddressSanitizer_h | 31 #ifndef AddressSanitizer_h |
32 #define AddressSanitizer_h | 32 #define AddressSanitizer_h |
33 | 33 |
34 // FIXME: Add SyZyASan support? | 34 // FIXME: Add SyZyASan support? |
35 #if defined(ADDRESS_SANITIZER) | 35 #if defined(ADDRESS_SANITIZER) |
36 #include <sanitizer/asan_interface.h> | 36 #include <sanitizer/asan_interface.h> |
37 #define NO_SANITIZE_ADDRESS __attribute__((no_sanitize_address)) | |
38 #else | 37 #else |
39 #define ASAN_POISON_MEMORY_REGION(addr, size) \ | 38 #define ASAN_POISON_MEMORY_REGION(addr, size) \ |
40 ((void)(addr), (void)(size)) | 39 ((void)(addr), (void)(size)) |
41 #define ASAN_UNPOISON_MEMORY_REGION(addr, size) \ | 40 #define ASAN_UNPOISON_MEMORY_REGION(addr, size) \ |
42 ((void)(addr), (void)(size)) | 41 ((void)(addr), (void)(size)) |
| 42 #endif |
| 43 |
| 44 // FIXME: Have to handle (ADDRESS_SANITIZER && _WIN32) differently as it uses |
| 45 // both Clang (which supports the __attribute__ syntax) and CL (which doesn't) |
| 46 // as long as we use "clang-cl /fallback". This shouldn't be needed when Clang |
| 47 // handles all the code without falling back to CL. |
| 48 #if defined(ADDRESS_SANITIZER) && (!OS(WIN) || COMPILER(CLANG)) |
| 49 #define NO_SANITIZE_ADDRESS __attribute__((no_sanitize_address)) |
| 50 #else |
43 #define NO_SANITIZE_ADDRESS | 51 #define NO_SANITIZE_ADDRESS |
44 #endif | 52 #endif |
45 | 53 |
46 const size_t asanMagic = 0xabefeed0; | 54 const size_t asanMagic = 0xabefeed0; |
47 const size_t asanDeferMemoryReuseCount = 2; | 55 const size_t asanDeferMemoryReuseCount = 2; |
48 const size_t asanDeferMemoryReuseMask = 0x3; | 56 const size_t asanDeferMemoryReuseMask = 0x3; |
49 | 57 |
50 #endif | 58 #endif |
OLD | NEW |