Skip to content

Commit 655169c

Browse files
author
Marc Zyngier
committed
KVM: arm64: Check HCR_EL2 instead of shadow copy to swap PtrAuth registers
When save/restoring PtrAuth registers between host and guest, it is pretty useless to fetch the in-memory state, while we have the right state in the HCR_EL2 system register. Use that instead. Acked-by: Mark Rutland <[email protected]> Signed-off-by: Marc Zyngier <[email protected]>
1 parent aff7cce commit 655169c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

arch/arm64/include/asm/kvm_ptrauth.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ alternative_if_not ARM64_HAS_ADDRESS_AUTH_IMP_DEF
7474
b 1001f
7575
alternative_else_nop_endif
7676
1000:
77-
ldr \reg1, [\g_ctxt, #(VCPU_HCR_EL2 - VCPU_CONTEXT)]
77+
mrs \reg1, hcr_el2
7878
and \reg1, \reg1, #(HCR_API | HCR_APK)
7979
cbz \reg1, 1001f
8080
add \reg1, \g_ctxt, #CPU_APIAKEYLO_EL1
@@ -90,7 +90,7 @@ alternative_if_not ARM64_HAS_ADDRESS_AUTH_IMP_DEF
9090
b 2001f
9191
alternative_else_nop_endif
9292
2000:
93-
ldr \reg1, [\g_ctxt, #(VCPU_HCR_EL2 - VCPU_CONTEXT)]
93+
mrs \reg1, hcr_el2
9494
and \reg1, \reg1, #(HCR_API | HCR_APK)
9595
cbz \reg1, 2001f
9696
add \reg1, \g_ctxt, #CPU_APIAKEYLO_EL1

0 commit comments

Comments
 (0)