Skip to content

Conversation

@yln
Copy link

@yln yln commented Dec 5, 2019

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 19739fe327b3db6bbe4d6a22a5201c013018e032)

@yln yln self-assigned this Dec 5, 2019
@yln
Copy link
Author

yln commented Dec 5, 2019

@swift-ci Please test

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 988adcc)
@yln yln force-pushed the ignore_noninstrumented_modules-elf-symbol-count-2 branch from 563d8ce to 503dba5 Compare December 5, 2019 01:39
@yln
Copy link
Author

yln commented Dec 5, 2019

@swift-ci Please test and merge

@yln
Copy link
Author

yln commented Dec 5, 2019

@swift-ci Please test

@yln
Copy link
Author

yln commented Dec 5, 2019

@swift-ci Please test Linux

@yln
Copy link
Author

yln commented Dec 5, 2019

Fixes the following tests:

AddressSanitizer-x86_64-linux-dynamic :: TestCases/Linux/asan_dlopen_test.cc
AddressSanitizer-x86_64-linux-dynamic :: TestCases/Linux/asan_preload_test-1.cc
AddressSanitizer-x86_64-linux-dynamic :: TestCases/Linux/asan_preload_test-2.cc
AddressSanitizer-x86_64-linux-dynamic :: TestCases/Linux/asan_rt_confict_test-1.cc
AddressSanitizer-x86_64-linux-dynamic :: TestCases/Linux/calloc-preload.c
AddressSanitizer-x86_64-linux-dynamic :: TestCases/Linux/preinstalled_signal.cc

@yln yln merged commit d0a17a3 into apple/stable/20191106 Dec 5, 2019
@yln yln deleted the ignore_noninstrumented_modules-elf-symbol-count-2 branch December 5, 2019 02:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants