summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Christopherson <seanjc@google.com>2025-12-06 03:43:06 +0300
committerSean Christopherson <seanjc@google.com>2026-01-12 20:31:39 +0300
commit9eabb2a5e499ec3e5a013157844335a487c7cb5e (patch)
treea971d35890c39dcb70794287a2310bcedba49717
parentca909f9ea8cb19032c9d9d7841a8e2395b6a9e8b (diff)
downloadlinux-9eabb2a5e499ec3e5a013157844335a487c7cb5e.tar.xz
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>
-rw-r--r--arch/x86/kvm/ioapic.c4
-rw-r--r--arch/x86/kvm/ioapic.h13
2 files changed, 0 insertions, 17 deletions
diff --git a/arch/x86/kvm/ioapic.c b/arch/x86/kvm/ioapic.c
index e7315b9311d3..955c781ba623 100644
--- a/arch/x86/kvm/ioapic.c
+++ b/arch/x86/kvm/ioapic.c
@@ -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:
diff --git a/arch/x86/kvm/ioapic.h b/arch/x86/kvm/ioapic.h
index bf28dbc11ff6..913016acbbd5 100644
--- a/arch/x86/kvm/ioapic.h
+++ b/arch/x86/kvm/ioapic.h
@@ -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);