summaryrefslogtreecommitdiff
path: root/lib/lsan/lsan_interceptors.cc
diff options
context:
space:
mode:
authorSergey Matveev <earthdok@google.com>2013-07-08 12:57:24 +0000
committerSergey Matveev <earthdok@google.com>2013-07-08 12:57:24 +0000
commitc6ac98d7fcc81768b2ef7ddc785c27e3fc1bdef6 (patch)
treebfbbc7b8f485db6067bb87d41e007c97bb5c7f33 /lib/lsan/lsan_interceptors.cc
parent99560bf109ca14b1a48e1ae1206bcc11cdb7eae4 (diff)
downloadcompiler-rt-c6ac98d7fcc81768b2ef7ddc785c27e3fc1bdef6.tar.gz
[lsan] Handle fork() correctly.
Update the main thread's os_id on every pthread_create, and before initiating leak checking. This ensures that we have the correct os_id even if we have forked after Init(). git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@185815 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/lsan/lsan_interceptors.cc')
-rw-r--r--lib/lsan/lsan_interceptors.cc1
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/lsan/lsan_interceptors.cc b/lib/lsan/lsan_interceptors.cc
index e9e2dd2da..454b5561c 100644
--- a/lib/lsan/lsan_interceptors.cc
+++ b/lib/lsan/lsan_interceptors.cc
@@ -218,6 +218,7 @@ extern "C" void *__lsan_thread_start_func(void *arg) {
INTERCEPTOR(int, pthread_create, void *th, void *attr,
void *(*callback)(void *), void *param) {
Init();
+ EnsureMainThreadIDIsCorrect();
__sanitizer_pthread_attr_t myattr;
if (attr == 0) {
pthread_attr_init(&myattr);