[all-commits] [llvm/llvm-project] 0be4c6: [sanitizer_common] Add experimental flag to tweak ...
Thurston Dang via All-commits
all-commits at lists.llvm.org
Thu Nov 9 12:53:20 PST 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 0be4c6b9483594494051e8f1f67afc2b516270ca
https://github.com/llvm/llvm-project/commit/0be4c6b9483594494051e8f1f67afc2b516270ca
Author: Thurston Dang <thurston.dang at gmail.com>
Date: 2023-11-09 (Thu, 09 Nov 2023)
Changed paths:
M compiler-rt/lib/sanitizer_common/CMakeLists.txt
M compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc
A compiler-rt/lib/sanitizer_common/sanitizer_dl.cpp
A compiler-rt/lib/sanitizer_common/sanitizer_dl.h
M compiler-rt/lib/sanitizer_common/sanitizer_flags.inc
A compiler-rt/test/sanitizer_common/TestCases/Linux/replace_dlopen_main_program_test.cpp
M llvm/utils/gn/secondary/compiler-rt/lib/sanitizer_common/BUILD.gn
Log Message:
-----------
[sanitizer_common] Add experimental flag to tweak dlopen(<main program>) (#71715)
This introduces an experimental flag 'test_only_replace_dlopen_main_program'. When enabled, this will replace dlopen(main program,...) with dlopen(NULL,...), which is the correct way to get a handle to the main program.
This can be useful when ASan is statically linked, since dladdr((void*)pthread_join) or similar will return the path to the main program.
Note that dlopen(main program,...) never ends well:
- PIE in recent glibc versions (glibc bugzilla 24323), or non-PIE: return an error
- PIE in current GRTE and older glibc: attempt to load the main program again, leading to reinitializing ASan and failing to remap the shadow memory.
---------
Co-authored-by: Thurston Dang <thurston at google.com>
More information about the All-commits
mailing list