Late fixup in _lwp_exit on TSan/NetBSD
authorKamil Rytarowski <n54@gmx.com>
Fri, 3 Nov 2017 21:08:52 +0000 (21:08 +0000)
committerKamil Rytarowski <n54@gmx.com>
Fri, 3 Nov 2017 21:08:52 +0000 (21:08 +0000)
Call DestroyThreadState() before REAL(_lwp_exit)();

This variation is less racy.

Sponsored by <The NetBSD Foundation>

llvm-svn: 317369

compiler-rt/lib/tsan/rtl/tsan_interceptors.cc

index db92f75..0b4e873 100644 (file)
@@ -2451,8 +2451,8 @@ TSAN_INTERCEPTOR(void *, __tls_get_addr, void *arg) {
 #if SANITIZER_NETBSD
 TSAN_INTERCEPTOR(void, _lwp_exit) {
   SCOPED_TSAN_INTERCEPTOR(_lwp_exit);
-  REAL(_lwp_exit)();
   DestroyThreadState();
+  REAL(_lwp_exit)();
 }
 #define TSAN_MAYBE_INTERCEPT__LWP_EXIT TSAN_INTERCEPT(_lwp_exit)
 #else