[PATCH] D39619: Correct atexit(3) support in TSan/NetBSD

Dmitry Vyukov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 7 23:55:29 PST 2017


dvyukov added inline comments.


================
Comment at: lib/tsan/rtl/tsan_interceptors.cc:413
+  // Pop AtExitCtx from the top of the stack of callback functions
+  uptr element = interceptor_ctx()->AtExitStack.Size() - 1;
+  AtExitCtx *ctx = interceptor_ctx()->AtExitStack[element];
----------------
This also needs the mutex for 2 reasons:
1. It can race with setup_at_exit_wrapper in other threads.
2. You push onto the stack _after_ calling __cxa_atexit, so if another thread calls exit in between, at_exit_wrapper can see an empty stack.


Repository:
  rL LLVM

https://reviews.llvm.org/D39619





More information about the llvm-commits mailing list