diff --git a/debian/changelog b/debian/changelog index 3344fe2c8..d18d337f4 100644 --- a/debian/changelog +++ b/debian/changelog @@ -6,6 +6,8 @@ linux (4.18.10-2) UNRELEASED; urgency=medium [ Salvatore Bonaccorso ] * [arm64] KVM: Tighten guest core register access from userspace (CVE-2018-18021) + * [arm64] KVM: Sanitize PSTATE.M when being set from userspace + (CVE-2018-18021) -- Ben Hutchings Fri, 05 Oct 2018 18:09:26 +0100 diff --git a/debian/patches/bugfix/arm64/arm64-kvm-sanitize-pstate.m-when-being-set-from-user.patch b/debian/patches/bugfix/arm64/arm64-kvm-sanitize-pstate.m-when-being-set-from-user.patch new file mode 100644 index 000000000..b7c81d02c --- /dev/null +++ b/debian/patches/bugfix/arm64/arm64-kvm-sanitize-pstate.m-when-being-set-from-user.patch @@ -0,0 +1,58 @@ +From: Marc Zyngier +Date: Thu, 27 Sep 2018 16:53:22 +0100 +Subject: arm64: KVM: Sanitize PSTATE.M when being set from userspace +Origin: https://git.kernel.org/linus/2a3f93459d689d990b3ecfbe782fec89b97d3279 +Bug-Debian-Security: https://security-tracker.debian.org/tracker/CVE-2018-18021 + +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: +Fixes: 0d854a60b1d7 ("arm64: KVM: enable initialization of a 32bit vcpu") +Reviewed-by: Christoffer Dall +Reviewed-by: Mark Rutland +Reviewed-by: Dave Martin +Signed-off-by: Marc Zyngier +Signed-off-by: Will Deacon +[carnil: Backport for 4.18: Cherrypick directly commit from 4.18.12 / +926415e1e4c9] +--- + arch/arm64/kvm/guest.c | 10 +++++++++- + 1 file changed, 9 insertions(+), 1 deletion(-) + +diff --git a/arch/arm64/kvm/guest.c b/arch/arm64/kvm/guest.c +index 4a177629862b..d5c6bb1562d8 100644 +--- a/arch/arm64/kvm/guest.c ++++ b/arch/arm64/kvm/guest.c +@@ -152,17 +152,25 @@ static int set_core_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg) + } + + 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; +-- +2.11.0 + diff --git a/debian/patches/series b/debian/patches/series index def369bd9..174480bdd 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -146,6 +146,7 @@ bugfix/all/floppy-Do-not-copy-a-kernel-pointer-to-user-memory-i.patch bugfix/all/scsi-target-iscsi-Use-hex2bin-instead-of-a-re-implem.patch bugfix/all/scsi-target-iscsi-Use-bin2hex-instead-of-a-re-implem.patch bugfix/arm64/arm64-kvm-tighten-guest-core-register-access-from-us.patch +bugfix/arm64/arm64-kvm-sanitize-pstate.m-when-being-set-from-user.patch # Fix exported symbol versions bugfix/all/module-disable-matching-missing-version-crc.patch