[all-commits] [llvm/llvm-project] 71a5f8: [compiler-rt] [sanitizer_common] Fix SIGSEGV in Fo...
Mike Kruskal via All-commits
all-commits at lists.llvm.org
Mon Jul 13 16:58:04 PDT 2026
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 71a5f82e6dcd2d544d594c21a0bebb35af621ee5
https://github.com/llvm/llvm-project/commit/71a5f82e6dcd2d544d594c21a0bebb35af621ee5
Author: Mike Kruskal <mkruskal at google.com>
Date: 2026-07-13 (Mon, 13 Jul 2026)
Changed paths:
M compiler-rt/lib/sanitizer_common/sanitizer_common_nolibc.cpp
M compiler-rt/lib/sanitizer_common/sanitizer_dl.cpp
M compiler-rt/lib/sanitizer_common/sanitizer_dl.h
M compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp
M compiler-rt/lib/tsan/go/buildgo.sh
M compiler-rt/test/sanitizer_common/TestCases/Linux/dlopen_image_base.c
Log Message:
-----------
[compiler-rt] [sanitizer_common] Fix SIGSEGV in ForEachMappedRegion for DSOs with custom image base (#206299)
`ForEachMappedRegion` processes dynamic linker map entries to track
loaded segments. However, it assumes map->l_addr is the address of the
ELF header. For DSOs linked with a custom preferred image base offset
(e.g. -Wl,--image-base=0x4000000), `map->l_addr` contains the relocation
bias: `map->l_addr = actual_load_address - preferred_base`
In this case, map->l_addr points below the first loaded segment in
unmapped or PROT_NONE memory. Doing a read dereference at this address
triggers a SIGSEGV. Add a call to dladdr() on the dynamic section
pointer map->l_ld to obtain the true ELF header base address.
Likely fixes #84482 - which looks like the exact same stacktrace I was
debugging that led me to this fix
Also looks it may have shown up in #21068 - my case was also flaky, and
it only shows up if you build the so with custom base address
Assisted-by: Gemini
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list