llvm-project/compiler-rt/lib/tsan
Kamil Rytarowski 2fd314e2e2 Correct atexit(3) support in TSan/NetBSD
Summary:
The NetBSD specific implementation of cxa_atexit() does not
preserve the 2nd argument if dso is equal to NULL.

Changes:

 - Split paths of handling intercepted __cxa_atexit() and atexit(3).
   This affects all supported Operating Systems.
 - Add a local stack-like structure to hold the __cxa_atexit() context.
   atexit(3) is documented in the C standard as calling callback from the
   earliest to the oldest entry. This path also fixes potential ABI
   problem of passing an argument to a function from the atexit(3)
   callback mechanism.
 - Add new test to ensure LIFO style of atexit(3) callbacks: atexit3.cc

Proposal to change the behavior of __cxa_atexit() in NetBSD has been rejected.

With the above changes TSan/NetBSD with the current tsan_interceptors.cc
can bootstrap into operation.

Sponsored by <The NetBSD Foundation>

Reviewers: vitalybuka, dvyukov, joerg, kcc, eugenis

Reviewed By: dvyukov

Subscribers: kubamracek, llvm-commits, #sanitizers

Tags: #sanitizers

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

llvm-svn: 317735
2017-11-08 22:34:17 +00:00
..
benchmarks
dd [sanitizer] Move cxx-abi library earlier in link flags. 2017-10-04 23:35:14 +00:00
go Add NetBSD improvements in sanitizers 2017-10-25 17:09:05 +00:00
rtl Correct atexit(3) support in TSan/NetBSD 2017-11-08 22:34:17 +00:00
tests Add NetBSD improvements in sanitizers 2017-10-25 17:09:05 +00:00
.clang-format Tell clang-format that (most) sanitizers are written using Google style guide. 2015-11-19 22:11:10 +00:00
CMakeLists.txt Fix CMake definitions of tsan runtime to make it installed by "install-compiler-rt" 2017-11-04 00:07:20 +00:00
analyze_libtsan.sh [TSan] Slightly improve check_analyze script. 2015-12-07 20:18:50 +00:00
check_analyze.sh [TSan] Update test values 2017-08-18 19:22:39 +00:00
check_cmake.sh tsan: use a different dir for llvm build 2014-10-15 08:56:15 +00:00