]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
4.18-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 2 Oct 2018 15:00:24 +0000 (08:00 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 2 Oct 2018 15:00:24 +0000 (08:00 -0700)
added patches:
arm64-kvm-sanitize-pstate.m-when-being-set-from-userspace.patch

queue-4.18/arm64-kvm-sanitize-pstate.m-when-being-set-from-userspace.patch [new file with mode: 0644]
queue-4.18/series

diff --git a/queue-4.18/arm64-kvm-sanitize-pstate.m-when-being-set-from-userspace.patch b/queue-4.18/arm64-kvm-sanitize-pstate.m-when-being-set-from-userspace.patch
new file mode 100644 (file)
index 0000000..3d3c89e
--- /dev/null
@@ -0,0 +1,56 @@
+From 2a3f93459d689d990b3ecfbe782fec89b97d3279 Mon Sep 17 00:00:00 2001
+From: Marc Zyngier <marc.zyngier@arm.com>
+Date: Thu, 27 Sep 2018 16:53:22 +0100
+Subject: arm64: KVM: Sanitize PSTATE.M when being set from userspace
+
+From: Marc Zyngier <marc.zyngier@arm.com>
+
+commit 2a3f93459d689d990b3ecfbe782fec89b97d3279 upstream.
+
+Not all execution modes are valid for a guest, and some of them
+depend on what the HW actually supports. Let's verify that what
+userspace provides is compatible with both the VM settings and
+the HW capabilities.
+
+Cc: <stable@vger.kernel.org>
+Fixes: 0d854a60b1d7 ("arm64: KVM: enable initialization of a 32bit vcpu")
+Reviewed-by: Christoffer Dall <christoffer.dall@arm.com>
+Reviewed-by: Mark Rutland <mark.rutland@arm.com>
+Reviewed-by: Dave Martin <Dave.Martin@arm.com>
+Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
+Signed-off-by: Will Deacon <will.deacon@arm.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/arm64/kvm/guest.c |   10 +++++++++-
+ 1 file changed, 9 insertions(+), 1 deletion(-)
+
+--- a/arch/arm64/kvm/guest.c
++++ b/arch/arm64/kvm/guest.c
+@@ -152,17 +152,25 @@ static int set_core_reg(struct kvm_vcpu
+       }
+       if (off == KVM_REG_ARM_CORE_REG(regs.pstate)) {
+-              u32 mode = (*(u32 *)valp) & COMPAT_PSR_MODE_MASK;
++              u64 mode = (*(u64 *)valp) & COMPAT_PSR_MODE_MASK;
+               switch (mode) {
+               case COMPAT_PSR_MODE_USR:
++                      if (!system_supports_32bit_el0())
++                              return -EINVAL;
++                      break;
+               case COMPAT_PSR_MODE_FIQ:
+               case COMPAT_PSR_MODE_IRQ:
+               case COMPAT_PSR_MODE_SVC:
+               case COMPAT_PSR_MODE_ABT:
+               case COMPAT_PSR_MODE_UND:
++                      if (!vcpu_el1_is_32bit(vcpu))
++                              return -EINVAL;
++                      break;
+               case PSR_MODE_EL0t:
+               case PSR_MODE_EL1t:
+               case PSR_MODE_EL1h:
++                      if (vcpu_el1_is_32bit(vcpu))
++                              return -EINVAL;
+                       break;
+               default:
+                       err = -EINVAL;
index e1ae23b20c2171851c67dc8f40785664d31f3396..5d3f8f0d6eca547707c7e4ed5d6bce135f1872a7 100644 (file)
@@ -226,3 +226,4 @@ kvm-ppc-book3s-hv-fix-guest-r11-corruption-with-power9-tm-workarounds.patch
 powerpc-fix-csum_ipv6_magic-on-little-endian-platforms.patch
 powerpc-pkeys-fix-reading-of-ibm-processor-storage-keys-property.patch
 powerpc-pseries-fix-unitialized-timer-reset-on-migration.patch
+arm64-kvm-sanitize-pstate.m-when-being-set-from-userspace.patch