[asan] Print diagnostic if unlimited stack size detected (#133170)

This adds a diagnostic message if the stack size is unlimited. This would have simplified the diagnosis of https://github.com/google/sanitizers/issues/856#issuecomment-2747076811; we anticipate this may help diagnose future issues too.
This commit is contained in:
Thurston Dang
2025-03-27 08:55:36 -07:00
committed by GitHub
parent 64178316cf
commit e5ec87f3b6

View File

@@ -451,6 +451,18 @@ static bool AsanInitInternal() {
DisableCoreDumperIfNecessary();
#if SANITIZER_POSIX
if (StackSizeIsUnlimited()) {
VPrintf(1,
"WARNING: Unlimited stack size detected. This may affect "
"compatibility with the shadow mappings.\n");
// MSan and TSan re-exec with a fixed size stack. We don't do that because
// it may break the program. InitializeShadowMemory() will, if needed,
// re-exec without ASLR, which solves most shadow mapping compatibility
// issues.
}
#endif // SANITIZER_POSIX
InitializeShadowMemory();
AsanTSDInit(PlatformTSDDtor);