Reland '[msan] Intercept dladdr1, and refactor dladdr'
authorThurston Dang <thurston@google.com>
Tue, 11 Jul 2023 16:45:25 +0000 (16:45 +0000)
committerThurston Dang <thurston@google.com>
Tue, 11 Jul 2023 20:05:54 +0000 (20:05 +0000)
commit9095d5c44bf7c36ddc48edb65c6d3a7b4ea8692f
tree4626c184e8c04524e47250d71d692536b979e598
parent4a63264daa5b68210f83c97705db5dc4cf227638
Reland '[msan] Intercept dladdr1, and refactor dladdr'

Relanding with #if SANITIZER_GLIBC to avoid breaking FreeBSD.
Also incorporates Arthur's BUILD.gn fix (thanks!) from https://reviews.llvm.org/rGc1e283851772ba494113311405d48cfb883751d1

Original commit message:
This patch adds an msan interceptor for dladdr1 (with support for RTLD_DL_LINKMAP and RTLD_DL_SYMENT) and an accompanying test. It also adds a helper file, msan_dl.cpp, that contains UnpoisonDllAddrInfo (refactored out of the dladdr interceptor) and UnpoisonDllAddr1ExtraInfo.

Reviewed By: vitalybuka

Differential Revision: https://reviews.llvm.org/D154272
compiler-rt/lib/msan/CMakeLists.txt
compiler-rt/lib/msan/msan_dl.cpp [new file with mode: 0644]
compiler-rt/lib/msan/msan_dl.h [new file with mode: 0644]
compiler-rt/lib/msan/msan_interceptors.cpp
compiler-rt/test/msan/dladdr1_test.c [new file with mode: 0644]
llvm/utils/gn/secondary/compiler-rt/lib/msan/BUILD.gn