[PATCH] D29588: Use rw locks for sanitizer thread registry

Francis Ricci via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 6 09:15:58 PST 2017


fjricci created this revision.
Herald added a subscriber: kubamracek.

This patch also adds tid validation checks to rw mutexes and to
linux blocking mutexes, to match behavior for blocking mutexes on
mac and windows.

Adding tid validation checks to the linux blocking mutex revealed
a bug in the way StopTheWorld checks for leaks, where one thread
acquires the mutex on the thread registry in CheckForLeaks,
but a newly spawned thread accesses the registry in CheckForLeaksCallback.
Sharing a mutex access across threads is not supported by blocking mutex,
but is supported by read-only locks in rw mutexes.

In order to allow for read-only access by multiple threads, this patch
changes the lock on the thread registry to a rw mutex.


https://reviews.llvm.org/D29588

Files:
  lib/asan/asan_interceptors.cc
  lib/asan/asan_mac.cc
  lib/asan/asan_thread.cc
  lib/asan/asan_win.cc
  lib/lsan/lsan.cc
  lib/lsan/lsan_common.cc
  lib/lsan/lsan_common.h
  lib/lsan/lsan_interceptors.cc
  lib/lsan/lsan_thread.cc
  lib/sanitizer_common/sanitizer_common.h
  lib/sanitizer_common/sanitizer_libc.h
  lib/sanitizer_common/sanitizer_linux.cc
  lib/sanitizer_common/sanitizer_mac.cc
  lib/sanitizer_common/sanitizer_mutex.h
  lib/sanitizer_common/sanitizer_thread_registry.cc
  lib/sanitizer_common/sanitizer_thread_registry.h
  lib/sanitizer_common/sanitizer_win.cc
  lib/sanitizer_common/tests/sanitizer_linux_test.cc
  lib/tsan/rtl/tsan_interceptors.cc
  lib/tsan/rtl/tsan_platform_mac.cc
  lib/tsan/rtl/tsan_rtl.cc

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D29588.87242.patch
Type: text/x-patch
Size: 17450 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170206/1fff3a97/attachment.bin>


More information about the llvm-commits mailing list