Skip to content

Commit 4e278fc

Browse files
committed
Florian's feedback
1 parent 8b2e5e9 commit 4e278fc

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

compiler-rt/lib/asan/asan_linux.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,12 @@ void ReExecWithoutASLR() {
114114
// this function as a last resort (when the memory mapping is incompatible
115115
// and ASan would fail anyway).
116116
int old_personality = personality(0xffffffff);
117-
bool aslr_on =
118-
(old_personality != -1) && ((old_personality & ADDR_NO_RANDOMIZE) == 0);
117+
if (old_personality == -1) {
118+
VReport(1, "WARNING: unable to run personality check.\n");
119+
return;
120+
}
121+
122+
bool aslr_on = ((old_personality & ADDR_NO_RANDOMIZE) == 0);
119123

120124
if (aslr_on) {
121125
// Disable ASLR if the memory layout was incompatible.

compiler-rt/lib/asan/asan_shadow_setup.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,14 +109,12 @@ void InitializeShadowMemory() {
109109
ProtectGap(kShadowGap2Beg, kShadowGap2End - kShadowGap2Beg + 1);
110110
ProtectGap(kShadowGap3Beg, kShadowGap3End - kShadowGap3Beg + 1);
111111
} else {
112-
# if SANITIZER_LINUX
113112
// The shadow mappings can shadow the entire user address space. However,
114113
// on 32-bit systems, the maximum ASLR entropy (currently up to 16-bits
115114
// == 256MB) is a significant chunk of the address space; reclaiming it by
116115
// disabling ASLR might allow chonky binaries to run.
117116
if (sizeof(uptr) == 32)
118117
TryReExecWithoutASLR();
119-
# endif
120118

121119
Report(
122120
"Shadow memory range interleaves with an existing memory mapping. "

compiler-rt/lib/asan/asan_win.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ uptr __asan_get_shadow_memory_dynamic_address() {
4343
__asan_init();
4444
return __asan_shadow_memory_dynamic_address;
4545
}
46-
4746
} // extern "C"
4847

4948
// ---------------------- Windows-specific interceptors ---------------- {{{

0 commit comments

Comments
 (0)