Address sanitization
include/mem/asan.h View source View on GitHubFunctions
Section titled “Functions”asan_shadow_is_poison
Section titled “asan_shadow_is_poison”bool asan_shadow_is_poison(uint8_t s); asan_init
Section titled “asan_init”void asan_init(void); asan_shadow_install
Section titled “asan_shadow_install”enum errno asan_shadow_install(vaddr_t base, size_t len); asan_shadow_release
Section titled “asan_shadow_release”void asan_shadow_release(vaddr_t base, size_t len); asan_alloc
Section titled “asan_alloc”void asan_alloc(void *addr, size_t requested, size_t slot); asan_free
Section titled “asan_free”void asan_free(void *addr, size_t slot); asan_poison
Section titled “asan_poison”void asan_poison(void *addr, size_t size); asan_unpoison
Section titled “asan_unpoison”void asan_unpoison(void *addr, size_t size); asan_init
Section titled “asan_init”void asan_init(void); asan_shadow_install
Section titled “asan_shadow_install”enum errno asan_shadow_install(vaddr_t base, size_t len); asan_shadow_release
Section titled “asan_shadow_release”void asan_shadow_release(vaddr_t base, size_t len); asan_alloc
Section titled “asan_alloc”void asan_alloc(void *addr, size_t requested, size_t slot); asan_free
Section titled “asan_free”void asan_free(void *addr, size_t slot); asan_poison
Section titled “asan_poison”void asan_poison(void *addr, size_t size); asan_unpoison
Section titled “asan_unpoison”void asan_unpoison(void *addr, size_t size); Macros
Section titled “Macros”ASAN_SHADOW_SCALE
Section titled “ASAN_SHADOW_SCALE”#define ASAN_SHADOW_SCALE 3ULL /* 1 shadow byte per 8 real bytes */ ASAN_SHADOW_OFFSET
Section titled “ASAN_SHADOW_OFFSET”#define ASAN_SHADOW_OFFSET 0xDFFFFE0000000000 ASAN_SHADOW_ADDR
Section titled “ASAN_SHADOW_ADDR”#define ASAN_SHADOW_ADDR(a) \
((uintptr_t) (((uintptr_t) (a) >> ASAN_SHADOW_SCALE) + ASAN_SHADOW_OFFSET)) ASAN_GRANULE
Section titled “ASAN_GRANULE”#define ASAN_GRANULE (1ULL << ASAN_SHADOW_SCALE) ASAN_REDZONE
Section titled “ASAN_REDZONE”#define ASAN_REDZONE 16 /* optional redzone per allocation */ ASAN_POISON_VALUE
Section titled “ASAN_POISON_VALUE”#define ASAN_POISON_VALUE 0xFF /* generic: never handed out */ ASAN_POISON_HEAP_REDZONE
Section titled “ASAN_POISON_HEAP_REDZONE”#define ASAN_POISON_HEAP_REDZONE 0xFA /* slack around/inside a live slot */ ASAN_POISON_HEAP_FREED
Section titled “ASAN_POISON_HEAP_FREED”#define ASAN_POISON_HEAP_FREED 0xFD /* was live, has been freed */ ASAN_ABORT_IF_NOT_READY
Section titled “ASAN_ABORT_IF_NOT_READY”#define ASAN_ABORT_IF_NOT_READY() \
do { \
if (!asan_ready) \
return; \
} while (0) asan_log
Section titled “asan_log”#define asan_log(lvl, fmt, ...) \
log(LOG_SITE(asan), LOG_HANDLE(asan), lvl, fmt, ##__VA_ARGS__) asan_err
Section titled “asan_err”#define asan_err(fmt, ...) asan_log(LOG_ERROR, fmt, ##__VA_ARGS__) asan_warn
Section titled “asan_warn”#define asan_warn(fmt, ...) asan_log(LOG_WARN, fmt, ##__VA_ARGS__) asan_info
Section titled “asan_info”#define asan_info(fmt, ...) asan_log(LOG_INFO, fmt, ##__VA_ARGS__) asan_debug
Section titled “asan_debug”#define asan_debug(fmt, ...) asan_log(LOG_DEBUG, fmt, ##__VA_ARGS__) asan_trace
Section titled “asan_trace”#define asan_trace(fmt, ...) asan_log(LOG_TRACE, fmt, ##__VA_ARGS__)