[compiler-rt] 781cb10 - [TSan] fix the module map of main executable on darwin platforms (#107227)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 26 00:22:19 PDT 2024
Author: pudge62
Date: 2024-09-26T00:22:14-07:00
New Revision: 781cb10f33beb9a829857de41827c0e4ff83bb32
URL: https://github.com/llvm/llvm-project/commit/781cb10f33beb9a829857de41827c0e4ff83bb32
DIFF: https://github.com/llvm/llvm-project/commit/781cb10f33beb9a829857de41827c0e4ff83bb32.diff
LOG: [TSan] fix the module map of main executable on darwin platforms (#107227)
In the executable image on Darwin platforms, there is a `__PAGEZERO`
segment with a size of 0. When calculating the module map, this segment
must be skipped to avoid errors. The previous implementation
inaccurately calculated the executable image's range, starting the
address at `0 + slide`.
Added:
Modified:
compiler-rt/lib/sanitizer_common/sanitizer_procmaps_mac.cpp
Removed:
################################################################################
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_procmaps_mac.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_procmaps_mac.cpp
index b44e016a0e5bc6..5ff8d1832556fd 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_procmaps_mac.cpp
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_procmaps_mac.cpp
@@ -433,7 +433,9 @@ void MemoryMappingLayout::DumpListOfModules(
MemoryMappedSegmentData data;
segment.data_ = &data;
while (Next(&segment)) {
- if (segment.filename[0] == '\0') continue;
+ // skip the __PAGEZERO segment, its vmsize is 0
+ if (segment.filename[0] == '\0' || (segment.start == segment.end))
+ continue;
LoadedModule *cur_module = nullptr;
if (!modules->empty() &&
0 == internal_strcmp(segment.filename, modules->back().full_name())) {
More information about the llvm-commits
mailing list