#include "asan_allocator.h"
#include "asan_poisoning.h"
#include "asan_thread.h"
namespace __asan {
static const u64 kMagic1 = …;
static const u64 kMagic2 = …;
static const u64 kMagic4 = …;
static const u64 kMagic8 = …;
static const u64 kAllocaRedzoneSize = …;
static const u64 kAllocaRedzoneMask = …;
ALWAYS_INLINE void SetShadow(uptr ptr, uptr size, uptr class_id, u64 magic) { … }
FakeStack *FakeStack::Create(uptr stack_size_log) { … }
void FakeStack::Destroy(int tid) { … }
void FakeStack::PoisonAll(u8 magic) { … }
#if !defined(_MSC_VER) || defined(__clang__)
ALWAYS_INLINE USED
#endif
FakeFrame *FakeStack::Allocate(uptr stack_size_log, uptr class_id,
uptr real_stack) { … }
uptr FakeStack::AddrIsInFakeStack(uptr ptr, uptr *frame_beg, uptr *frame_end) { … }
void FakeStack::HandleNoReturn() { … }
NOINLINE void FakeStack::GC(uptr real_stack) { … }
void FakeStack::ForEachFakeFrame(RangeIteratorCallback callback, void *arg) { … }
#if (SANITIZER_LINUX && !SANITIZER_ANDROID) || SANITIZER_FUCHSIA
static THREADLOCAL FakeStack *fake_stack_tls;
FakeStack *GetTLSFakeStack() { … }
void SetTLSFakeStack(FakeStack *fs) { … }
#else
FakeStack *GetTLSFakeStack() { return 0; }
void SetTLSFakeStack(FakeStack *fs) { }
#endif
static FakeStack *GetFakeStack() { … }
static FakeStack *GetFakeStackFast() { … }
static FakeStack *GetFakeStackFastAlways() { … }
static ALWAYS_INLINE uptr OnMalloc(uptr class_id, uptr size) { … }
static ALWAYS_INLINE uptr OnMallocAlways(uptr class_id, uptr size) { … }
static ALWAYS_INLINE void OnFree(uptr ptr, uptr class_id, uptr size) { … }
}
usingnamespace__asan;
#define DEFINE_STACK_MALLOC_FREE_WITH_CLASS_ID(class_id) …
DEFINE_STACK_MALLOC_FREE_WITH_CLASS_ID(…)
DEFINE_STACK_MALLOC_FREE_WITH_CLASS_ID(…)
DEFINE_STACK_MALLOC_FREE_WITH_CLASS_ID(…)
DEFINE_STACK_MALLOC_FREE_WITH_CLASS_ID(…)
DEFINE_STACK_MALLOC_FREE_WITH_CLASS_ID(…)
DEFINE_STACK_MALLOC_FREE_WITH_CLASS_ID(…)
DEFINE_STACK_MALLOC_FREE_WITH_CLASS_ID(…)
DEFINE_STACK_MALLOC_FREE_WITH_CLASS_ID(…)
DEFINE_STACK_MALLOC_FREE_WITH_CLASS_ID(…)
DEFINE_STACK_MALLOC_FREE_WITH_CLASS_ID(…)
DEFINE_STACK_MALLOC_FREE_WITH_CLASS_ID(…)
extern "C" {
SANITIZER_INTERFACE_ATTRIBUTE
void *__asan_get_current_fake_stack() { … }
SANITIZER_INTERFACE_ATTRIBUTE
void *__asan_addr_is_in_fake_stack(void *fake_stack, void *addr, void **beg,
void **end) { … }
SANITIZER_INTERFACE_ATTRIBUTE
void __asan_alloca_poison(uptr addr, uptr size) { … }
SANITIZER_INTERFACE_ATTRIBUTE
void __asan_allocas_unpoison(uptr top, uptr bottom) { … }
}