commit 6fdba17a20fd7c5f31f39556dc511abe3a537204 68/127468/1 sandbox/ibaravy/isan_base accepted/tizen/base/20170429.025027 submit/tizen_base/20170428.032130
authorDenis Khalikov <d.khalikov@partner.samsung.com>
Wed, 26 Apr 2017 15:27:29 +0000 (18:27 +0300)
committerDenis Khalikov <d.khalikov@partner.samsung.com>
Thu, 27 Apr 2017 10:07:34 +0000 (13:07 +0300)
commit0e367b9938841ef0a7789d6d7ce70de2145e73da
tree7f085c9acd263046f8bb6d98984a1d91b93e7c5f
parentaa456f6090612d2b9bed6d79f71ca351937d9d02
commit 6fdba17a20fd7c5f31f39556dc511abe3a537204
Author: Maxim Ostapenko <m.ostapenko@partner.samsung.com>
Date:   Fri Oct 28 06:49:53 2016 +0000

    [asan/lsan] Avoid possible deadlock in dynamic ASan runtime thread initialization.

    There is possible deadlock in dynamic ASan runtime when we dlopen() shared lib
    which creates a thread at the global initialization stage. The scenario:

    1) dlopen grabs a GI_pthread_mutex_lock in main thread.
    2) main thread calls pthread_create, ASan intercepts it, calls real pthread_create
       and waits for the second thread to be "fully initialized".
    3) Newly created thread tries to access a thread local disable_counter in LSan
       (to complete its "full initialization") and hangs in tls_get_addr_tail, because
       it also tries to acquire GI_pthread_mutex_lock.

     The issue is reproducible on relative recent Glibc versions e.g. 2.23.

     Differential Revision: https://reviews.llvm.org/D26028

Change-Id: I0ed82cb81dd9d37d0be96ece03b667090b72164a
libsanitizer/lsan/lsan_common.cc