[all-commits] [llvm/llvm-project] ad294e: [sanitizers] Fix interception of GLibc regexec
Alexander Richardson via All-commits
all-commits at lists.llvm.org
Mon Mar 8 02:54:27 PST 2021
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: ad294e572bc5c16f9dc420cc994322de6ca3fbfb
https://github.com/llvm/llvm-project/commit/ad294e572bc5c16f9dc420cc994322de6ca3fbfb
Author: Alex Richardson <Alexander.Richardson at cl.cam.ac.uk>
Date: 2021-03-08 (Mon, 08 Mar 2021)
Changed paths:
M compiler-rt/lib/asan/asan_interceptors.cpp
M compiler-rt/lib/asan/asan_interceptors.h
M compiler-rt/lib/memprof/memprof_interceptors.cpp
M compiler-rt/lib/memprof/memprof_interceptors.h
M compiler-rt/lib/msan/msan_interceptors.cpp
M compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc
M compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp
A compiler-rt/test/sanitizer_common/TestCases/Posix/regex_startend.cpp
Log Message:
-----------
[sanitizers] Fix interception of GLibc regexec
Previously, on GLibc systems, the interceptor was calling __compat_regexec
(regexec at GLIBC_2.2.5) insead of the newer __regexec (regexec at 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 77ef78a0a5dbaa364529bd05ed7a7bd9a71dd8d4.
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
More information about the All-commits
mailing list