mirror of https://github.com/acidanthera/audk.git
MdePkg/BaseLib AARCH64: Make LongJump() BTI compatible
Currently, the AArch64 implementation of LongJump() avoids using the RET instruction to perform the jump, even though the target address is held in the link register X30, as the nature of a long jump implies that the ordinary return address prediction machinery will not be able to make a correct prediction. However, LongJump() is rarely used, and the return stack will be out of sync in any case, so this optimization has little value in practice, and given that indirect calls other than function returns require a BTI landing pad at the call site, this optimization is not compatible with BTI. So let's just use RET instead. Signed-off-by: Ard Biesheuvel <ardb@kernel.org> Reviewed-by: Leif Lindholm <quic_llindhol@quicinc.com> Reviewed-by: Oliver Smith-Denny <osd@smith-denny.com>
This commit is contained in:
parent
ea1312a5b4
commit
e504b3917e
|
@ -85,7 +85,6 @@ ASM_PFX(InternalLongJump):
|
|||
cmp w1, #0
|
||||
mov w0, #1
|
||||
csel w0, w1, w0, ne
|
||||
// use br not ret, as ret is guaranteed to mispredict
|
||||
br x30
|
||||
ret
|
||||
|
||||
ASM_FUNCTION_REMOVE_IF_UNREFERENCED
|
||||
|
|
Loading…
Reference in New Issue