mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-14 13:32:23 +00:00
AK: Add platform macros to detect presence of AddressSanitizer
The ASAN_[UN]POISON_MEMORY_REGION macros can be used to manually notify the AddressSanitizer runtime about the reachability of instrumented code accessing a memory region. This is most useful for manually managed heaps and arenas that do not go directly to malloc or alligned_alloc.
This commit is contained in:
parent
5e1c1eb840
commit
212365130d
Notes:
sideshowbarker
2024-07-18 17:17:14 +09:00
Author: https://github.com/ADKaster
Commit: 212365130d
Pull-request: https://github.com/SerenityOS/serenity/pull/7515
1 changed files with 14 additions and 0 deletions
|
@ -45,6 +45,20 @@
|
||||||
#endif
|
#endif
|
||||||
#define NO_SANITIZE_ADDRESS [[gnu::no_sanitize_address]]
|
#define NO_SANITIZE_ADDRESS [[gnu::no_sanitize_address]]
|
||||||
|
|
||||||
|
// GCC doesn't have __has_feature but clang does
|
||||||
|
#ifndef __has_feature
|
||||||
|
# define __has_feature(...) 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if __has_feature(address_sanitizer) || defined(__SANITIZE_ADDRESS__)
|
||||||
|
# define HAS_ADDRESS_SANITIZER
|
||||||
|
# define ASAN_POISON_MEMORY_REGION(addr, size) __asan_poison_memory_region(addr, size)
|
||||||
|
# define ASAN_UNPOISON_MEMORY_REGION(addr, size) __asan_unpoison_memory_region(addr, size)
|
||||||
|
#else
|
||||||
|
# define ASAN_POISON_MEMORY_REGION(addr, size)
|
||||||
|
# define ASAN_UNPOISON_MEMORY_REGION(addr, size)
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef __serenity__
|
#ifndef __serenity__
|
||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
# undef PAGE_SIZE
|
# undef PAGE_SIZE
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue