KVM: x86: Drop guest-triggerable ASSERT()s on I/O APIC access alignment
authorSean Christopherson <seanjc@google.com>
Sat, 6 Dec 2025 00:43:06 +0000 (16:43 -0800)
committerSean Christopherson <seanjc@google.com>
Mon, 12 Jan 2026 17:31:39 +0000 (09:31 -0800)
Drop the asserts on the guest-controlled address being 16-byte aligned
when emulating I/O APIC accesses, as the ASSERT()s are guest-triggerable
and ultimately pointless since KVM requires exact register matches, i.e.
will ultimately ignore unaligned accesses anyways.

Drop the ASSERT() definition itself now that all users are gone.

For all intents and purposes, no functional change intended.

Link: https://patch.msgid.link/20251206004311.479939-5-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
arch/x86/kvm/ioapic.c
arch/x86/kvm/ioapic.h

index e7315b9..955c781 100644 (file)
@@ -618,8 +618,6 @@ static int ioapic_mmio_read(struct kvm_vcpu *vcpu, struct kvm_io_device *this,
        if (!ioapic_in_range(ioapic, addr))
                return -EOPNOTSUPP;
 
-       ASSERT(!(addr & 0xf));  /* check alignment */
-
        addr &= 0xff;
        spin_lock(&ioapic->lock);
        switch (addr) {
@@ -660,8 +658,6 @@ static int ioapic_mmio_write(struct kvm_vcpu *vcpu, struct kvm_io_device *this,
        if (!ioapic_in_range(ioapic, addr))
                return -EOPNOTSUPP;
 
-       ASSERT(!(addr & 0xf));  /* check alignment */
-
        switch (len) {
        case 8:
        case 4:
index bf28dbc..913016a 100644 (file)
@@ -104,19 +104,6 @@ void kvm_unregister_irq_mask_notifier(struct kvm *kvm, int irq,
 void kvm_fire_mask_notifiers(struct kvm *kvm, unsigned irqchip, unsigned pin,
                             bool mask);
 
-#ifdef DEBUG
-#define ASSERT(x)                                                      \
-do {                                                                   \
-       if (!(x)) {                                                     \
-               printk(KERN_EMERG "assertion failed %s: %d: %s\n",      \
-                      __FILE__, __LINE__, #x);                         \
-               BUG();                                                  \
-       }                                                               \
-} while (0)
-#else
-#define ASSERT(x) do { } while (0)
-#endif
-
 static inline int ioapic_in_kernel(struct kvm *kvm)
 {
        return irqchip_full(kvm);