-
-
Notifications
You must be signed in to change notification settings - Fork 14.9k
Add -Zsanitize=kernel-hwaddress
#153049
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add -Zsanitize=kernel-hwaddress
#153049
Changes from 4 commits
a197752
e41bbfa
ec03f4e
c679e3d
422906d
4d86840
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
|
|
@@ -1341,6 +1341,7 @@ fn add_sanitizer_libraries( | |||
| if sanitizer.contains(SanitizerSet::LEAK) | ||||
| && !sanitizer.contains(SanitizerSet::ADDRESS) | ||||
| && !sanitizer.contains(SanitizerSet::HWADDRESS) | ||||
| && !sanitizer.contains(SanitizerSet::KERNELHWADDRESS) | ||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
I don't think this is necessary since
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Removed. |
||||
| { | ||||
| link_sanitizer_runtime(sess, flavor, linker, "lsan"); | ||||
| } | ||||
|
|
||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -168,6 +168,7 @@ pub enum Sanitizer { | |
| Dataflow, | ||
| Kcfi, | ||
| KernelAddress, | ||
| KernelHwaddress, | ||
| Leak, | ||
| Memory, | ||
| Memtag, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| // Verifies that HWASAN and KHWASAN emit different assembly instrumentation on AArch64. | ||
| // | ||
| //@ add-minicore | ||
| //@ assembly-output: emit-asm | ||
| //@ revisions: hwasan khwasan | ||
| //@[hwasan] compile-flags: --target aarch64-unknown-linux-gnu -Zsanitizer=hwaddress | ||
| //@[hwasan] needs-llvm-components: aarch64 | ||
| //@[khwasan] compile-flags: --target aarch64-unknown-none -Zsanitizer=kernel-hwaddress | ||
| //@[khwasan] needs-llvm-components: aarch64 | ||
| //@ compile-flags: -Copt-level=1 | ||
|
|
||
| #![crate_type = "lib"] | ||
| #![feature(no_core, lang_items)] | ||
| #![no_core] | ||
|
|
||
| extern crate minicore; | ||
|
|
||
| // hwasan-LABEL: test: | ||
| // hwasan: adrp x{{[0-9]+}}, :gottprel:__hwasan_tls | ||
| // hwasan: mrs x{{[0-9]+}}, TPIDR_EL0 | ||
| // hwasan: bl __hwasan_check_x0_0_short_v2 | ||
|
|
||
| // khwasan-LABEL: test: | ||
| // khwasan-NOT: __hwasan_tls | ||
| // khwasan: orr x{{[0-9]+}}, x0, #0xff00000000000000 | ||
| // khwasan: bl __hwasan_check_x0_67043328_fixed_0_short_v2 | ||
|
|
||
| #[no_mangle] | ||
| pub fn test(b: &mut u8) -> u8 { | ||
| *b | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(commenting on an arbitrary file)
Could you add a section for KernelHwAddressSanitizer to the Unstable Book (in
src/doc/unstable-book/, cc https://doc.rust-lang.org/unstable-book/compiler-flags/sanitizer.html). A stub would be sufficient.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.