From: David Woodhouse <dwmw@amazon.co.uk>
Addressing the backlog of mostly AI-discovered issues in the KVM/Xen
support.
Disclaimer: The fixes here were diagnosed by AI, fixed by AI, the
commit messages written by AI, and all the testing done by AI. And
then the new things which I would *never* have found if I'd have to do
all the typing myself were also fixed the same way. All under my close
direction, occasionally completely redirecting the way it wanted to do
things and rewriting its prose from scratch — but still AI first.
You can stop reading now if that's a problem. I was hoping to see the
policy changes¹ go in first and send these fixes afterwards, but that
still hasn't happened. Nevertheless, I have neither the time nor the
inclination to do a complete clean room implementation with my own
meat fingers. Take it or leave it, or tell me to wait for the official
policy change.
This fixes:
• CVE-2026-61403: xen_xenstore get_req() copies a full header length
regardless of how much was already consumed, so a guest feeding the
header in two parts overshoots req_offset and the next length
calculation underflows: a guest-controlled linear heap overwrite.
• CVE-2026-123069: the per-vCPU Xen timers survive ACPI ejection of
their vCPU, with the freed CPUState as the callback opaque.
• CVE-2026-123070: PHYSDEVOP_eoi and irq_status_query index the PIRQ
tables with no bounds check (OOB read).
• CVE-2026-123071: the xen-console output trim underflows when the
frontend sets a small enough 'limit' — up to ~2 KiB of
guest-controlled bytes written *before* the buffer.
• CVE-2026-123072: xen-9p-backend re-reads the guest's ring indices
after validating the request, so the iovecs can reach up to 1 MiB
past the end of the ring mapping (OOB read, disclosable via Twrite).
• CVE-2026-123074: grant copy segments weren't validated against the
page size. I don't believe this one is guest-reachable in-tree
(xen-block already bounds its segments), so this is hardening to
match Xen's GNTST_bad_copy_arg.
(CVE-2026-123073 was also assigned from the same combined report, but
it's simply a duplicate of CVE-2026-61403 above. I think that wants
rejecting.)
Followed by a handful of other issues found on the journey, including
the XenBus InitWait ordering regression reported by Mark Syms².
Patches 20-21 fix the two Coverity CIDs (1527403, 1507603) and
conflict textually with the lock-guard conversion recently posted³.
That conversion doesn't actually fix the bug that Coverity was whining
about, so I'd suggest these go first.
Testing: each original report's reproducer triggers its ASan signature
on the unfixed tree and is clean with the fix applied; the KVM/Xen
functional tests pass; a real Fedora guest with PV console and disk
survives kexec soft-reset cycles (although that surfaces a handful of
kexec and kdump issues which I'm looking at separately).
¹ https://lists.gnu.org/archive/html/qemu-devel/2026-09/msg00260.html
² https://lore.kernel.org/qemu-devel/178912129220.24041.799369954881004447@citrix.com
³ https://lore.kernel.org/qemu-devel/20261101150847.29157-1-drifabdelmalekmohamedsaid@gmail.com
David Woodhouse (21):
hw/xen: Fix partial request header handling in emulated XenStore
i386/xen: Don't resample GSI when per-vCPU upcall vector is in use
i386/xen: Free Xen vCPU timers when a vCPU is destroyed
hw/xen: Publish backend features before setting state to InitWait
hw/i386/kvm/xen_gnttab: Fix error handling in xen_be_gnttab_map_refs()
hw/xen: Validate grant copy segments against the page size
hw/i386/kvm/xen_evtchn: Validate PIRQ numbers in physdev operations
hw/i386/kvm/xen_evtchn: Fix off-by-one in do_remove_pci_vector()
i386/xen: Don't inject event on invalid port in qmp_xen_event_inject()
hw/i386/kvm/xen_evtchn: Reuse existing backend port in find_be_port()
hw/i386/kvm/xen: Don't leak gnttab handle on reset
hw/i386/kvm/xen_xenstore: Apply offset before truncation in
xs_append_strings()
hw/char/xen_console: Fix buffer trim when size exceeds twice the limit
hw/9pfs/xen-9p-backend: Use validated snapshot for request iovecs
hw/9pfs/xen-9p-backend: Validate the request header size field
hw/9pfs/xen-9p-backend: Validate frontend-supplied connect parameters
hw/9pfs/xen-9p-backend: Close event channel handle on disconnect
hw/net/xen_nic: Bound the TX and RX rings' producer index
hw/xen: Bound the rep count of PIO and MMIO ioreqs
hw/i386/kvm/xen_evtchn: Hold port_lock for whole of bind_pirq_op
hw/i386/kvm/xen_evtchn: Allow unmapping an emulated MSI PIRQ
hw/9pfs/xen-9p-backend.c | 65 +++++++++++++++++--------------
hw/char/xen_console.c | 20 +++++++---
hw/i386/kvm/xen_evtchn.c | 59 ++++++++++++++++++----------
hw/i386/kvm/xen_gnttab.c | 22 ++++++++++-
hw/i386/kvm/xen_primary_console.c | 3 ++
hw/i386/kvm/xen_xenstore.c | 31 +++++++++------
hw/net/xen_nic.c | 9 ++++-
hw/xen/xen-bus.c | 16 +++++++-
hw/xen/xen-hvm-common.c | 19 ++++++++-
hw/xen/xen-operations.c | 11 ++++++
target/i386/kvm/kvm.c | 6 +++
target/i386/kvm/xen-emu.c | 49 ++++++++++++++++++++++-
target/i386/kvm/xen-emu.h | 1 +
13 files changed, 235 insertions(+), 76 deletions(-)
--
2.43.0