[PATCH] [ASan, LSan] Improve tracking of thread creation.

Sergey Matveev earthdok at google.com
Thu Nov 27 09:28:42 PST 2014


Hi kcc,

In the current scheme of things, the call to ThreadStart() in the child
thread is not synchronized with the parent thread. So, if a pointer is passed to
pthread_create, there may be a window of time during which this pointer will not
be discoverable by LSan. I.e. the pthread_create interceptor has already
returneed and thus the pointer is no longer on the parent stack, but we don't
yet know the location of the child stack. This has caused bogus leak reports
(see http://llvm.org/bugs/show_bug.cgi?id=21621/).

This patch makes the pthread_create interceptor wait until the child thread is
properly registered before returning.

http://reviews.llvm.org/D6441

Files:
  lib/asan/asan_interceptors.cc
  lib/asan/asan_rtl.cc
  lib/asan/asan_thread.cc
  lib/asan/asan_thread.h
  lib/lsan/lsan_interceptors.cc
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D6441.16700.patch
Type: text/x-patch
Size: 3984 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20141127/323bce77/attachment.bin>


More information about the llvm-commits mailing list