Skip to contentSkip to conversation

qemu-kvm: Prevent user space APIC code execution with in-kernel irqchip

PATCH New Jan Kiszka 1 participant 1 message Feb 6, 2012 KVM

lore
Share & tools
lore

Jan Kiszka

author
#0 lore raw

PATCH 1/1 qemu-kvm: Prevent user space APIC code execution with in-kernel irqchip

As qemu-kvm merged the kernel APIC into the user space model, we need to replicate the kernel APIC's logic here until the mess is cleaned up. So far we triggered the timer start and apic_update_irq calls unwillingly.

---
 hw/apic.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
hw/apic.c +6 -0
index dbf05a1..42865da 100644
@@ -270,6 +270,9 @@ static void apic_set_base(APICCommonState *s, uint64_t val)
 static void apic_set_tpr(APICCommonState *s, uint8_t val)
 {
     s->tpr = (val & 0x0f) << 4;
+    if (kvm_enabled() && kvm_irqchip_in_kernel()) {
+        return;
+    }
     apic_update_irq(s);
 }
 
@@ -878,6 +881,9 @@ void kvm_save_lapic(CPUState *env)
 
 static void apic_post_load(APICCommonState *s)
 {
+    if (kvm_enabled() && kvm_irqchip_in_kernel()) {
+        return;
+    }
     if (s->timer_expiry != -1) {
         qemu_mod_timer(s->timer, s->timer_expiry);
     } else {
Signature · 1 line
1.7.3.4