#include "asan_thread.h"
#include "asan_allocator.h"
#include "asan_interceptors.h"
#include "asan_mapping.h"
#include "asan_poisoning.h"
#include "asan_stack.h"
#include "lsan/lsan_common.h"
#include "sanitizer_common/sanitizer_common.h"
#include "sanitizer_common/sanitizer_placement_new.h"
#include "sanitizer_common/sanitizer_stackdepot.h"
#include "sanitizer_common/sanitizer_tls_get_addr.h"
namespace __asan {
void AsanThreadContext::OnCreated(void *arg) { … }
void AsanThreadContext::OnFinished() { … }
static ThreadRegistry *asan_thread_registry;
static ThreadArgRetval *thread_data;
static Mutex mu_for_thread_context;
static LowLevelAllocator allocator_for_thread_context;
static ThreadContextBase *GetAsanThreadContext(u32 tid) { … }
static void InitThreads() { … }
ThreadRegistry &asanThreadRegistry() { … }
ThreadArgRetval &asanThreadArgRetval() { … }
AsanThreadContext *GetThreadContextByTidLocked(u32 tid) { … }
AsanThread *AsanThread::Create(const void *start_data, uptr data_size,
u32 parent_tid, StackTrace *stack,
bool detached) { … }
void AsanThread::GetStartData(void *out, uptr out_size) const { … }
void AsanThread::TSDDtor(void *tsd) { … }
void AsanThread::Destroy() { … }
void AsanThread::StartSwitchFiber(FakeStack **fake_stack_save, uptr bottom,
uptr size) { … }
void AsanThread::FinishSwitchFiber(FakeStack *fake_stack_save, uptr *bottom_old,
uptr *size_old) { … }
inline AsanThread::StackBounds AsanThread::GetStackBounds() const { … }
uptr AsanThread::stack_top() { … }
uptr AsanThread::stack_bottom() { … }
uptr AsanThread::stack_size() { … }
FakeStack *AsanThread::AsyncSignalSafeLazyInitFakeStack() { … }
void AsanThread::Init(const InitOptions *options) { … }
#if !SANITIZER_FUCHSIA
void AsanThread::ThreadStart(tid_t os_id) { … }
AsanThread *CreateMainThread() { … }
void AsanThread::SetThreadStackAndTls(const InitOptions *options) { … }
#endif
void AsanThread::ClearShadowForThreadStackAndTLS() { … }
bool AsanThread::GetStackFrameAccessByAddr(uptr addr,
StackFrameAccess *access) { … }
uptr AsanThread::GetStackVariableShadowStart(uptr addr) { … }
bool AsanThread::AddrIsInStack(uptr addr) { … }
static bool ThreadStackContainsAddress(ThreadContextBase *tctx_base,
void *addr) { … }
AsanThread *GetCurrentThread() { … }
void SetCurrentThread(AsanThread *t) { … }
u32 GetCurrentTidOrInvalid() { … }
AsanThread *FindThreadByStackAddress(uptr addr) { … }
void EnsureMainThreadIDIsCorrect() { … }
__asan::AsanThread *GetAsanThreadByOsIDLocked(tid_t os_id) { … }
}
namespace __lsan {
void LockThreads() { … }
void UnlockThreads() { … }
static ThreadRegistry *GetAsanThreadRegistryLocked() { … }
void EnsureMainThreadIDIsCorrect() { … }
bool GetThreadRangesLocked(tid_t os_id, uptr *stack_begin, uptr *stack_end,
uptr *tls_begin, uptr *tls_end, uptr *cache_begin,
uptr *cache_end, DTLS **dtls) { … }
void GetAllThreadAllocatorCachesLocked(InternalMmapVector<uptr> *caches) { … }
void GetThreadExtraStackRangesLocked(tid_t os_id,
InternalMmapVector<Range> *ranges) { … }
void GetThreadExtraStackRangesLocked(InternalMmapVector<Range> *ranges) { … }
void GetAdditionalThreadContextPtrsLocked(InternalMmapVector<uptr> *ptrs) { … }
void GetRunningThreadsLocked(InternalMmapVector<tid_t> *threads) { … }
}
usingnamespace__asan;
extern "C" {
SANITIZER_INTERFACE_ATTRIBUTE
void __sanitizer_start_switch_fiber(void **fakestacksave, const void *bottom,
uptr size) { … }
SANITIZER_INTERFACE_ATTRIBUTE
void __sanitizer_finish_switch_fiber(void *fakestack, const void **bottom_old,
uptr *size_old) { … }
}