[kernel/f20] CVE-2014-0155 KVM: BUG caused by invalid guest ioapic redirect table (rhbz 1081589 1085016)

Josh Boyer jwboyer at fedoraproject.org
Wed Apr 9 14:31:19 UTC 2014


commit fe4e507de83b1ca7463b90514b60b1042a6d7908
Author: Josh Boyer <jwboyer at redhat.com>
Date:   Wed Apr 9 10:28:57 2014 -0400

    CVE-2014-0155 KVM: BUG caused by invalid guest ioapic redirect table (rhbz 1081589 1085016)

 ...signment-of-ioapic-rtc_status-pending_eoi.patch |   38 ++++++++++++++++++++
 kernel.spec                                        |    7 ++++
 2 files changed, 45 insertions(+), 0 deletions(-)
---
diff --git a/KVM-ioapic-fix-assignment-of-ioapic-rtc_status-pending_eoi.patch b/KVM-ioapic-fix-assignment-of-ioapic-rtc_status-pending_eoi.patch
new file mode 100644
index 0000000..170911e
--- /dev/null
+++ b/KVM-ioapic-fix-assignment-of-ioapic-rtc_status-pending_eoi.patch
@@ -0,0 +1,38 @@
+Bugzilla: 1085016
+Upstream-status: Queued for 3.15
+
+From 5678de3f15010b9022ee45673f33bcfc71d47b60 Mon Sep 17 00:00:00 2001
+From: Paolo Bonzini <pbonzini at redhat.com>
+Date: Fri, 28 Mar 2014 20:41:50 +0100
+Subject: KVM: ioapic: fix assignment of ioapic->rtc_status.pending_eoi
+ (CVE-2014-0155)
+
+QE reported that they got the BUG_ON in ioapic_service to trigger.
+I cannot reproduce it, but there are two reasons why this could happen.
+
+The less likely but also easiest one, is when kvm_irq_delivery_to_apic
+does not deliver to any APIC and returns -1.
+
+Because irqe.shorthand == 0, the kvm_for_each_vcpu loop in that
+function is never reached.  However, you can target the similar loop in
+kvm_irq_delivery_to_apic_fast; just program a zero logical destination
+address into the IOAPIC, or an out-of-range physical destination address.
+
+Signed-off-by: Paolo Bonzini <pbonzini at redhat.com>
+
+diff --git a/virt/kvm/ioapic.c b/virt/kvm/ioapic.c
+index d4b6015..d98d107 100644
+--- a/virt/kvm/ioapic.c
++++ b/virt/kvm/ioapic.c
+@@ -356,7 +356,7 @@ static int ioapic_service(struct kvm_ioapic *ioapic, int irq, bool line_status)
+ 		BUG_ON(ioapic->rtc_status.pending_eoi != 0);
+ 		ret = kvm_irq_delivery_to_apic(ioapic->kvm, NULL, &irqe,
+ 				ioapic->rtc_status.dest_map);
+-		ioapic->rtc_status.pending_eoi = ret;
++		ioapic->rtc_status.pending_eoi = (ret < 0 ? 0 : ret);
+ 	} else
+ 		ret = kvm_irq_delivery_to_apic(ioapic->kvm, NULL, &irqe, NULL);
+ 
+-- 
+cgit v0.10.1
+
diff --git a/kernel.spec b/kernel.spec
index bd01576..42d3e94 100644
--- a/kernel.spec
+++ b/kernel.spec
@@ -780,6 +780,9 @@ Patch25055: lib-percpu_counter.c-fix-bad-percpu-counter-state-du.patch
 #rhbz 1084829
 Patch25056: selinux-correctly-label-proc-inodes-in-use-before-th.patch
 
+#CVE-2014-0155 rhbz 1081589 1085016
+Patch25057: KVM-ioapic-fix-assignment-of-ioapic-rtc_status-pending_eoi.patch
+
 # END OF PATCH DEFINITIONS
 
 %endif
@@ -1516,6 +1519,9 @@ ApplyPatch lib-percpu_counter.c-fix-bad-percpu-counter-state-du.patch
 #rhbz 1084829
 ApplyPatch selinux-correctly-label-proc-inodes-in-use-before-th.patch
 
+#CVE-2014-0155 rhbz 1081589 1085016
+ApplyPatch KVM-ioapic-fix-assignment-of-ioapic-rtc_status-pending_eoi.patch
+
 # END OF PATCH APPLICATIONS
 
 %endif
@@ -2328,6 +2334,7 @@ fi
 #                 ||     ||
 %changelog
 * Wed Apr 09 2014 Josh Boyer <jwboyer at fedoraproject.org>
+- CVE-2014-0155 KVM: BUG caused by invalid guest ioapic redirect table (rhbz 1081589 1085016)
 - Add patch to fix SELinux lables on /proc files (rhbz 1084829)
 - Add patch to fix S3 in KVM guests (rhbz 1074235)
 


More information about the scm-commits mailing list