diff --git a/clang/docs/AddressSanitizer.rst b/clang/docs/AddressSanitizer.rst --- a/clang/docs/AddressSanitizer.rst +++ b/clang/docs/AddressSanitizer.rst @@ -15,7 +15,8 @@ * Out-of-bounds accesses to heap, stack and globals * Use-after-free * Use-after-return (clang flag ``-fsanitize-address-use-after-return=(never|runtime|always)`` default: ``runtime``) - * Enable ``runtime`` with: ``ASAN_OPTIONS=detect_stack_use_after_return=1`` + * Enable with: ``ASAN_OPTIONS=detect_stack_use_after_return=1`` (already enabled on Linux). + * Disable with: ``ASAN_OPTIONS=detect_stack_use_after_return=0``. * Use-after-scope (clang flag ``-fsanitize-address-use-after-scope``) * Double-free, invalid free * Memory leaks (experimental) diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst --- a/clang/docs/ReleaseNotes.rst +++ b/clang/docs/ReleaseNotes.rst @@ -178,7 +178,9 @@ - Improve the dump format, dump both bitwidth(if its a bitfield) and field value. - Remove anonymous tag locations. - Beautify dump format, add indent for nested struct and struct members. -- Enable MSAN_OPTIONS=poison_in_dtor=1 by default. +- Previously disabled sanitizer options now enabled by default: + - ASAN_OPTIONS=detect_stack_use_after_return=1 (only on Linux). + - MSAN_OPTIONS=poison_in_dtor=1. New Compiler Flags ------------------ diff --git a/compiler-rt/lib/asan/asan_flags.inc b/compiler-rt/lib/asan/asan_flags.inc --- a/compiler-rt/lib/asan/asan_flags.inc +++ b/compiler-rt/lib/asan/asan_flags.inc @@ -49,9 +49,10 @@ "to find more errors.") ASAN_FLAG(bool, replace_intrin, true, "If set, uses custom wrappers for memset/memcpy/memmove intrinsics.") -ASAN_FLAG(bool, detect_stack_use_after_return, false, +ASAN_FLAG(bool, detect_stack_use_after_return, + SANITIZER_LINUX && !SANITIZER_ANDROID, "Enables stack-use-after-return checking at run-time.") -ASAN_FLAG(int, min_uar_stack_size_log, 16, // We can't do smaller anyway. +ASAN_FLAG(int, min_uar_stack_size_log, 16, // We can't do smaller anyway. "Minimum fake stack size log.") ASAN_FLAG(int, max_uar_stack_size_log, 20, // 1Mb per size class, i.e. ~11Mb per thread