stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] arm64: KVM: VHE: reset PSTATE.PAN on entry to EL2
@ 2016-10-14 14:49 Vladimir Murzin
  2016-10-26  8:42 ` Greg KH
  0 siblings, 1 reply; 2+ messages in thread
From: Vladimir Murzin @ 2016-10-14 14:49 UTC (permalink / raw)
  To: stable; +Cc: vladimir.murzin, christoffer.dall, james.morse, marc.zyngier

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")

[ rebased for v4.7+ ]

Signed-off-by: Vladimir Murzin <vladimir.murzin@arm.com>
Reviewed-by: James Morse <james.morse@arm.com>
Acked-by: Marc Zyngier <marc.zyngier@arm.com>
Cc: <stable@vger.kernel.org> # v4.6+
Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
---
 arch/arm64/kvm/hyp/entry.S |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/arm64/kvm/hyp/entry.S b/arch/arm64/kvm/hyp/entry.S
index ce9e5e5..eaf08d3 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)]
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] arm64: KVM: VHE: reset PSTATE.PAN on entry to EL2
  2016-10-14 14:49 [PATCH] arm64: KVM: VHE: reset PSTATE.PAN on entry to EL2 Vladimir Murzin
@ 2016-10-26  8:42 ` Greg KH
  0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2016-10-26  8:42 UTC (permalink / raw)
  To: Vladimir Murzin; +Cc: stable, christoffer.dall, james.morse, marc.zyngier

On Fri, Oct 14, 2016 at 03:49:12PM +0100, Vladimir Murzin wrote:
> 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")
> 
> [ rebased for v4.7+ ]

Thanks for the rebase!

greg k-h

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-10-26  8:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-14 14:49 [PATCH] arm64: KVM: VHE: reset PSTATE.PAN on entry to EL2 Vladimir Murzin
2016-10-26  8:42 ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).