[PATCH] D104155: Add documentation for -fsanitize-address-use-after-return.
Kevin Athey via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Jul 8 16:42:19 PDT 2021
kda updated this revision to Diff 357385.
kda marked an inline comment as done.
kda added a comment.
- removed redundant mention of the flag.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D104155/new/
https://reviews.llvm.org/D104155
Files:
clang/docs/AddressSanitizer.rst
clang/docs/UsersManual.rst
clang/include/clang/Driver/Options.td
Index: clang/include/clang/Driver/Options.td
===================================================================
--- clang/include/clang/Driver/Options.td
+++ clang/include/clang/Driver/Options.td
@@ -1584,7 +1584,7 @@
: Joined<["-"], "fsanitize-address-use-after-return=">,
MetaVarName<"<mode>">,
Flags<[CC1Option]>,
- HelpText<"Select the mode of detecting stack use-after-return in AddressSanitizer">,
+ HelpText<"Select the mode of detecting stack use-after-return in AddressSanitizer: never | runtime (default) | always">,
Group<f_clang_Group>,
Values<"never,runtime,always">,
NormalizedValuesScope<"llvm::AsanDetectStackUseAfterReturnMode">,
Index: clang/docs/UsersManual.rst
===================================================================
--- clang/docs/UsersManual.rst
+++ clang/docs/UsersManual.rst
@@ -3744,6 +3744,8 @@
Enable linker dead stripping of globals in AddressSanitizer
-fsanitize-address-poison-custom-array-cookie
Enable poisoning array cookies when using custom operator new[] in AddressSanitizer
+ -fsanitize-address-use-after-return=<mode>
+ Select the mode of detecting stack use-after-return in AddressSanitizer: never | runtime (default) | always
-fsanitize-address-use-after-scope
Enable use-after-scope detection in AddressSanitizer
-fsanitize-address-use-odr-indicator
Index: clang/docs/AddressSanitizer.rst
===================================================================
--- clang/docs/AddressSanitizer.rst
+++ clang/docs/AddressSanitizer.rst
@@ -14,8 +14,9 @@
* Out-of-bounds accesses to heap, stack and globals
* Use-after-free
-* Use-after-return (runtime flag `ASAN_OPTIONS=detect_stack_use_after_return=1`)
-* Use-after-scope (clang flag `-fsanitize-address-use-after-scope`)
+* 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``
+* Use-after-scope (clang flag ``-fsanitize-address-use-after-scope``)
* Double-free, invalid free
* Memory leaks (experimental)
@@ -136,6 +137,26 @@
Note that this option is not supported on macOS.
+Stack Use After Return (UAR)
+----------------------------
+
+AddressSanitizer can optionally detect stack use after return problems.
+This is available by default, or explicitly
+(``-fsanitize-address-use-after-return=runtime``).
+To enable this check at runtime, set the environment variable
+``ASAN_OPTIONS=detect_stack_use_after_return=1``.
+
+Enabling this check (``-fsanitize-address-use-after-return=always``) will
+reduce code size. The code size may be reduced further by completely
+eliminating this check (``-fsanitize-address-use-after-return=never``).
+
+To summarize: ``-fsanitize-address-use-after-return=<mode>``
+ * ``never``: Completely disables detection of UAR errors (reduces code size).
+ * ``runtime``: Adds the code for detection, but must be enabled via the
+ runtime environment (``ASAN_OPTIONS=detect_stack_use_after_return=1``).
+ * ``always``: Enables detection of UAR errors in all cases. (reduces code
+ size, but not as much as ``never``).
+
Memory leak detection
---------------------
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D104155.357385.patch
Type: text/x-patch
Size: 3346 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210708/8472854f/attachment.bin>
More information about the cfe-commits
mailing list