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
commit8d8b3290b41353972f28ed0d306c3fef1bbadaad (patch)
tree497510db138a000ab4501146b87ad5b5baa8a369
parent976d3073c47cc32ec4aa1345866533a440311b7c (diff)
KVM: PPC: Book3S: Check KVM_CREATE_SPAPR_TCE_64 parameters
(bsc#1061840).
-rw-r--r--patches.arch/KVM-PPC-Book3S-Check-KVM_CREATE_SPAPR_TCE_64-paramet.patch43
-rw-r--r--series.conf1
2 files changed, 44 insertions, 0 deletions
diff --git a/patches.arch/KVM-PPC-Book3S-Check-KVM_CREATE_SPAPR_TCE_64-paramet.patch b/patches.arch/KVM-PPC-Book3S-Check-KVM_CREATE_SPAPR_TCE_64-paramet.patch
new file mode 100644
index 0000000000..a4231d0fdb
--- /dev/null
+++ b/patches.arch/KVM-PPC-Book3S-Check-KVM_CREATE_SPAPR_TCE_64-paramet.patch
@@ -0,0 +1,43 @@
+From e45719af1caff16dbc0f6bf7bbfbc5e7a54738a5 Mon Sep 17 00:00:00 2001
+From: Alexey Kardashevskiy <aik@ozlabs.ru>
+Date: Mon, 14 May 2018 20:00:29 +1000
+Subject: [PATCH] KVM: PPC: Book3S: Check KVM_CREATE_SPAPR_TCE_64 parameters
+
+References: bsc#1061840
+Patch-mainline: v4.18-rc1
+Git-commit: e45719af1caff16dbc0f6bf7bbfbc5e7a54738a5
+
+Although it does not seem possible to break the host by passing bad
+parameters when creating a TCE table in KVM, it is still better to get
+an early clear indication of that than debugging weird effect this might
+bring.
+
+This adds some sanity checks that the page size is 4KB..16GB as this is
+what the actual LoPAPR supports and that the window actually fits 64bit
+space.
+
+Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
+Acked-by: Balbir Singh <bsingharora@gmail.com>
+Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
+Acked-by: Michal Suchanek <msuchanek@suse.de>
+---
+ arch/powerpc/kvm/book3s_64_vio.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/arch/powerpc/kvm/book3s_64_vio.c b/arch/powerpc/kvm/book3s_64_vio.c
+index 984f1978a19c..80ead383d8ee 100644
+--- a/arch/powerpc/kvm/book3s_64_vio.c
++++ b/arch/powerpc/kvm/book3s_64_vio.c
+@@ -300,7 +300,8 @@ long kvm_vm_ioctl_create_spapr_tce(struct kvm *kvm,
+ int ret = -ENOMEM;
+ int i;
+
+- if (!args->size)
++ if (!args->size || args->page_shift < 12 || args->page_shift > 34 ||
++ (args->offset + args->size > (ULLONG_MAX >> args->page_shift)))
+ return -EINVAL;
+
+ size = _ALIGN_UP(args->size, PAGE_SIZE >> 3);
+--
+2.13.7
+
diff --git a/series.conf b/series.conf
index c9fb9286a8..5bdf9076c7 100644
--- a/series.conf
+++ b/series.conf
@@ -16723,6 +16723,7 @@
patches.arch/KVM-PPC-Book3S-HV-Fix-inaccurate-comment.patch
patches.arch/KVM-PPC-Book3S-Use-correct-page-shift-in-H_STUFF_TCE.patch
patches.arch/KVM-PPC-Book3S-Allow-backing-bigger-guest-IOMMU-page.patch
+ patches.arch/KVM-PPC-Book3S-Check-KVM_CREATE_SPAPR_TCE_64-paramet.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