Changeset View
Changeset View
Standalone View
Standalone View
sys/sys/atomic_san.h
Show First 20 Lines • Show All 70 Lines • ▼ Show 20 Lines | |||||
#define ATOMIC_SAN_STORE(sp, name, type) \ | #define ATOMIC_SAN_STORE(sp, name, type) \ | ||||
void sp##_atomic_store_##name(volatile type *, type); \ | void sp##_atomic_store_##name(volatile type *, type); \ | ||||
void sp##_atomic_store_rel_##name(volatile type *, type) | void sp##_atomic_store_rel_##name(volatile type *, type) | ||||
#define ATOMIC_SAN_TEST(sp, op, name, type) \ | #define ATOMIC_SAN_TEST(sp, op, name, type) \ | ||||
int sp##_atomic_##op##_##name(volatile type *, u_int); \ | int sp##_atomic_##op##_##name(volatile type *, u_int); \ | ||||
int sp##_atomic_##op##_acq_##name(volatile type *, u_int) | int sp##_atomic_##op##_acq_##name(volatile type *, u_int) | ||||
#define ATOMIC_SAN_THREAD_FENCE(sp) \ | #define _ATOMIC_SAN_THREAD_FENCE(sp) \ | ||||
void sp##_atomic_thread_fence_acq(void); \ | void sp##_atomic_thread_fence_acq(void); \ | ||||
void sp##_atomic_thread_fence_rel(void); \ | void sp##_atomic_thread_fence_rel(void); \ | ||||
void sp##_atomic_thread_fence_acq_rel(void); \ | void sp##_atomic_thread_fence_acq_rel(void); \ | ||||
void sp##_atomic_thread_fence_seq_cst(void); \ | void sp##_atomic_thread_fence_seq_cst(void); \ | ||||
void sp##_atomic_interrupt_fence(void) | void sp##_atomic_interrupt_fence(void) | ||||
#define ATOMIC_SAN_THREAD_FENCE(sp) \ | |||||
_ATOMIC_SAN_THREAD_FENCE(sp) | |||||
#define _ATOMIC_SAN_FUNCS(sp, name, type) \ | #define _ATOMIC_SAN_FUNCS(sp, name, type) \ | ||||
ATOMIC_SAN_FUNC_1(sp, add, name, type); \ | ATOMIC_SAN_FUNC_1(sp, add, name, type); \ | ||||
ATOMIC_SAN_FUNC_1(sp, clear, name, type); \ | ATOMIC_SAN_FUNC_1(sp, clear, name, type); \ | ||||
ATOMIC_SAN_CMPSET(sp, name, type); \ | ATOMIC_SAN_CMPSET(sp, name, type); \ | ||||
ATOMIC_SAN_FCMPSET(sp, name, type); \ | ATOMIC_SAN_FCMPSET(sp, name, type); \ | ||||
ATOMIC_SAN_READ(sp, fetchadd, name, type); \ | ATOMIC_SAN_READ(sp, fetchadd, name, type); \ | ||||
ATOMIC_SAN_LOAD(sp, name, type); \ | ATOMIC_SAN_LOAD(sp, name, type); \ | ||||
ATOMIC_SAN_READANDCLEAR(sp, name, type); \ | ATOMIC_SAN_READANDCLEAR(sp, name, type); \ | ||||
ATOMIC_SAN_FUNC_1(sp, set, name, type); \ | ATOMIC_SAN_FUNC_1(sp, set, name, type); \ | ||||
ATOMIC_SAN_FUNC_1(sp, subtract, name, type); \ | ATOMIC_SAN_FUNC_1(sp, subtract, name, type); \ | ||||
ATOMIC_SAN_STORE(sp, name, type); \ | ATOMIC_SAN_STORE(sp, name, type); \ | ||||
ATOMIC_SAN_READ(sp, swap, name, type); \ | ATOMIC_SAN_READ(sp, swap, name, type); \ | ||||
ATOMIC_SAN_TEST(sp, testandclear, name, type); \ | ATOMIC_SAN_TEST(sp, testandclear, name, type); \ | ||||
ATOMIC_SAN_TEST(sp, testandset, name, type); \ | ATOMIC_SAN_TEST(sp, testandset, name, type) | ||||
ATOMIC_SAN_THREAD_FENCE(sp); | |||||
#define ATOMIC_SAN_FUNCS(name, type) \ | #define ATOMIC_SAN_FUNCS(name, type) \ | ||||
_ATOMIC_SAN_FUNCS(SAN_INTERCEPTOR_PREFIX, name, type) | _ATOMIC_SAN_FUNCS(SAN_INTERCEPTOR_PREFIX, name, type) | ||||
ATOMIC_SAN_FUNCS(char, uint8_t); | ATOMIC_SAN_FUNCS(char, uint8_t); | ||||
ATOMIC_SAN_FUNCS(short, uint16_t); | ATOMIC_SAN_FUNCS(short, uint16_t); | ||||
ATOMIC_SAN_FUNCS(int, u_int); | ATOMIC_SAN_FUNCS(int, u_int); | ||||
ATOMIC_SAN_FUNCS(long, u_long); | ATOMIC_SAN_FUNCS(long, u_long); | ||||
ATOMIC_SAN_FUNCS(ptr, uintptr_t); | ATOMIC_SAN_FUNCS(ptr, uintptr_t); | ||||
ATOMIC_SAN_FUNCS(8, uint8_t); | ATOMIC_SAN_FUNCS(8, uint8_t); | ||||
ATOMIC_SAN_FUNCS(16, uint16_t); | ATOMIC_SAN_FUNCS(16, uint16_t); | ||||
ATOMIC_SAN_FUNCS(32, uint32_t); | ATOMIC_SAN_FUNCS(32, uint32_t); | ||||
ATOMIC_SAN_FUNCS(64, uint64_t); | ATOMIC_SAN_FUNCS(64, uint64_t); | ||||
ATOMIC_SAN_THREAD_FENCE(SAN_INTERCEPTOR_PREFIX); | |||||
#ifndef SAN_RUNTIME | #ifndef SAN_RUNTIME | ||||
/* | /* | ||||
* Redirect uses of an atomic(9) function to the sanitizer's interceptor. | * Redirect uses of an atomic(9) function to the sanitizer's interceptor. | ||||
* For instance, KASAN callers of atomic_add_char() will be redirected to | * For instance, KASAN callers of atomic_add_char() will be redirected to | ||||
* kasan_atomic_add_char(). | * kasan_atomic_add_char(). | ||||
*/ | */ | ||||
▲ Show 20 Lines • Show All 277 Lines • Show Last 20 Lines |