-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of #129891 - nikic:naked-no-san, r=jackh726
Do not request sanitizers for naked functions Naked functions can only contain inline asm, so any instrumentation inserted by sanitizers is illegal. Don't request it. Fixes #129224.
- Loading branch information
Showing
2 changed files
with
47 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// Make sure we do not request sanitizers for naked functions. | ||
|
||
//@ only-x86_64 | ||
//@ needs-sanitizer-address | ||
//@ compile-flags: -Zsanitizer=address -Ctarget-feature=-crt-static | ||
|
||
#![crate_type = "lib"] | ||
#![no_std] | ||
#![feature(abi_x86_interrupt, naked_functions)] | ||
|
||
// CHECK: define x86_intrcc void @page_fault_handler(ptr {{.*}}%0, i64 {{.*}}%1){{.*}}#[[ATTRS:[0-9]+]] { | ||
// CHECK-NOT: memcpy | ||
#[naked] | ||
#[no_mangle] | ||
pub extern "x86-interrupt" fn page_fault_handler(_: u64, _: u64) { | ||
unsafe { | ||
core::arch::asm!("ud2", options(noreturn)); | ||
} | ||
} | ||
|
||
// CHECK: #[[ATTRS]] = | ||
// CHECK-NOT: sanitize_address |