[x86] KVM: Intercept #AC to avoid guest->host denial-of-service (CVE-2015-5307)

This commit is contained in:
Ben Hutchings 2015-11-08 15:13:48 +00:00
parent b2076bbc37
commit ef1fd62260
4 changed files with 76 additions and 0 deletions

2
debian/changelog vendored
View File

@ -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 <ben@decadent.org.uk> Sun, 08 Nov 2015 14:47:40 +0000

View File

@ -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,

View File

@ -0,0 +1,34 @@
From: Eric Northup <digitaleric@google.com>
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;

View File

@ -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