Skip to content

Commit

Permalink
Fix ignore_noninstrumented_modules on Linux
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Julian Lettner committed Dec 5, 2019
1 parent bb745a0 commit 988adcc
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cc
Original file line number Diff line number Diff line change
Expand Up @@ -629,6 +629,10 @@ class DynamicSegment {
last_symbol = Max(buckets[i], last_symbol);
}

if (last_symbol < header->symoffset) {
return header->symoffset;
}

// Walk the bucket's chain to add the chain length to the total.
uint32_t chain_entry;
do {
Expand Down

0 comments on commit 988adcc

Please sign in to comment.