Kernel KVM virtualization development
 help / color / mirror / Atom feed
* [PATCH v1 00/21] hw/xen, i386/xen: security and robustness fixes
@ 2026-11-24 23:22 David Woodhouse
  2026-11-24 23:22 ` [PATCH v1 01/21] hw/xen: Fix partial request header handling in emulated XenStore David Woodhouse
                   ` (20 more replies)
  0 siblings, 21 replies; 51+ messages in thread
From: David Woodhouse @ 2026-11-24 23:22 UTC (permalink / raw)
  To: qemu-devel
  Cc: xen-devel, kvm, Paolo Bonzini, Peter Maydell, Paul Durrant,
	Stefano Stabellini, Anthony PERARD, Edgar E . Iglesias,
	Michael S . Tsirkin, Richard Henderson, Marcelo Tosatti,
	Marc-André Lureau, Jason Wang, Hui Peng, Mark Syms,
	Feifan Qian, David Woodhouse

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


^ permalink raw reply	[flat|nested] 51+ messages in thread

end of thread, other threads:[~2026-11-30 13:17 UTC | newest]

Thread overview: 51+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-24 23:22 [PATCH v1 00/21] hw/xen, i386/xen: security and robustness fixes David Woodhouse
2026-11-24 23:22 ` [PATCH v1 01/21] hw/xen: Fix partial request header handling in emulated XenStore David Woodhouse
2026-11-25 10:57   ` Paul Durrant
2026-11-30 13:17   ` Alex Bennée
2026-11-24 23:22 ` [PATCH v1 02/21] i386/xen: Don't resample GSI when per-vCPU upcall vector is in use David Woodhouse
2026-11-25 10:58   ` Paul Durrant
2026-11-24 23:22 ` [PATCH v1 03/21] i386/xen: Free Xen vCPU timers when a vCPU is destroyed David Woodhouse
2026-11-25 11:00   ` Paul Durrant
2026-11-24 23:22 ` [PATCH v1 04/21] hw/xen: Publish backend features before setting state to InitWait David Woodhouse
2026-11-25 11:05   ` Paul Durrant
2026-11-24 23:22 ` [PATCH v1 05/21] hw/i386/kvm/xen_gnttab: Fix error handling in xen_be_gnttab_map_refs() David Woodhouse
2026-11-25 11:07   ` Paul Durrant
2026-11-30 13:17   ` Alex Bennée
2026-11-24 23:22 ` [PATCH v1 06/21] hw/xen: Validate grant copy segments against the page size David Woodhouse
2026-11-25 11:09   ` Paul Durrant
2026-11-24 23:22 ` [PATCH v1 07/21] hw/i386/kvm/xen_evtchn: Validate PIRQ numbers in physdev operations David Woodhouse
2026-11-25 11:12   ` Paul Durrant
2026-11-24 23:22 ` [PATCH v1 08/21] hw/i386/kvm/xen_evtchn: Fix off-by-one in do_remove_pci_vector() David Woodhouse
2026-11-25 11:16   ` Paul Durrant
2026-11-25 12:03     ` David Woodhouse
2026-11-25 13:31       ` Paul Durrant
2026-11-25 13:43         ` David Woodhouse
2026-11-26 10:19           ` David Woodhouse
2026-11-30 12:04         ` Paul Durrant
2026-11-24 23:22 ` [PATCH v1 09/21] i386/xen: Don't inject event on invalid port in qmp_xen_event_inject() David Woodhouse
2026-11-24 23:31   ` Philippe Mathieu-Daudé
2026-11-25 11:17   ` Paul Durrant
2026-11-24 23:22 ` [PATCH v1 10/21] hw/i386/kvm/xen_evtchn: Reuse existing backend port in find_be_port() David Woodhouse
2026-11-25 11:18   ` Paul Durrant
2026-11-24 23:22 ` [PATCH v1 11/21] hw/i386/kvm/xen: Don't leak gnttab handle on reset David Woodhouse
2026-11-25 11:20   ` Paul Durrant
2026-11-24 23:22 ` [PATCH v1 12/21] hw/i386/kvm/xen_xenstore: Apply offset before truncation in xs_append_strings() David Woodhouse
2026-11-25 11:22   ` Paul Durrant
2026-11-24 23:22 ` [PATCH v1 13/21] hw/char/xen_console: Fix buffer trim when size exceeds twice the limit David Woodhouse
2026-11-25 11:24   ` Paul Durrant
2026-11-24 23:22 ` [PATCH v1 14/21] hw/9pfs/xen-9p-backend: Use validated snapshot for request iovecs David Woodhouse
2026-11-25 11:26   ` Paul Durrant
2026-11-24 23:22 ` [PATCH v1 15/21] hw/9pfs/xen-9p-backend: Validate the request header size field David Woodhouse
2026-11-25 11:27   ` Paul Durrant
2026-11-24 23:22 ` [PATCH v1 16/21] hw/9pfs/xen-9p-backend: Validate frontend-supplied connect parameters David Woodhouse
2026-11-25 11:29   ` Paul Durrant
2026-11-24 23:22 ` [PATCH v1 17/21] hw/9pfs/xen-9p-backend: Close event channel handle on disconnect David Woodhouse
2026-11-25 11:30   ` Paul Durrant
2026-11-24 23:22 ` [PATCH v1 18/21] hw/net/xen_nic: Bound the TX and RX rings' producer index David Woodhouse
2026-11-25 11:32   ` Paul Durrant
2026-11-24 23:22 ` [PATCH v1 19/21] hw/xen: Bound the rep count of PIO and MMIO ioreqs David Woodhouse
2026-11-25 11:34   ` Paul Durrant
2026-11-24 23:22 ` [PATCH v1 20/21] hw/i386/kvm/xen_evtchn: Hold port_lock for whole of bind_pirq_op David Woodhouse
2026-11-25 11:35   ` Paul Durrant
2026-11-24 23:22 ` [PATCH v1 21/21] hw/i386/kvm/xen_evtchn: Allow unmapping an emulated MSI PIRQ David Woodhouse
2026-11-25 11:36   ` Paul Durrant

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox