Use asm_cfg in probestack
cc https://www.github.com/rust-lang/rust/issues/140364
This commit is contained in:
parent
9f4670fd2b
commit
962ff16101
2 changed files with 13 additions and 23 deletions
|
|
@ -7,6 +7,7 @@
|
|||
#![feature(compiler_builtins)]
|
||||
#![feature(core_intrinsics)]
|
||||
#![feature(linkage)]
|
||||
#![feature(asm_cfg)]
|
||||
#![feature(naked_functions)]
|
||||
#![feature(repr_simd)]
|
||||
#![feature(macro_metavar_expr_concat)]
|
||||
|
|
|
|||
|
|
@ -58,27 +58,6 @@
|
|||
#[unsafe(naked)]
|
||||
#[rustc_std_internal_symbol]
|
||||
pub unsafe extern "custom" fn __rust_probestack() {
|
||||
#[cfg(not(all(target_env = "sgx", target_vendor = "fortanix")))]
|
||||
macro_rules! ret {
|
||||
() => {
|
||||
"ret"
|
||||
};
|
||||
}
|
||||
|
||||
#[cfg(all(target_env = "sgx", target_vendor = "fortanix"))]
|
||||
macro_rules! ret {
|
||||
// for this target, [manually patch for LVI].
|
||||
//
|
||||
// [manually patch for LVI]: https://software.intel.com/security-software-guidance/insights/deep-dive-load-value-injection#specialinstructions
|
||||
() => {
|
||||
"
|
||||
pop %r11
|
||||
lfence
|
||||
jmp *%r11
|
||||
"
|
||||
};
|
||||
}
|
||||
|
||||
core::arch::naked_asm!(
|
||||
"
|
||||
.cfi_startproc
|
||||
|
|
@ -128,8 +107,18 @@ pub unsafe extern "custom" fn __rust_probestack() {
|
|||
.cfi_def_cfa_register %rsp
|
||||
.cfi_adjust_cfa_offset -8
|
||||
",
|
||||
ret!(),
|
||||
"
|
||||
#[cfg(not(all(target_env = "sgx", target_vendor = "fortanix")))]
|
||||
" ret",
|
||||
#[cfg(all(target_env = "sgx", target_vendor = "fortanix"))]
|
||||
"
|
||||
// for this target, [manually patch for LVI].
|
||||
//
|
||||
// [manually patch for LVI]: https://software.intel.com/security-software-guidance/insights/deep-dive-load-value-injection#specialinstructions
|
||||
pop %r11
|
||||
lfence
|
||||
jmp *%r11
|
||||
",
|
||||
"
|
||||
.cfi_endproc
|
||||
",
|
||||
options(att_syntax)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue