r335193 - ASan docs: no_sanitize("address") works on globals.
Evgeniy Stepanov via cfe-commits
cfe-commits at lists.llvm.org
Wed Jun 20 17:16:32 PDT 2018
Author: eugenis
Date: Wed Jun 20 17:16:32 2018
New Revision: 335193
URL: http://llvm.org/viewvc/llvm-project?rev=335193&view=rev
Log:
ASan docs: no_sanitize("address") works on globals.
Summary: Mention that no_sanitize attribute can be used with globals.
Reviewers: alekseyshl
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D48390
Modified:
cfe/trunk/docs/AddressSanitizer.rst
cfe/trunk/include/clang/Basic/AttrDocs.td
Modified: cfe/trunk/docs/AddressSanitizer.rst
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/AddressSanitizer.rst?rev=335193&r1=335192&r2=335193&view=diff
==============================================================================
--- cfe/trunk/docs/AddressSanitizer.rst (original)
+++ cfe/trunk/docs/AddressSanitizer.rst Wed Jun 20 17:16:32 2018
@@ -197,13 +197,17 @@ this purpose.
Disabling Instrumentation with ``__attribute__((no_sanitize("address")))``
--------------------------------------------------------------------------
-Some code should not be instrumented by AddressSanitizer. One may use the
-function attribute ``__attribute__((no_sanitize("address")))`` (which has
-deprecated synonyms `no_sanitize_address` and `no_address_safety_analysis`) to
-disable instrumentation of a particular function. This attribute may not be
-supported by other compilers, so we suggest to use it together with
+Some code should not be instrumented by AddressSanitizer. One may use
+the attribute ``__attribute__((no_sanitize("address")))`` (which has
+deprecated synonyms `no_sanitize_address` and
+`no_address_safety_analysis`) to disable instrumentation of a
+particular function. This attribute may not be supported by other
+compilers, so we suggest to use it together with
``__has_feature(address_sanitizer)``.
+The same attribute used on a global variable prevents AddressSanitizer
+from adding redzones around it and detecting out of bounds accesses.
+
Suppressing Errors in Recompiled Code (Blacklist)
-------------------------------------------------
Modified: cfe/trunk/include/clang/Basic/AttrDocs.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/AttrDocs.td?rev=335193&r1=335192&r2=335193&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/AttrDocs.td (original)
+++ cfe/trunk/include/clang/Basic/AttrDocs.td Wed Jun 20 17:16:32 2018
@@ -1804,13 +1804,14 @@ This attribute accepts a single paramete
def NoSanitizeDocs : Documentation {
let Category = DocCatFunction;
let Content = [{
-Use the ``no_sanitize`` attribute on a function declaration to specify
-that a particular instrumentation or set of instrumentations should not be
-applied to that function. The attribute takes a list of string literals,
-which have the same meaning as values accepted by the ``-fno-sanitize=``
-flag. For example, ``__attribute__((no_sanitize("address", "thread")))``
-specifies that AddressSanitizer and ThreadSanitizer should not be applied
-to the function.
+Use the ``no_sanitize`` attribute on a function or a global variable
+declaration to specify that a particular instrumentation or set of
+instrumentations should not be applied. The attribute takes a list of
+string literals, which have the same meaning as values accepted by the
+``-fno-sanitize=`` flag. For example,
+``__attribute__((no_sanitize("address", "thread")))`` specifies that
+AddressSanitizer and ThreadSanitizer should not be applied to the
+function or variable.
See :ref:`Controlling Code Generation <controlling-code-generation>` for a
full list of supported sanitizer flags.
@@ -1825,9 +1826,9 @@ def NoSanitizeAddressDocs : Documentatio
let Content = [{
.. _langext-address_sanitizer:
-Use ``__attribute__((no_sanitize_address))`` on a function declaration to
-specify that address safety instrumentation (e.g. AddressSanitizer) should
-not be applied to that function.
+Use ``__attribute__((no_sanitize_address))`` on a function or a global
+variable declaration to specify that address safety instrumentation
+(e.g. AddressSanitizer) should not be applied.
}];
}
More information about the cfe-commits
mailing list