Skip to content

Commit 781cb10

Browse files
authored
[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`.
1 parent 571a867 commit 781cb10

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

compiler-rt/lib/sanitizer_common/sanitizer_procmaps_mac.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,9 @@ void MemoryMappingLayout::DumpListOfModules(
433433
MemoryMappedSegmentData data;
434434
segment.data_ = &data;
435435
while (Next(&segment)) {
436-
if (segment.filename[0] == '\0') continue;
436+
// skip the __PAGEZERO segment, its vmsize is 0
437+
if (segment.filename[0] == '\0' || (segment.start == segment.end))
438+
continue;
437439
LoadedModule *cur_module = nullptr;
438440
if (!modules->empty() &&
439441
0 == internal_strcmp(segment.filename, modules->back().full_name())) {

0 commit comments

Comments
 (0)