Skip to content

Commit e5ec87f

Browse files
authored
[asan] Print diagnostic if unlimited stack size detected (llvm#133170)
This adds a diagnostic message if the stack size is unlimited. This would have simplified the diagnosis of google/sanitizers#856 (comment); we anticipate this may help diagnose future issues too.
1 parent 6417831 commit e5ec87f

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

compiler-rt/lib/asan/asan_rtl.cpp

+12
Original file line numberDiff line numberDiff line change
@@ -451,6 +451,18 @@ static bool AsanInitInternal() {
451451

452452
DisableCoreDumperIfNecessary();
453453

454+
#if SANITIZER_POSIX
455+
if (StackSizeIsUnlimited()) {
456+
VPrintf(1,
457+
"WARNING: Unlimited stack size detected. This may affect "
458+
"compatibility with the shadow mappings.\n");
459+
// MSan and TSan re-exec with a fixed size stack. We don't do that because
460+
// it may break the program. InitializeShadowMemory() will, if needed,
461+
// re-exec without ASLR, which solves most shadow mapping compatibility
462+
// issues.
463+
}
464+
#endif // SANITIZER_POSIX
465+
454466
InitializeShadowMemory();
455467

456468
AsanTSDInit(PlatformTSDDtor);

0 commit comments

Comments
 (0)