[PATCH] Interceptors for standalone LSan.

Sergey Matveev earthdok at google.com
Mon May 13 04:03:53 PDT 2013



================
Comment at: lib/lsan/lsan_interceptors.cc:63
@@ +62,3 @@
+  GET_STACK_TRACE;
+  void *p = Allocate(stack, size, kAlignment, false);
+  return p;
----------------
Kostya Serebryany wrote:
> change to "return Allocate" (here and below)
done

================
Comment at: lib/lsan/lsan_interceptors.cc:58
@@ +57,3 @@
+
+const uptr kAlignment = 8;
+
----------------
Kostya Serebryany wrote:
> This is actually wrong, because we must ensure 16 alignment. 
> But why not simply pass 0? (and remove this constant)
ok

================
Comment at: lib/lsan/lsan_interceptors.cc:205
@@ +204,3 @@
+  }
+  AdjustStackSizeLinux(attr, 0);
+  int detached = 0;
----------------
Kostya Serebryany wrote:
> Why do you need this?
> If you don't, you also don't need myattr (use code similar to asan_interceptors.cc)
I need this because I keep allocator caches in TLS. If the user-specified stack size is not enough to contain the TLS + minimum stack size, pthread_create will fail. This happens with Chrome, for instance.

================
Comment at: lib/lsan/lsan_interceptors.cc:213
@@ +212,3 @@
+  int res = REAL(pthread_create)(th, attr, __lsan_thread_start_func, &p);
+  if (res == 0) {
+    int tid = ThreadCreate(GetCurrentThread(), *(uptr *)th, detached);
----------------
Kostya Serebryany wrote:
> I'd like dvyukov's review here.
Dmitry has reviewed this code before. Besides, I copied this code from TSan.


http://llvm-reviews.chandlerc.com/D763



More information about the llvm-commits mailing list