|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PULL 07/21] hw/i386/kvm/xen_evtchn: Validate PIRQ numbers in physdev operations
From: David Woodhouse <dwmw@xxxxxxxxxxxx>
xen_physdev_eoi_pirq() and xen_physdev_query_pirq() used the given PIRQ
number to index the PIRQ tables without checking it against nr_pirqs.
Reject out-of-range values, and reject PIRQ 0 in bind_pirq and
map_pirq. PIRQs 0-15 are reserved for the initial domain's identity
claims of the legacy ISA IRQs — the allocators, Xen's and ours alike,
never hand them out — and an HVM guest has no such claim. QEMU's
gsi_pirq[] and MSI target lookups both treat 0 as "no PIRQ", so a
guest-mapped pirq 0 could never deliver anything; better to refuse it
than to create a silently dead mapping.
Fixes: CVE-2026-123070
Fixes: 799c23548f0d ("i386/xen: Implement HYPERVISOR_physdev_op")
Reported-by: bubblehuntr <https://gitlab.com/bubblehuntr>
Reported-by: Hui Peng <benquike@xxxxxxxxx>
Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/4525
Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/3639
Reviewed-by: Paul Durrant <paul@xxxxxxx>
Signed-off-by: David Woodhouse <dwmw@xxxxxxxxxxxx>
---
hw/i386/kvm/xen_evtchn.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/hw/i386/kvm/xen_evtchn.c b/hw/i386/kvm/xen_evtchn.c
index 9379383e53..3aff01b5d6 100644
--- a/hw/i386/kvm/xen_evtchn.c
+++ b/hw/i386/kvm/xen_evtchn.c
@@ -1283,7 +1283,7 @@ int xen_evtchn_bind_pirq_op(struct evtchn_bind_pirq *pirq)
return -ENOTSUP;
}
- if (pirq->pirq >= s->nr_pirqs) {
+ if (!pirq->pirq || pirq->pirq >= s->nr_pirqs) {
return -EINVAL;
}
@@ -1877,7 +1877,7 @@ int xen_physdev_map_pirq(struct physdev_map_pirq *map)
return pirq;
}
map->pirq = pirq;
- } else if (pirq >= s->nr_pirqs) {
+ } else if (!pirq || pirq >= s->nr_pirqs) {
return -EINVAL;
} else {
/*
@@ -1958,6 +1958,10 @@ int xen_physdev_eoi_pirq(struct physdev_eoi *eoi)
return -ENOTSUP;
}
+ if (pirq < 0 || pirq >= s->nr_pirqs) {
+ return -EINVAL;
+ }
+
BQL_LOCK_GUARD();
QEMU_LOCK_GUARD(&s->port_lock);
@@ -1990,6 +1994,10 @@ int xen_physdev_query_pirq(struct
physdev_irq_status_query *query)
return -ENOTSUP;
}
+ if (pirq < 0 || pirq >= s->nr_pirqs) {
+ return -EINVAL;
+ }
+
BQL_LOCK_GUARD();
QEMU_LOCK_GUARD(&s->port_lock);
--
2.55.0
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |