Skip to content

Commit efcef0c

Browse files
committed
More changes to whitespace
1 parent 2dd6026 commit efcef0c

File tree

1 file changed

+48
-48
lines changed

1 file changed

+48
-48
lines changed

compiler-rt/lib/tsan/rtl/tsan_platform_linux.cpp

Lines changed: 48 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -234,63 +234,63 @@ static void ReExecIfNeeded() {
234234
reexec = true;
235235
}
236236

237-
if (!AddressSpaceIsUnlimited()) {
238-
Report(
239-
"WARNING: Program is run with limited virtual address space,"
240-
" which wouldn't work with ThreadSanitizer.\n");
241-
Report("Re-execing with unlimited virtual address space.\n");
242-
SetAddressSpaceUnlimited();
243-
reexec = true;
244-
}
237+
if (!AddressSpaceIsUnlimited()) {
238+
Report(
239+
"WARNING: Program is run with limited virtual address space,"
240+
" which wouldn't work with ThreadSanitizer.\n");
241+
Report("Re-execing with unlimited virtual address space.\n");
242+
SetAddressSpaceUnlimited();
243+
reexec = true;
244+
}
245245

246-
// ASLR personality check.
247-
int old_personality = personality(0xffffffff);
248-
bool aslr_on =
249-
(old_personality != -1) && ((old_personality & ADDR_NO_RANDOMIZE) == 0);
246+
// ASLR personality check.
247+
int old_personality = personality(0xffffffff);
248+
bool aslr_on =
249+
(old_personality != -1) && ((old_personality & ADDR_NO_RANDOMIZE) == 0);
250250

251251
# if SANITIZER_ANDROID && (defined(__aarch64__) || defined(__x86_64__))
252-
// After patch "arm64: mm: support ARCH_MMAP_RND_BITS." is introduced in
253-
// linux kernel, the random gap between stack and mapped area is increased
254-
// from 128M to 36G on 39-bit aarch64. As it is almost impossible to cover
255-
// this big range, we should disable randomized virtual space on aarch64.
252+
// After patch "arm64: mm: support ARCH_MMAP_RND_BITS." is introduced in
253+
// linux kernel, the random gap between stack and mapped area is increased
254+
// from 128M to 36G on 39-bit aarch64. As it is almost impossible to cover
255+
// this big range, we should disable randomized virtual space on aarch64.
256+
if (aslr_on) {
257+
VReport(1,
258+
"WARNING: Program is run with randomized virtual address "
259+
"space, which wouldn't work with ThreadSanitizer on Android.\n"
260+
"Re-execing with fixed virtual address space.\n");
261+
CHECK_NE(personality(old_personality | ADDR_NO_RANDOMIZE), -1);
262+
reexec = true;
263+
}
264+
# endif
265+
266+
if (reexec) {
267+
// Don't check the address space since we're going to re-exec anyway.
268+
} else if (!CheckAndProtect(false, false, false)) {
256269
if (aslr_on) {
270+
// Disable ASLR if the memory layout was incompatible.
271+
// Alternatively, we could just keep re-execing until we get lucky
272+
// with a compatible randomized layout, but the risk is that if it's
273+
// not an ASLR-related issue, we will be stuck in an infinite loop of
274+
// re-execing (unless we change ReExec to pass a parameter of the
275+
// number of retries allowed.)
257276
VReport(1,
258-
"WARNING: Program is run with randomized virtual address "
259-
"space, which wouldn't work with ThreadSanitizer on Android.\n"
260-
"Re-execing with fixed virtual address space.\n");
277+
"WARNING: ThreadSanitizer: memory layout is incompatible, "
278+
"possibly due to high-entropy ASLR.\n"
279+
"Re-execing with fixed virtual address space.\n"
280+
"N.B. reducing ASLR entropy is preferable.\n");
261281
CHECK_NE(personality(old_personality | ADDR_NO_RANDOMIZE), -1);
262282
reexec = true;
283+
} else {
284+
VReport(1,
285+
"FATAL: ThreadSanitizer: memory layout is incompatible, "
286+
"even though ASLR is disabled.\n"
287+
"Please file a bug.\n");
288+
Die();
263289
}
264-
# endif
265-
266-
if (reexec) {
267-
// Don't check the address space since we're going to re-exec anyway.
268-
} else if (!CheckAndProtect(false, false, false)) {
269-
if (aslr_on) {
270-
// Disable ASLR if the memory layout was incompatible.
271-
// Alternatively, we could just keep re-execing until we get lucky
272-
// with a compatible randomized layout, but the risk is that if it's
273-
// not an ASLR-related issue, we will be stuck in an infinite loop of
274-
// re-execing (unless we change ReExec to pass a parameter of the
275-
// number of retries allowed.)
276-
VReport(1,
277-
"WARNING: ThreadSanitizer: memory layout is incompatible, "
278-
"possibly due to high-entropy ASLR.\n"
279-
"Re-execing with fixed virtual address space.\n"
280-
"N.B. reducing ASLR entropy is preferable.\n");
281-
CHECK_NE(personality(old_personality | ADDR_NO_RANDOMIZE), -1);
282-
reexec = true;
283-
} else {
284-
VReport(1,
285-
"FATAL: ThreadSanitizer: memory layout is incompatible, "
286-
"even though ASLR is disabled.\n"
287-
"Please file a bug.\n");
288-
Die();
289-
}
290-
}
290+
}
291291

292-
if (reexec)
293-
ReExec();
292+
if (reexec)
293+
ReExec();
294294
}
295295
# endif
296296

0 commit comments

Comments
 (0)