[PATCH] asan/tsan/msan: properly intercept pthread_cond_xxx

Dmitry Vyukov dvyukov at google.com
Mon Apr 7 09:08:43 PDT 2014


Hi chandlerc, kcc, samsonov, eugenis, glider,

NPTL implementation of pthread_cond has 2 versions -- 2.2.5 and 2.3.2. pthread_cond_t has different sizes in these versions, so we can't simply always call real 2.3.2 functions. Previously we struggled with this by means of various hacks (always call new version; allocate a satellite object large enough for new version; added flag that enables/disables the previous behavior; and probably other options).
This is an attempt to solve this problem once and for all. The patch adds 2 versions of interceptors, so that we know when to call old real functions and when to call new real function.
The main downside is that linking of shared libraries with xsan runtime now requires version script. This mode (linking of xsan runtime into shared libs) is generally unsupported, but we use it in some custom setups (e.g. build an instrumented shared C++ library and load it into Python/R/Java process). That usages will require the provided version script.
Better suggestions are welcome.


http://reviews.llvm.org/D3309

Files:
  cmake/Modules/SanitizerUtils.cmake
  lib/tsan/dd/dd_interceptors.cc
  lib/tsan/Makefile.old
  lib/tsan/CMakeLists.txt
  lib/tsan/tests/unit/tsan_flags_test.cc
  lib/msan/CMakeLists.txt
  lib/sanitizer_common/sanitizer_flags.cc
  lib/sanitizer_common/sanitizer_internal_defs.h
  lib/sanitizer_common/sanitizer_common_interceptors.inc
  lib/sanitizer_common/sanitizer_flags.h
  lib/asan/CMakeLists.txt
  lib/interception/interception_linux.h
  lib/interception/interception.h
  test/tsan/runtime_in_shared_lib.cc
  test/tsan/test_output.sh
  lib/tsan/check_runtime_library.sh
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D3309.1.patch
Type: text/x-patch
Size: 25556 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140407/a1a7c2a6/attachment.bin>


More information about the llvm-commits mailing list