Skip to content

Commit 930a7c2

Browse files
committed
compiler-rt: re-exec with ASLR disabled when necessary
Some sanitizers (at least msan) currently require ASLR to be disabled. When we detect that ASLR is enabled, re-exec with it disabled rather than exiting with an error. See LLVM GitHub issue 53256 for more detail: llvm/llvm-project#53256 No objection: dim MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D33934
1 parent 96fe7c8 commit 930a7c2

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

contrib/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2197,8 +2197,11 @@ void CheckASLR() {
21972197
}
21982198
if ((aslr_status & PROC_ASLR_ACTIVE) != 0) {
21992199
Printf("This sanitizer is not compatible with enabled ASLR "
2200-
"and binaries compiled with PIE\n");
2201-
Die();
2200+
"and binaries compiled with PIE\n"
2201+
"ASLR will be disabled and the program re-executed.\n");
2202+
int aslr_ctl = PROC_ASLR_FORCE_DISABLE;
2203+
CHECK_NE(procctl(P_PID, 0, PROC_ASLR_CTL, &aslr_ctl), -1);
2204+
ReExec();
22022205
}
22032206
#else
22042207
// Do nothing

0 commit comments

Comments
 (0)