CFI improvements to the AArch64 fiber implementation (#4195)
Now the fiber implementation on AArch64 authenticates function return addresses and includes the relevant BTI instructions, except on macOS. Also, change the locations of the saved FP and LR registers on the fiber stack to make them compliant with the Procedure Call Standard for the Arm 64-bit Architecture. Copyright (c) 2022, Arm Limited.
This commit is contained in:
@@ -217,7 +217,23 @@ fn func_signature(
|
||||
// then we can optimize this function to use the fastest calling
|
||||
// convention since it's purely an internal implementation detail of
|
||||
// the module itself.
|
||||
Some(_idx) if !func.is_escaping() => CallConv::Fast,
|
||||
Some(_idx) if !func.is_escaping() => {
|
||||
let on_apple_aarch64 = isa
|
||||
.triple()
|
||||
.default_calling_convention()
|
||||
.unwrap_or(CallingConvention::SystemV)
|
||||
== CallingConvention::AppleAarch64;
|
||||
|
||||
if on_apple_aarch64 {
|
||||
// FIXME: We need an Apple-specific calling convention, so that
|
||||
// Cranelift's ABI implementation generates unwinding directives
|
||||
// about pointer authentication usage, so we can't just use
|
||||
// `CallConv::Fast`.
|
||||
CallConv::WasmtimeAppleAarch64
|
||||
} else {
|
||||
CallConv::Fast
|
||||
}
|
||||
}
|
||||
|
||||
// ... otherwise if it's an imported function or if it's a possibly
|
||||
// exported function then we use the default ABI wasmtime would
|
||||
|
||||
Reference in New Issue
Block a user