From b846b42c8dcf052eabda71d416a986a7891093f7 Mon Sep 17 00:00:00 2001 From: Tomasz Miąsko Date: Sun, 12 Jan 2020 00:00:00 +0000 Subject: Selectively disable sanitizer instrumentation Add `no_sanitize` attribute that allows to opt out from sanitizer instrumentation in an annotated function. --- .../src/language-features/no-sanitize.md | 29 ++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 src/doc/unstable-book/src/language-features/no-sanitize.md (limited to 'src/doc') diff --git a/src/doc/unstable-book/src/language-features/no-sanitize.md b/src/doc/unstable-book/src/language-features/no-sanitize.md new file mode 100644 index 00000000000..28c683934d4 --- /dev/null +++ b/src/doc/unstable-book/src/language-features/no-sanitize.md @@ -0,0 +1,29 @@ +# `no_sanitize` + +The tracking issue for this feature is: [#39699] + +[#39699]: https://github.com/rust-lang/rust/issues/39699 + +------------------------ + +The `no_sanitize` attribute can be used to selectively disable sanitizer +instrumentation in an annotated function. This might be useful to: avoid +instrumentation overhead in a performance critical function, or avoid +instrumenting code that contains constructs unsupported by given sanitizer. + +The precise effect of this annotation depends on particular sanitizer in use. +For example, with `no_sanitize(thread)`, the thread sanitizer will no longer +instrument non-atomic store / load operations, but it will instrument atomic +operations to avoid reporting false positives and provide meaning full stack +traces. + +## Examples + +``` rust +#![feature(no_sanitize)] + +#[no_sanitize(address)] +fn foo() { + // ... +} +``` -- cgit 1.4.1-3-g733a5