llvm-project/compiler-rt/test/sanitizer_common/TestCases
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
..
Darwin [TSan] Revert removal of ignore_interceptors_accesses flag 2020-06-08 12:35:43 -07:00
FreeBSD compiler-rt: Rename cc files below test/sanitizer_common to cpp 2019-08-05 13:57:03 +00:00
Linux [asan][tsan] Mark tests failing with debug checks as XFAIL 2020-08-03 10:51:35 +01:00
NetBSD compiler-rt: Rename cc files below test/sanitizer_common to cpp 2019-08-05 13:57:03 +00:00
Posix Fix qsort() interceptor for FreeBSD 2020-08-06 09:15:56 +01:00
allocator_returns_null.cpp compiler-rt: Rename cc files below test/sanitizer_common to cpp 2019-08-05 13:57:03 +00:00
corelimit.cpp compiler-rt: Rename cc files below test/sanitizer_common to cpp 2019-08-05 13:57:03 +00:00
ctype.c Correct ctype(3) functions with NLS on NetBSD 2018-02-24 01:01:14 +00:00
fopen_nullptr.c
get_module_and_offset_for_pc.cpp compiler-rt: Rename cc files below test/sanitizer_common to cpp 2019-08-05 13:57:03 +00:00
hard_rss_limit_mb_test.cpp compiler-rt: Rename cc files below test/sanitizer_common to cpp 2019-08-05 13:57:03 +00:00
malloc_hook.cpp compiler-rt: Rename cc files below test/sanitizer_common to cpp 2019-08-05 13:57:03 +00:00
max_allocation_size.cpp [sanitizer_common] Create max_allocation_size_mb flag. 2019-10-30 11:26:05 -07:00
onprint.cpp [sanitizer_common] Disable onprint.cpp on Android. 2019-10-02 21:38:22 +00:00
options-help.cpp [SanitizerCommon] Print the current value of options when printing out help. 2019-11-14 14:04:34 -08:00
options-include.cpp compiler-rt: Rename cc files below test/sanitizer_common to cpp 2019-08-05 13:57:03 +00:00
options-invalid.cpp compiler-rt: Rename cc files below test/sanitizer_common to cpp 2019-08-05 13:57:03 +00:00
print-stack-trace.cpp compiler-rt: Rename cc files below test/sanitizer_common to cpp 2019-08-05 13:57:03 +00:00
printf-ldbl.c
pthread_mutexattr_get.cpp compiler-rt: Rename cc files below test/sanitizer_common to cpp 2019-08-05 13:57:03 +00:00
reallocarray-overflow.cpp compiler-rt: Rename cc files below test/sanitizer_common to cpp 2019-08-05 13:57:03 +00:00
sanitizer_coverage_allowlist_blocklist.cpp [SanitizeCoverage] Rename -fsanitize-coverage-{white,black}list to -fsanitize-coverage-{allow,block}list 2020-06-19 22:22:47 -07:00
sanitizer_coverage_inline8bit_counter.cpp [Clang][Driver] Add Bounds and Thread to SupportsCoverage list 2020-05-26 13:36:21 -07:00
sanitizer_coverage_inline_bool_flag.cpp [Clang][Driver] Add Bounds and Thread to SupportsCoverage list 2020-05-26 13:36:21 -07:00
sanitizer_coverage_no_prune.cpp [Clang][Driver] Add Bounds and Thread to SupportsCoverage list 2020-05-26 13:36:21 -07:00
sanitizer_coverage_stack_depth.cpp [Clang][Driver] Add Bounds and Thread to SupportsCoverage list 2020-05-26 13:36:21 -07:00
sanitizer_coverage_symbolize.cpp compiler-rt: Rename cc files below test/sanitizer_common to cpp 2019-08-05 13:57:03 +00:00
sanitizer_coverage_trace_pc_guard-dso.cpp compiler-rt: Rename cc files below test/sanitizer_common to cpp 2019-08-05 13:57:03 +00:00
sanitizer_coverage_trace_pc_guard-init.cpp [Clang][Driver] Add Bounds and Thread to SupportsCoverage list 2020-05-26 13:36:21 -07:00
sanitizer_coverage_trace_pc_guard.cpp compiler-rt: Rename cc files below test/sanitizer_common to cpp 2019-08-05 13:57:03 +00:00
scanf-ldbl.c
strcasestr.c [CMake] Use normalized Windows target triples 2018-08-09 02:16:18 +00:00
strcspn.c
strnlen.c
strpbrk.c
strspn.c
strstr.c
symbolize_debug_argv.cpp [Sanitizer Common] Show command used to launch symbolizer process at high verbosity level. 2020-04-13 13:36:29 -07:00
symbolize_pc.cpp compiler-rt: Rename cc files below test/sanitizer_common to cpp 2019-08-05 13:57:03 +00:00
symbolize_pc_inline.cpp compiler-rt: Rename cc files below test/sanitizer_common to cpp 2019-08-05 13:57:03 +00:00
symbolize_stack.cpp compiler-rt: Rename cc files below test/sanitizer_common to cpp 2019-08-05 13:57:03 +00:00
wcrtomb.c [Sanitizer] Fix a possible write to freed memory in the wcrtomb interceptor 2019-04-08 08:39:50 +00:00
wctomb.c [Sanitizer] Add interceptor for wctomb 2019-03-29 08:39:03 +00:00