llvm-project/compiler-rt/test/sanitizer_common
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
..
TestCases Fix qsort() interceptor for FreeBSD 2020-08-06 09:15:56 +01:00
Unit [compiler-rt] Rename lit.*.cfg.* -> lit.*.cfg.py.* 2019-06-27 20:56:04 +00:00
android_commands Harmonize Python shebang 2020-07-16 21:53:45 +02:00
ios_commands Harmonize Python shebang 2020-07-16 21:53:45 +02:00
netbsd_commands [compiler-rt] [test] Disable MPROTECT on two builtin tests 2019-12-20 17:50:53 +01:00
CMakeLists.txt [compiler-rt] Run cpplint only for check-sanitizer 2019-09-12 01:35:11 +00:00
lit.common.cfg.py [TSan] Revert removal of ignore_interceptors_accesses flag 2020-06-08 12:35:43 -07:00
lit.site.cfg.py.in [compiler-rt] Rename lit.*.cfg.* -> lit.*.cfg.py.* 2019-06-27 20:56:04 +00:00
print_address.h [LSan] Enable for SystemZ 2020-06-16 13:45:29 +02:00
sanitizer_ucontext.h [TSan] Support fiber API on macOS 2019-04-20 00:18:44 +00:00