Skip to content

Commit 9ed898b

Browse files
authored
Rollup merge of #142681 - 1c3t3a:sanitize-off-on, r=rcvalle
Remove the `#[no_sanitize]` attribute in favor of `#[sanitize(xyz = "on|off")]` This came up during the sanitizer stabilization (rust-lang/rust#123617). Instead of a `#[no_sanitize(xyz)]` attribute, we would like to have a `#[sanitize(xyz = "on|off")]` attribute, which is more powerful and allows to be extended in the future (instead of just focusing on turning sanitizers off). The implementation is done according to what was [discussed on Zulip](https://rust-lang.zulipchat.com/#narrow/channel/343119-project-exploit-mitigations/topic/Stabilize.20the.20.60no_sanitize.60.20attribute/with/495377292)). The new attribute also works on modules, traits and impl items and thus enables usage as the following: ```rust #[sanitize(address = "off")] mod foo { fn unsanitized(..) {} #[sanitize(address = "on")] fn sanitized(..) {} } trait MyTrait { #[sanitize(address = "off")] fn unsanitized_default(..) {} } #[sanitize(thread = "off")] impl MyTrait for () { ... } ``` r? ```@rcvalle```
2 parents afc1b6a + 4f35e03 commit 9ed898b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/sanitizers.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ implementation:
4545
[marked][sanitizer-attribute] with appropriate LLVM attribute:
4646
`SanitizeAddress`, `SanitizeHWAddress`, `SanitizeMemory`, or
4747
`SanitizeThread`. By default all functions are instrumented, but this
48-
behaviour can be changed with `#[no_sanitize(...)]`.
48+
behaviour can be changed with `#[sanitize(xyz = "on|off")]`.
4949

5050
* The decision whether to perform instrumentation or not is possible only at a
5151
function granularity. In the cases were those decision differ between

0 commit comments

Comments
 (0)