Skip to content

Commit cb96408

Browse files
murzinvchazy
authored andcommitted
arm64: KVM: VHE: reset PSTATE.PAN on entry to EL2
SCTLR_EL2.SPAN bit controls what happens with the PSTATE.PAN bit on an exception. However, this bit has no effect on the PSTATE.PAN when HCR_EL2.E2H or HCR_EL2.TGE is unset. Thus when VHE is used and exception taken from a guest PSTATE.PAN bit left unchanged and we continue with a value guest has set. To address that always reset PSTATE.PAN on entry from EL1. Fixes: 1f364c8 ("arm64: VHE: Add support for running Linux in EL2 mode") Signed-off-by: Vladimir Murzin <[email protected]> Reviewed-by: James Morse <[email protected]> Acked-by: Marc Zyngier <[email protected]> Cc: <[email protected]> # v4.6+ Signed-off-by: Christoffer Dall <[email protected]>
1 parent cf0ba18 commit cb96408

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

arch/arm64/kvm/hyp/entry.S

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,8 @@ ENTRY(__guest_exit)
9696

9797
add x1, x1, #VCPU_CONTEXT
9898

99+
ALTERNATIVE(nop, SET_PSTATE_PAN(1), ARM64_HAS_PAN, CONFIG_ARM64_PAN)
100+
99101
// Store the guest regs x2 and x3
100102
stp x2, x3, [x1, #CPU_XREG_OFFSET(2)]
101103

0 commit comments

Comments
 (0)