llvm-project/compiler-rt/test
Alex Richardson 8803ebcf3b Fix qsort() interceptor for FreeBSD
When the FreeBSD qsort() implementation recurses, it does so using an
interposable function call, so we end up calling the interceptor again
and set the saved comparator to wrapped_qsort_compar. This results in an
infinite loop and a eventually a stack overflow since wrapped_qsort_compar
ends up calling itself. This means that ASAN is completely broken on
FreeBSD for programs that call qsort(). I found this while running
check-all on a FreeBSD system a ASAN-instrumented LLVM.

Fix this by checking whether we are recursing inside qsort before writing
to qsort_compar. The same bug exists in the qsort_r interceptor, so use the
same approach there. I did not test the latter since the qsort_r function
signature does not match and therefore it's not intercepted on FreeBSD/macOS.

Fixes https://llvm.org/PR46832

Reviewed By: eugenis

Differential Revision: https://reviews.llvm.org/D84509
2020-08-06 09:15:56 +01:00
..
BlocksRuntime Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
asan [ASan][Darwin] Adapt test for macOS 11+ version scheme 2020-08-05 10:14:57 -07:00
builtins [builtins][ARM] Replace call_apsr.S with inline asm 2020-07-13 16:53:07 -07:00
cfi [cfi][test] cross-dso/stats.cpp: don't assume the order of static constructors 2020-01-08 15:50:51 -08:00
crt [compiler-rt] Better Windows support for running tests in external shell 2020-07-09 19:40:22 +03:00
dfsan [DFSan] Add efficient fast16labels instrumentation mode. 2020-07-29 18:58:47 +00:00
fuzzer [libFuzzer] Enable for SystemZ 2020-08-04 21:53:27 +02:00
gwp_asan [GWP-ASan] Split the unwinder into segv/non-segv. 2020-07-21 08:25:37 -07:00
hwasan [HWASan] [GlobalISel] Add +tagged-globals backend feature for GlobalISel 2020-08-03 14:28:44 -07:00
interception [compiler-rt] Rename lit.*.cfg.* -> lit.*.cfg.py.* 2019-06-27 20:56:04 +00:00
lsan [lsan] Fix SyntaxWarning: "is" with a literal 2020-07-17 02:21:18 -07:00
msan [msan] Compile the libatomic.c test with a C compiler 2020-08-03 10:51:35 +01:00
profile [profile] Remove dependence on getpagesize from InstrProfilingBuffer.c.o 2020-07-30 16:22:40 -07:00
safestack compiler-rt: Remove .cc from all lit config files 2019-08-05 19:25:35 +00:00
sanitizer_common Fix qsort() interceptor for FreeBSD 2020-08-06 09:15:56 +01:00
scudo [compiler-rt][scudo][LIT] Use target_suffix instead of target-arch 2020-05-20 03:34:50 +00:00
shadowcallstack compiler-rt: Remove .cc from all lit config files 2019-08-05 19:25:35 +00:00
tsan [tsan] Fixup for 1260a155: Move variadic-open.cpp test into Darwin/ directory 2020-07-30 09:32:51 -07:00
ubsan [UBSan] Increase robustness of tests 2020-08-03 15:26:58 -07:00
ubsan_minimal [UBSan][clang][compiler-rt] Applying non-zero offset to nullptr is undefined behaviour 2019-10-10 09:25:02 +00:00
xray [xray] Option to omit the function index 2020-06-17 13:49:01 -04:00
.clang-format [compiler-rt] Use "ColumnLimit: 0" instead of "clang-format off" in tests 2018-12-01 01:24:29 +00:00
CMakeLists.txt [compiler-rt] Disable fuzzer large.test when LLVM_ENABLE_EXPENSIVE_CHECKS=ON 2019-12-03 14:37:37 -08:00
lit.common.cfg.py Reland "[compiler-rt] [test] Allow expanding lit substitutions recursively" 2020-07-27 23:43:50 +03:00
lit.common.configured.in [CMake] Simplify CMake handling for zlib 2020-08-05 16:07:11 -07:00