Skip to content

Commit 2fb2445

Browse files
Julian Lettneryln
Julian Lettner
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
1 parent bb745a0 commit 2fb2445

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cc

+4
Original file line numberDiff line numberDiff line change
@@ -629,6 +629,10 @@ class DynamicSegment {
629629
last_symbol = Max(buckets[i], last_symbol);
630630
}
631631

632+
if (last_symbol < header->symoffset) {
633+
return header->symoffset;
634+
}
635+
632636
// Walk the bucket's chain to add the chain length to the total.
633637
uint32_t chain_entry;
634638
do {

0 commit comments

Comments
 (0)