]>
Commit | Line | Data |
---|---|---|
9ffffee4 FG |
1 | // Verifies that `-Zsanitizer=kernel-address` emits sanitizer instrumentation. |
2 | ||
c620b35d FG |
3 | //@ compile-flags: -Zsanitizer=kernel-address -Copt-level=0 |
4 | //@ revisions: aarch64 riscv64imac riscv64gc x86_64 | |
5 | //@[aarch64] compile-flags: --target aarch64-unknown-none | |
6 | //@[aarch64] needs-llvm-components: aarch64 | |
7 | //@[riscv64imac] compile-flags: --target riscv64imac-unknown-none-elf | |
8 | //@[riscv64imac] needs-llvm-components: riscv | |
9 | //@[riscv64gc] compile-flags: --target riscv64gc-unknown-none-elf | |
10 | //@[riscv64gc] needs-llvm-components: riscv | |
11 | //@[x86_64] compile-flags: --target x86_64-unknown-none | |
12 | //@[x86_64] needs-llvm-components: x86 | |
9ffffee4 FG |
13 | |
14 | #![crate_type = "rlib"] | |
15 | #![feature(no_core, no_sanitize, lang_items)] | |
16 | #![no_core] | |
17 | ||
18 | #[lang = "sized"] | |
19 | trait Sized {} | |
20 | ||
21 | #[lang = "copy"] | |
22 | trait Copy {} | |
23 | ||
24 | impl Copy for u8 {} | |
25 | ||
add651ee | 26 | // CHECK-LABEL: ; kasan_emits_instrumentation::unsanitized |
9ffffee4 FG |
27 | // CHECK-NEXT: ; Function Attrs: |
28 | // CHECK-NOT: sanitize_address | |
29 | // CHECK: start: | |
30 | // CHECK-NOT: call void @__asan_report_load | |
31 | // CHECK: } | |
32 | #[no_sanitize(address)] | |
33 | pub fn unsanitized(b: &mut u8) -> u8 { | |
34 | *b | |
35 | } | |
36 | ||
add651ee | 37 | // CHECK-LABEL: ; kasan_emits_instrumentation::sanitized |
9ffffee4 FG |
38 | // CHECK-NEXT: ; Function Attrs: |
39 | // CHECK: sanitize_address | |
40 | // CHECK: start: | |
41 | // CHECK: call void @__asan_report_load | |
42 | // CHECK: } | |
43 | pub fn sanitized(b: &mut u8) -> u8 { | |
44 | *b | |
45 | } |