From ef1fd62260fd74bd9749f2249d19bb79807ee197 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Sun, 8 Nov 2015 15:13:48 +0000 Subject: [PATCH] [x86] KVM: Intercept #AC to avoid guest->host denial-of-service (CVE-2015-5307) --- debian/changelog | 2 + ...rcept-ac-to-avoid-guest-host-exploit.patch | 38 +++++++++++++++++++ ...id-guest-host-dos-by-intercepting-ac.patch | 34 +++++++++++++++++ debian/patches/series | 2 + 4 files changed, 76 insertions(+) create mode 100644 debian/patches/bugfix/x86/kvm-x86-svm-intercept-ac-to-avoid-guest-host-exploit.patch create mode 100644 debian/patches/bugfix/x86/kvm-x86-vmx-avoid-guest-host-dos-by-intercepting-ac.patch diff --git a/debian/changelog b/debian/changelog index 22996d819..090d5a361 100644 --- a/debian/changelog +++ b/debian/changelog @@ -4,6 +4,8 @@ linux (4.2.5-2) UNRELEASED; urgency=medium * RDS: fix race condition when sending a message on unbound socket (CVE-2015-7990) * media/vivid-osd: fix info leak in ioctl (CVE-2015-7884) + * [x86] KVM: Intercept #AC to avoid guest->host denial-of-service + (CVE-2015-5307) -- Ben Hutchings Sun, 08 Nov 2015 14:47:40 +0000 diff --git a/debian/patches/bugfix/x86/kvm-x86-svm-intercept-ac-to-avoid-guest-host-exploit.patch b/debian/patches/bugfix/x86/kvm-x86-svm-intercept-ac-to-avoid-guest-host-exploit.patch new file mode 100644 index 000000000..b8ffd077f --- /dev/null +++ b/debian/patches/bugfix/x86/kvm-x86-svm-intercept-ac-to-avoid-guest-host-exploit.patch @@ -0,0 +1,38 @@ +Subject: KVM x86 SVM: intercept #AC to avoid guest->host exploit + +--- +M arch/x86/kvm/svm.c +1 file changed, 8 insertions(+), 0 deletions(-) + + +--- a/arch/x86/kvm/svm.c ++++ b/arch/x86/kvm/svm.c +@@ -1106,6 +1106,7 @@ static void init_vmcb(struct vcpu_svm *s + set_exception_intercept(svm, PF_VECTOR); + set_exception_intercept(svm, UD_VECTOR); + set_exception_intercept(svm, MC_VECTOR); ++ set_exception_intercept(svm, AC_VECTOR); + + set_intercept(svm, INTERCEPT_INTR); + set_intercept(svm, INTERCEPT_NMI); +@@ -1795,6 +1796,12 @@ static int ud_interception(struct vcpu_s + return 1; + } + ++static int ac_interception(struct vcpu_svm *svm) ++{ ++ kvm_queue_exception_e(&svm->vcpu, AC_VECTOR, 0); ++ return 1; ++} ++ + static void svm_fpu_activate(struct kvm_vcpu *vcpu) + { + struct vcpu_svm *svm = to_svm(vcpu); +@@ -3369,6 +3376,7 @@ static int (*const svm_exit_handlers[])( + [SVM_EXIT_EXCP_BASE + PF_VECTOR] = pf_interception, + [SVM_EXIT_EXCP_BASE + NM_VECTOR] = nm_interception, + [SVM_EXIT_EXCP_BASE + MC_VECTOR] = mc_interception, ++ [SVM_EXIT_EXCP_BASE + AC_VECTOR] = ac_interception, + [SVM_EXIT_INTR] = intr_interception, + [SVM_EXIT_NMI] = nmi_interception, + [SVM_EXIT_SMI] = nop_on_interception, diff --git a/debian/patches/bugfix/x86/kvm-x86-vmx-avoid-guest-host-dos-by-intercepting-ac.patch b/debian/patches/bugfix/x86/kvm-x86-vmx-avoid-guest-host-dos-by-intercepting-ac.patch new file mode 100644 index 000000000..79ed6243d --- /dev/null +++ b/debian/patches/bugfix/x86/kvm-x86-vmx-avoid-guest-host-dos-by-intercepting-ac.patch @@ -0,0 +1,34 @@ +From: Eric Northup +Date: Thu Sep 10 11:36:28 2015 -0700 +Subject: KVM x86 vmx: avoid guest->host DOS by intercepting #AC + +A pathological (or malicious) guest can hang a host core by +mis-configuring its GDT/IDT and enabling alignment checks. + +[bwh: Forward-ported to 4.2: AC_VECTOR is already defined so don't add it] + +--- a/arch/x86/kvm/vmx.c ++++ b/arch/x86/kvm/vmx.c +@@ -1567,7 +1567,7 @@ static void update_exception_bitmap(stru + u32 eb; + + eb = (1u << PF_VECTOR) | (1u << UD_VECTOR) | (1u << MC_VECTOR) | +- (1u << NM_VECTOR) | (1u << DB_VECTOR); ++ (1u << NM_VECTOR) | (1u << DB_VECTOR) | (1u << AC_VECTOR); + if ((vcpu->guest_debug & + (KVM_GUESTDBG_ENABLE | KVM_GUESTDBG_USE_SW_BP)) == + (KVM_GUESTDBG_ENABLE | KVM_GUESTDBG_USE_SW_BP)) +@@ -5146,6 +5146,13 @@ static int handle_exception(struct kvm_v + kvm_run->debug.arch.pc = vmcs_readl(GUEST_CS_BASE) + rip; + kvm_run->debug.arch.exception = ex_no; + break; ++ case AC_VECTOR: ++ /* ++ * We have already enabled interrupts and pre-emption, so ++ * it's OK to loop here if that is what will happen. ++ */ ++ kvm_queue_exception_e(vcpu, AC_VECTOR, error_code); ++ return 1; + default: + kvm_run->exit_reason = KVM_EXIT_EXCEPTION; + kvm_run->ex.exception = ex_no; diff --git a/debian/patches/series b/debian/patches/series index 45d3d1c65..e22ac4a47 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -107,3 +107,5 @@ debian/signal-fix-abi-change-in-4.2.4.patch bugfix/all/usbvision-fix-overflow-of-interfaces-array.patch bugfix/all/rds-fix-race-condition-when-sending-a-message-on-unbound-socket.patch bugfix/all/media-media-vivid-osd-fix-info-leak-in-ioctl.patch +bugfix/x86/kvm-x86-vmx-avoid-guest-host-dos-by-intercepting-ac.patch +bugfix/x86/kvm-x86-svm-intercept-ac-to-avoid-guest-host-exploit.patch