Skip to content

Commit 9eabb2a

Browse files
committed
KVM: x86: Drop guest-triggerable ASSERT()s on I/O APIC access alignment
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>
1 parent ca909f9 commit 9eabb2a

2 files changed

Lines changed: 0 additions & 17 deletions

File tree

arch/x86/kvm/ioapic.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -618,8 +618,6 @@ static int ioapic_mmio_read(struct kvm_vcpu *vcpu, struct kvm_io_device *this,
618618
if (!ioapic_in_range(ioapic, addr))
619619
return -EOPNOTSUPP;
620620

621-
ASSERT(!(addr & 0xf)); /* check alignment */
622-
623621
addr &= 0xff;
624622
spin_lock(&ioapic->lock);
625623
switch (addr) {
@@ -660,8 +658,6 @@ static int ioapic_mmio_write(struct kvm_vcpu *vcpu, struct kvm_io_device *this,
660658
if (!ioapic_in_range(ioapic, addr))
661659
return -EOPNOTSUPP;
662660

663-
ASSERT(!(addr & 0xf)); /* check alignment */
664-
665661
switch (len) {
666662
case 8:
667663
case 4:

arch/x86/kvm/ioapic.h

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -104,19 +104,6 @@ void kvm_unregister_irq_mask_notifier(struct kvm *kvm, int irq,
104104
void kvm_fire_mask_notifiers(struct kvm *kvm, unsigned irqchip, unsigned pin,
105105
bool mask);
106106

107-
#ifdef DEBUG
108-
#define ASSERT(x) \
109-
do { \
110-
if (!(x)) { \
111-
printk(KERN_EMERG "assertion failed %s: %d: %s\n", \
112-
__FILE__, __LINE__, #x); \
113-
BUG(); \
114-
} \
115-
} while (0)
116-
#else
117-
#define ASSERT(x) do { } while (0)
118-
#endif
119-
120107
static inline int ioapic_in_kernel(struct kvm *kvm)
121108
{
122109
return irqchip_full(kvm);

0 commit comments

Comments
 (0)