From 63f084bd7a899006a4699ac210aa0c5471bf3d71 Mon Sep 17 00:00:00 2001 From: Reid Kleckner Date: Thu, 29 Nov 2018 23:57:17 +0000 Subject: [PATCH] Revert r346560 "[winasan] Unpoison the stack in NtTerminateThread" This reverts r343606 again. The NtTerminateThread interceptor is causing problems in NaCl: https://ci.chromium.org/p/chromium/builders/luci.chromium.ci/CrWinAsan/1839 I reproduced the problem locally and tried my best to debug them, but it's beyond me. llvm-svn: 347933 --- compiler-rt/lib/asan/asan_win.cc | 12 +----------- compiler-rt/test/asan/TestCases/Windows/dll_host.cc | 1 - 2 files changed, 1 insertion(+), 12 deletions(-) diff --git a/compiler-rt/lib/asan/asan_win.cc b/compiler-rt/lib/asan/asan_win.cc index 889c5ba..5661d91 100644 --- a/compiler-rt/lib/asan/asan_win.cc +++ b/compiler-rt/lib/asan/asan_win.cc @@ -154,14 +154,6 @@ INTERCEPTOR_WINAPI(DWORD, CreateThread, asan_thread_start, t, thr_flags, tid); } -INTERCEPTOR_WINAPI(LONG, NtTerminateThread, HANDLE handle, LONG status) { - // Unpoison the terminating thread's stack because the memory may be re-used. - NT_TIB *tib = (NT_TIB *)NtCurrentTeb(); - uptr stackSize = (uptr)tib->StackBase - (uptr)tib->StackLimit; - __asan_unpoison_memory_region(tib->StackLimit, stackSize); - return REAL(NtTerminateThread(handle, status)); -} - // }}} namespace __asan { @@ -177,9 +169,7 @@ void InitializePlatformInterceptors() { ASAN_INTERCEPT_FUNC(CreateThread); ASAN_INTERCEPT_FUNC(SetUnhandledExceptionFilter); - CHECK(::__interception::OverrideFunction("NtTerminateThread", - (uptr)WRAP(NtTerminateThread), - (uptr *)&REAL(NtTerminateThread))); + #ifdef _WIN64 ASAN_INTERCEPT_FUNC(__C_specific_handler); #else diff --git a/compiler-rt/test/asan/TestCases/Windows/dll_host.cc b/compiler-rt/test/asan/TestCases/Windows/dll_host.cc index 324bd58..512f930 100644 --- a/compiler-rt/test/asan/TestCases/Windows/dll_host.cc +++ b/compiler-rt/test/asan/TestCases/Windows/dll_host.cc @@ -29,7 +29,6 @@ // IMPORT: __asan_wrap_HeapReAlloc // IMPORT: __asan_wrap_HeapSize // IMPORT: __asan_wrap_CreateThread -// IMPORT: __asan_wrap_NtTerminateThread // IMPORT: __asan_wrap_RaiseException // IMPORT: __asan_wrap_RtlRaiseException // IMPORT: __asan_wrap_SetUnhandledExceptionFilter -- 2.7.4