llvm-project/compiler-rt/lib/memprof
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
..
CMakeLists.txt [CMake] Remove cxx-headers from runtime deps 2020-10-30 20:03:38 -07:00
README.txt
memprof.syms.extra
memprof_allocator.cpp [compiler-rt santizer] Use clock_gettime instead of timespec_get 2020-12-08 10:10:17 -08:00
memprof_allocator.h
memprof_descriptions.cpp
memprof_descriptions.h
memprof_flags.cpp
memprof_flags.h
memprof_flags.inc
memprof_init_version.h
memprof_interceptors.cpp [sanitizers] Fix interception of GLibc regexec 2021-03-08 10:53:55 +00:00
memprof_interceptors.h [sanitizers] Fix interception of GLibc regexec 2021-03-08 10:53:55 +00:00
memprof_interceptors_memintrinsics.cpp
memprof_interceptors_memintrinsics.h
memprof_interface_internal.h [MemProf] Add interface to dump profile 2020-11-19 10:21:53 -08:00
memprof_internal.h
memprof_linux.cpp [asan][memprof] Declare _DYNAMIC and fix -Wparentheses 2020-12-27 20:28:59 -08:00
memprof_malloc_linux.cpp
memprof_mapping.h [asan][memprof] Declare _DYNAMIC and fix -Wparentheses 2020-12-27 20:28:59 -08:00
memprof_new_delete.cpp
memprof_posix.cpp
memprof_preinit.cpp
memprof_rtl.cpp [compiler-rt santizer] Use clock_gettime instead of timespec_get 2020-12-08 10:10:17 -08:00
memprof_shadow_setup.cpp
memprof_stack.cpp
memprof_stack.h
memprof_stats.cpp
memprof_stats.h
memprof_thread.cpp
memprof_thread.h [memprof] Don't protect destructor in final 2020-11-03 11:33:33 -08:00
weak_symbols.txt

README.txt

MemProfiling RT
================================
This directory contains sources of the MemProfiling (MemProf) runtime library.

Directory structure:
README.txt       : This file.
CMakeLists.txt   : File for cmake-based build.
memprof_*.{cc,h}    : Sources of the memprof runtime library.

Also MemProf runtime needs the following libraries:
lib/interception/      : Machinery used to intercept function calls.
lib/sanitizer_common/  : Code shared between various sanitizers.

MemProf runtime can only be built by CMake. You can run MemProf tests
from the root of your CMake build tree:

make check-memprof