[PATCH] [lsan] Handle fork() correctly.
Sergey Matveev
earthdok at google.com
Mon Jul 8 05:56:26 PDT 2013
================
Comment at: lib/asan/asan_thread.cc:259
@@ +258,3 @@
+void EnsureMainThreadIsCorrect() {
+ AsanThreadContext *context = (AsanThreadContext*)AsanTSDGet();
+ if (context && (context->tid == 0))
----------------
Alexey Samsonov wrote:
> static_cast here for consistency.
Actually this needs a reinterpret_cast. Also fixed in GetCurrentThread().
================
Comment at: lib/asan/asan_thread.h:127
@@ -126,1 +126,3 @@
+// Used to handle fork().
+void EnsureMainThreadIsCorrect();
----------------
Alexey Samsonov wrote:
> I think the comment needs to be more explicit.
fixed
================
Comment at: lib/asan/asan_interceptors.cc:141
@@ -140,2 +140,3 @@
void *attr, void *(*start_routine)(void*), void *arg) {
+ EnsureMainThreadIsCorrect();
// Strict init-order checking in thread-hostile.
----------------
Alexey Samsonov wrote:
> Please add this to CreateThread() interceptor as well.
As discussed offline, this is not needed since fork() without exec() does not have a Windows equivalent.
http://llvm-reviews.chandlerc.com/D1105
BRANCH
fix/lsan/fork
ARCANIST PROJECT
compiler-rt
More information about the llvm-commits
mailing list