[PATCH] D124057: [asan] Enable detect_stack_use_after_return=1 by default on Linux

Vitaly Buka via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 28 21:08:34 PDT 2022


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG78582194361e: [asan] Enable detect_stack_use_after_return=1 by default on Linux (authored by vitalybuka).

Changed prior to commit:
  https://reviews.llvm.org/D124057?vs=425433&id=425962#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D124057/new/

https://reviews.llvm.org/D124057

Files:
  clang/docs/AddressSanitizer.rst
  clang/docs/ReleaseNotes.rst
  compiler-rt/lib/asan/asan_flags.inc


Index: compiler-rt/lib/asan/asan_flags.inc
===================================================================
--- compiler-rt/lib/asan/asan_flags.inc
+++ 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
Index: clang/docs/ReleaseNotes.rst
===================================================================
--- clang/docs/ReleaseNotes.rst
+++ 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
 ------------------
Index: clang/docs/AddressSanitizer.rst
===================================================================
--- clang/docs/AddressSanitizer.rst
+++ 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)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D124057.425962.patch
Type: text/x-patch
Size: 2285 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220429/729d24c8/attachment-0001.bin>


More information about the cfe-commits mailing list