From: Vladimir Murzin Date: Thu, 1 Sep 2016 14:29:03 +0000 (+0100) Subject: arm64: KVM: VHE: reset PSTATE.PAN on entry to EL2 X-Git-Tag: v4.8.5~51 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=aa8f9876b8029372191ca3687d8a188975adc74c;p=thirdparty%2Fkernel%2Fstable.git arm64: KVM: VHE: reset PSTATE.PAN on entry to EL2 commit cb96408da4e11698674abd04aeac941c1bed2038 upstream. 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: 1f364c8c48a0 ("arm64: VHE: Add support for running Linux in EL2 mode") Signed-off-by: Vladimir Murzin Reviewed-by: James Morse Acked-by: Marc Zyngier Signed-off-by: Christoffer Dall [ rebased for v4.7+ ] Signed-off-by: Greg Kroah-Hartman --- diff --git a/arch/arm64/kvm/hyp/entry.S b/arch/arm64/kvm/hyp/entry.S index ce9e5e5f28cfb..eaf08d3abbef0 100644 --- a/arch/arm64/kvm/hyp/entry.S +++ b/arch/arm64/kvm/hyp/entry.S @@ -98,6 +98,8 @@ ENTRY(__guest_exit) // x4-x29,lr: vcpu regs // vcpu x0-x3 on the stack + ALTERNATIVE(nop, SET_PSTATE_PAN(1), ARM64_HAS_PAN, CONFIG_ARM64_PAN) + add x2, x0, #VCPU_CONTEXT stp x4, x5, [x2, #CPU_XREG_OFFSET(4)]