[3.16.y-ckt stable] Patch "KVM: PPC: Book3S HV: Sanitize special-purpose register values on guest exit" has been added to the 3.16.y-ckt tree
Luis Henriques
luis.henriques at canonical.com
Tue Mar 22 10:25:52 UTC 2016
This is a note to let you know that I have just added a patch titled
KVM: PPC: Book3S HV: Sanitize special-purpose register values on guest exit
to the linux-3.16.y-queue branch of the 3.16.y-ckt extended stable tree
which can be found at:
http://kernel.ubuntu.com/git/ubuntu/linux.git/log/?h=linux-3.16.y-queue
This patch is scheduled to be released in version 3.16.7-ckt26.
If you, or anyone else, feels it should not be added to this tree, please
reply to this email.
For more information about the 3.16.y-ckt tree, see
https://wiki.ubuntu.com/Kernel/Dev/ExtendedStable
Thanks.
-Luis
---8<------------------------------------------------------------
>From 9f9bd1387c37f4eb75f142d02e4a9e6314286d23 Mon Sep 17 00:00:00 2001
From: Paul Mackerras <paulus at samba.org>
Date: Sat, 5 Mar 2016 19:34:39 +1100
Subject: KVM: PPC: Book3S HV: Sanitize special-purpose register values on
guest exit
commit ccec44563b18a0ce90e2d4f332784b3cb25c8e9c upstream.
Thomas Huth discovered that a guest could cause a hard hang of a
host CPU by setting the Instruction Authority Mask Register (IAMR)
to a suitable value. It turns out that this is because when the
code was added to context-switch the new special-purpose registers
(SPRs) that were added in POWER8, we forgot to add code to ensure
that they were restored to a sane value on guest exit.
This adds code to set those registers where a bad value could
compromise the execution of the host kernel to a suitable neutral
value on guest exit.
Fixes: b005255e12a3
Reported-by: Thomas Huth <thuth at redhat.com>
Reviewed-by: David Gibson <david at gibson.dropbear.id.au>
Signed-off-by: Paul Mackerras <paulus at samba.org>
Signed-off-by: Luis Henriques <luis.henriques at canonical.com>
---
arch/powerpc/kvm/book3s_hv_rmhandlers.S | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/arch/powerpc/kvm/book3s_hv_rmhandlers.S b/arch/powerpc/kvm/book3s_hv_rmhandlers.S
index 6fafff75f24a..f3197994b733 100644
--- a/arch/powerpc/kvm/book3s_hv_rmhandlers.S
+++ b/arch/powerpc/kvm/book3s_hv_rmhandlers.S
@@ -1280,6 +1280,20 @@ END_FTR_SECTION_IFCLR(CPU_FTR_ARCH_207S)
std r6, VCPU_ACOP(r9)
stw r7, VCPU_GUEST_PID(r9)
std r8, VCPU_WORT(r9)
+ /*
+ * Restore various registers to 0, where non-zero values
+ * set by the guest could disrupt the host.
+ */
+ li r0, 0
+ mtspr SPRN_IAMR, r0
+ mtspr SPRN_CIABR, r0
+ mtspr SPRN_DAWRX, r0
+ mtspr SPRN_TCSCR, r0
+ mtspr SPRN_WORT, r0
+ /* Set MMCRS to 1<<31 to freeze and disable the SPMC counters */
+ li r0, 1
+ sldi r0, r0, 31
+ mtspr SPRN_MMCRS, r0
8:
/* Save and reset AMR and UAMOR before turning on the MMU */
More information about the kernel-team
mailing list