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
..
2021-01-31 16:07:20 +00:00
2020-10-09 19:12:44 +00:00
2020-04-30 22:08:40 +00:00
2021-02-15 20:23:32 +01:00
2018-10-20 22:39:35 +00:00
2020-04-30 22:08:40 +00:00
2019-09-02 01:55:55 +00:00
2020-12-16 09:02:09 +00:00
2020-04-30 22:08:40 +00:00
2021-02-14 18:16:58 -08:00
2019-12-11 17:37:53 +00:00