llvm-project/compiler-rt/lib
Alex Richardson ad294e572b [sanitizers] Fix interception of GLibc regexec
Previously, on GLibc systems, the interceptor was calling __compat_regexec
(regexec@GLIBC_2.2.5) insead of the newer __regexec (regexec@GLIBC_2.3.4).
The __compat_regexec strips the REG_STARTEND flag but does not report an
error if other flags are present. This can result in infinite loops for
programs that use REG_STARTEND to find all matches inside a buffer (since
ignoring REG_STARTEND means that the search always starts from the first
character).

The underlying issue is that GLibc's dlsym(RTLD_NEXT, ...) appears to
always return the oldest versioned symbol instead of the default. This
means it does not match the behaviour of dlsym(RTLD_DEFAULT, ...) or the
behaviour documented in the manpage.

It appears a similar issue was encountered with realpath and worked around
in 77ef78a0a5.

See also https://sourceware.org/bugzilla/show_bug.cgi?id=14932 and
https://sourceware.org/bugzilla/show_bug.cgi?id=1319.

Fixes https://github.com/google/sanitizers/issues/1371

Reviewed By: #sanitizers, vitalybuka, marxin

Differential Revision: https://reviews.llvm.org/D96348
2021-03-08 10:53:55 +00:00
..
BlocksRuntime
asan [sanitizers] Fix interception of GLibc regexec 2021-03-08 10:53:55 +00:00
builtins [CMake][compiler-rt] Use copying instead of symlinking for LSE builtins on non-Unix-likes 2021-03-08 09:10:36 +02:00
cfi [sanitizers] Remove unneeded MaybeCall*DefaultOptions() and nullptr checks 2020-09-08 10:12:05 -07:00
crt [RISCV][crt] support building without init_array 2020-12-01 17:17:50 +03:00
dfsan [dfsan] Remove dfsan_get_origin from done_abilist.txt 2021-03-05 17:59:39 -08:00
fuzzer Bugfix for collecting features from very small DSOs. 2021-02-17 13:04:49 -08:00
gwp_asan [GWP-ASan] Change sys/cdefs.h to features.h 2021-02-17 20:03:16 -08:00
hwasan [NFC] Remove tab from the source 2021-02-26 19:40:24 -08:00
interception [sanitizer] Define SANITIZER_GLIBC to refine SANITIZER_LINUX feature detection and support musl 2021-01-06 10:55:40 -08:00
lsan [LSan][RISCV] Enable LSan for RISCV64 2021-01-31 21:53:25 +00:00
memprof [sanitizers] Fix interception of GLibc regexec 2021-03-08 10:53:55 +00:00
msan [sanitizers] Fix interception of GLibc regexec 2021-03-08 10:53:55 +00:00
profile [profile] Delete zero-size dummy sections 2021-02-28 21:07:30 -08:00
safestack compiler-rt: Rename .cc file in lib/{interception/tests,safestack} to .cpp 2019-08-01 13:56:52 +00:00
sanitizer_common [sanitizers] Fix interception of GLibc regexec 2021-03-08 10:53:55 +00:00
scudo [scudo][test] Disable -Wfree-nonheap-object 2021-02-26 11:14:50 -08:00
stats compiler-rt: Rename .cc file in lib/{dfsan,stats,ubsan_minimal} to .cpp 2019-08-01 12:41:23 +00:00
tsan [sanitizers] Fix interception of GLibc regexec 2021-03-08 10:53:55 +00:00
ubsan [ubsan] support print_module_map flag in standalone mode 2021-03-05 13:59:56 -08:00
ubsan_minimal [compiler-rt] Suppress -Wunused-result due to ::write when _FORTIFY_SOURCE>0 in glibc 2020-10-12 09:57:12 -07:00
xray [XRay][compiler-rt][x86_64] Fix CFI directives in assembly trampolines 2021-03-06 10:38:27 -08:00
CMakeLists.txt [MemProf] Decouple memprof build from COMPILER_RT_BUILD_SANITIZERS 2020-10-26 13:52:50 -07:00