Home Home > GIT Browse
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichal Suchanek <msuchanek@suse.de>2018-10-31 12:36:54 +0100
committerMichal Suchanek <msuchanek@suse.de>2018-10-31 23:28:40 +0100
commit3ac7188847f1d387f9d72fec81e2db1c98810c62 (patch)
treec9dc86e5ae2b5772fc15006497235b19866ad663
parent755c740ee99869e06931b062781de6d0edc4959b (diff)
KVM: PPC: Fix a mmio_host_swabbed uninitialized usage issue
(bsc#1061840).
-rw-r--r--patches.arch/KVM-PPC-Fix-a-mmio_host_swabbed-uninitialized-usage-.patch59
-rw-r--r--series.conf1
2 files changed, 60 insertions, 0 deletions
diff --git a/patches.arch/KVM-PPC-Fix-a-mmio_host_swabbed-uninitialized-usage-.patch b/patches.arch/KVM-PPC-Fix-a-mmio_host_swabbed-uninitialized-usage-.patch
new file mode 100644
index 0000000000..a694851a4f
--- /dev/null
+++ b/patches.arch/KVM-PPC-Fix-a-mmio_host_swabbed-uninitialized-usage-.patch
@@ -0,0 +1,59 @@
+From f19d1f367a506bc645f8d6695942b8873fc82c84 Mon Sep 17 00:00:00 2001
+From: Simon Guo <wei.guo.simon@gmail.com>
+Date: Mon, 7 May 2018 14:20:09 +0800
+Subject: [PATCH] KVM: PPC: Fix a mmio_host_swabbed uninitialized usage issue
+
+References: bsc#1061840
+Patch-mainline: v4.18-rc1
+Git-commit: f19d1f367a506bc645f8d6695942b8873fc82c84
+
+When KVM emulates VMX store, it will invoke kvmppc_get_vmx_data() to
+retrieve VMX reg val. kvmppc_get_vmx_data() will check mmio_host_swabbed
+to decide which double word of vr[] to be used. But the
+mmio_host_swabbed can be uninitialized during VMX store procedure:
+
+kvmppc_emulate_loadstore
+ \- kvmppc_handle_store128_by2x64
+ \- kvmppc_get_vmx_data
+
+So vcpu->arch.mmio_host_swabbed is not meant to be used at all for
+emulation of store instructions, and this patch makes that true for
+VMX stores. This patch also initializes mmio_host_swabbed to avoid
+possible future problems.
+
+Signed-off-by: Simon Guo <wei.guo.simon@gmail.com>
+Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
+Acked-by: Michal Suchanek <msuchanek@suse.de>
+---
+ arch/powerpc/kvm/emulate_loadstore.c | 1 +
+ arch/powerpc/kvm/powerpc.c | 2 +-
+ 2 files changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/arch/powerpc/kvm/emulate_loadstore.c b/arch/powerpc/kvm/emulate_loadstore.c
+index a382e15135e6..b8a3aefc3033 100644
+--- a/arch/powerpc/kvm/emulate_loadstore.c
++++ b/arch/powerpc/kvm/emulate_loadstore.c
+@@ -111,6 +111,7 @@ int kvmppc_emulate_loadstore(struct kvm_vcpu *vcpu)
+ vcpu->arch.mmio_sp64_extend = 0;
+ vcpu->arch.mmio_sign_extend = 0;
+ vcpu->arch.mmio_vmx_copy_nums = 0;
++ vcpu->arch.mmio_host_swabbed = 0;
+
+ switch (get_op(inst)) {
+ case 31:
+diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c
+index 4e387647b5af..bef27b16d233 100644
+--- a/arch/powerpc/kvm/powerpc.c
++++ b/arch/powerpc/kvm/powerpc.c
+@@ -1374,7 +1374,7 @@ static inline int kvmppc_get_vmx_data(struct kvm_vcpu *vcpu, int rs, u64 *val)
+ if (di > 1)
+ return -1;
+
+- if (vcpu->arch.mmio_host_swabbed)
++ if (kvmppc_need_byteswap(vcpu))
+ di = 1 - di;
+
+ w0 = vrs.u[di * 2];
+--
+2.13.7
+
diff --git a/series.conf b/series.conf
index 28cce9f671..9d8429a0c6 100644
--- a/series.conf
+++ b/series.conf
@@ -16726,6 +16726,7 @@
patches.arch/KVM-PPC-Book3S-Check-KVM_CREATE_SPAPR_TCE_64-paramet.patch
patches.arch/KVM-PPC-Add-pt_regs-into-kvm_vcpu_arch-and-move-vcpu.patch
patches.arch/KVM-PPC-Move-nip-ctr-lr-xer-registers-to-pt_regs-in-.patch
+ patches.arch/KVM-PPC-Fix-a-mmio_host_swabbed-uninitialized-usage-.patch
patches.suse/ipv6-allow-PMTU-exceptions-to-local-routes.patch
patches.suse/net-dsa-add-error-handling-for-pskb_trim_rcsum.patch
patches.drivers/ixgbe-Fix-setting-of-TC-configuration-for-macvlan-ca.patch