[PATCH] tsan: fix signal handling during stop-the-world

Dmitry Vyukov dvyukov at google.com
Thu Mar 5 06:37:04 PST 2015


> We need a comment in sanitizer_stoptheworld.h documenting the fact that the callback must exit by returning and not by calling exit() or _exit().


done


================
Comment at: lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc:214
@@ -208,2 +213,3 @@
       signum, ctx.addr, ctx.pc, ctx.sp);
-  if (thread_suspender_instance != NULL) {
+  ThreadSuspender *inst = thread_suspender_instance;
+  if (inst != NULL) {
----------------
earthdok wrote:
> what is the purpose of these changes?
I want to set inst->arg->done=1 as the last action before internal__exit. But I also need to set thread_suspender_instance to NULL. This means that I need a copy of thread_suspender_instance in a local var.

================
Comment at: lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc:235
@@ -224,3 +234,3 @@
   // a lot of opportunities for that to happen...
-  if (thread_suspender_instance)
-    thread_suspender_instance->KillAllThreads();
+  ThreadSuspender *inst = thread_suspender_instance;
+  if (inst != NULL && stoptheworld_tracer_pid == internal_getpid()) {
----------------
earthdok wrote:
> same question
Just to reduce length of overly lengthy identifiers.

================
Comment at: lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc:424
@@ +423,3 @@
+    // NOTE: errno is shared between this thread and the tracer thread.
+    // internal_waitpid can access/spoil errno, so we can't call it now.
+    // Instead we for the tracer thread to finish using the spin loop below.
----------------
earthdok wrote:
> internal_waitpid() may call syscall() which can access/spoil...
done

http://reviews.llvm.org/D8032

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the llvm-commits mailing list