Skip to content

[tsan] Change personality CHECK to Printf() + Die() #142821

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 4, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 21 additions & 2 deletions compiler-rt/lib/tsan/rtl/tsan_platform_linux.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,15 @@ static void ReExecIfNeeded(bool ignore_heap) {
"WARNING: Program is run with randomized virtual address "
"space, which wouldn't work with ThreadSanitizer on Android.\n"
"Re-execing with fixed virtual address space.\n");
CHECK_NE(personality(old_personality | ADDR_NO_RANDOMIZE), -1);

if (personality(old_personality | ADDR_NO_RANDOMIZE) == -1) {
Printf(
"FATAL: ThreadSanitizer: unable to disable ASLR (perhaps "
"sandboxing is enabled?).\n");
Printf("FATAL: Please rerun without sandboxing and/or ASLR.\n");
Die();
}

reexec = true;
}
# endif
Expand Down Expand Up @@ -287,7 +295,18 @@ static void ReExecIfNeeded(bool ignore_heap) {
"possibly due to high-entropy ASLR.\n"
"Re-execing with fixed virtual address space.\n"
"N.B. reducing ASLR entropy is preferable.\n");
CHECK_NE(personality(old_personality | ADDR_NO_RANDOMIZE), -1);

if (personality(old_personality | ADDR_NO_RANDOMIZE) == -1) {
Printf(
"FATAL: ThreadSanitizer: encountered an incompatible memory "
"layout but was unable to disable ASLR (perhaps sandboxing is "
"enabled?).\n");
Printf(
"FATAL: Please rerun with lower ASLR entropy, ASLR disabled, "
"and/or sandboxing disabled.\n");
Die();
}

reexec = true;
} else {
Printf(
Expand Down
Loading