Alex Richardson cbcfe28f9d libc/qsort: Don't allow interposing recursive calls
This causes problems when using ASAN with a runtime older than 12.0 since
the intercept does not expect qsort() to call itself using an interposable
function call. This results in infinite recursion and stack exhaustion
when a binary compiled with -fsanitize=address calls qsort.
See also https://bugs.llvm.org/show_bug.cgi?id=46832 and
https://reviews.llvm.org/D84509 (ASAN runtime patch).

To prevent this problem, this patch uses a static helper function
for the actual qsort() implementation. This prevents interposition and
allows for direct calls. As a nice side-effect, we can also move the
qsort_s checks to the top-level function and out of the recursive calls.

Reviewed By:	kib
Differential Revision: https://reviews.freebsd.org/D28133
2021-02-18 14:02:48 +00:00
..
2018-05-29 02:41:32 +00:00
2018-06-13 08:52:17 +00:00
2019-07-17 19:29:55 +00:00
2020-10-16 17:51:09 +00:00
2020-04-10 09:27:18 +00:00
2020-10-17 04:14:38 +00:00
2020-10-17 04:14:38 +00:00
2019-12-04 16:56:11 +00:00
2020-02-20 16:58:19 +00:00