Disable ASLR for unit tests#1996
Open
NickeZ wants to merge 1 commit into
Open
Conversation
Run the build-tree CTest invocation through setarch -R when it is available. This keeps the existing behavior as a fallback on systems without setarch.
8d7575a to
a8b013c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The issue is the ASan runtime interacting badly with high-entropy ASLR / vm.mmap_rnd_bits. ASan reserves large fixed virtual address ranges for shadow memory and allocator metadata. With enough mmap
randomization, a trivial sanitized binary can start in an address range ASan cannot handle, crash during ASan startup, then recurse through ASan’s signal handler and print AddressSanitizer:DEADLYSIGNAL
indefinitely.
Relevant reports:
AddressSanitizer:DEADLYSIGNALloop when using gtest in github CI google/googletest#4491): CI reports of endless AddressSanitizer:DEADLYSIGNALloops even with trivial/no tests.
Local confirmation: a tiny ASan hello-world also loops here, but succeeds under:
setarch "$(uname -m)" -R /tmp/asan-simple
So I changed Makefile so make run-unit-tests runs CTest under setarch -R when available, disabling ASLR only for that test process tree.