Skip to content

Commit ac5d791

Browse files
Julian Lettneryln
authored andcommitted
Fix ignore_noninstrumented_modules on Linux
My initial implementation of `ignore_noninstrumented_modules` for Linux (landed in 6159242) did not consider that the GNU symbol table could be present but empty. "Empty" means: void of real symbol entries, but potential "terminator/placeholder" symbols that are skipped via `header->symoffset`. In this case `last_symbol` is zero and we should avoid computing `chains[last_symbol - header->symoffset]`. This bug seems to only manifest in combination with `LD_PRELOAD` (counterpart of `DYLD_INSERT_LIBRARIES` for Linux) and for small binaries, (e.g., the "not" utility from the llvm test suite) that have segments without any real symbols. This should fix the remaining failing ASan tests on the Swift Linux CI. rdar://57566645 (cherry picked from commit 2fb2445)
1 parent f1a0a3e commit ac5d791

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -621,6 +621,10 @@ class DynamicSegment {
621621
last_symbol = Max(buckets[i], last_symbol);
622622
}
623623

624+
if (last_symbol < header->symoffset) {
625+
return header->symoffset;
626+
}
627+
624628
// Walk the bucket's chain to add the chain length to the total.
625629
uint32_t chain_entry;
626630
do {

0 commit comments

Comments
 (0)