[PATCH] Move the signal handling logic into sanitizer_common

Alexander Potapenko glider at google.com
Thu Jan 23 07:30:18 PST 2014


Hi dvyukov, eugenis, earthdok, kcc, samsonov,

This patch changes the signal handling logic in the following way:
1. The "handle_segv", "allow_user_segv_handler" and "use_sigaltstack" flags now belong to common_flags().
2. Every tool may opt into installing the default signal handlers for deadly signals (SIGSEGV on Linux and OSX, SIGBUS on OSX) by calling InstallDeadlySignalHandlers(). Dummy signal handlers are added for TSan and MSan.
3. Every tool using common interceptors now intercepts signal() and sigaction(). For deadly signals signal() and sigaction() called by the user can't override the handlers set by the tools unless handle_segv==0 or allow_user_segv_handler==1.
4. Tools may register callbacks that are called before returning control to REAL(signal) and REAL(sigaction) in the interceptors. The existing signal/sigaction interceptors in TSan and MSan are converted into these callbacks.
5. Parts of use_sigaltstack logic are moved into sanitizer_common, however only ASan can use an alternate stack for signal handling.

http://llvm-reviews.chandlerc.com/D2605

Files:
  interception/interception_linux.cc
  interception/interception_linux.h
  interception/interception.h
  sanitizer_common/tests/CMakeLists.txt
  sanitizer_common/sanitizer_flags.cc
  sanitizer_common/sanitizer_internal_defs.h
  sanitizer_common/sanitizer_common.h
  sanitizer_common/sanitizer_linux.cc
  sanitizer_common/sanitizer_mac.cc
  sanitizer_common/CMakeLists.txt
  sanitizer_common/sanitizer_common_interceptors.inc
  sanitizer_common/sanitizer_posix_libcdep.cc
  sanitizer_common/sanitizer_platform_interceptors.h
  sanitizer_common/sanitizer_platform_limits_posix.h
  sanitizer_common/sanitizer_flags.h
  sanitizer_common/sanitizer_posix.cc
  sanitizer_common/sanitizer_platform_limits_posix.cc
  sanitizer_common/sanitizer_common.cc
  msan/msan_linux.cc
  msan/lit_tests/null_deref.cc
  msan/msan.cc
  msan/msan_interceptors.cc
  msan/msan.h
  asan/asan_interceptors.cc
  asan/asan_flags.h
  asan/asan_rtl.cc
  asan/asan_posix.cc
  asan/asan_internal.h
  asan/asan_interceptors.h
  asan/asan_linux.cc
  asan/asan_mac.cc
  asan/asan_thread.cc
  tsan/lit_tests/sigsuspend.cc
  tsan/lit_tests/null_deref.cc
  tsan/rtl/tsan_defs.h
  tsan/rtl/tsan_interceptors.cc
  tsan/rtl/tsan_platform.h
  tsan/rtl/tsan_rtl.cc
  tsan/rtl/tsan_platform_linux.cc
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D2605.1.patch
Type: text/x-patch
Size: 44079 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140123/0b2663c6/attachment.bin>


More information about the llvm-commits mailing list