The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH 0/8] KVM: x86/xen: Clean up 32-bit vs. 64-bit shared info mode handling
@ 2026-06-05 14:17 David Woodhouse
  2026-06-05 14:17 ` [PATCH 1/8] KVM: x86/xen: Rename 'longmode' to 'is_64bit' in hypercall handling David Woodhouse
                   ` (7 more replies)
  0 siblings, 8 replies; 16+ messages in thread
From: David Woodhouse @ 2026-06-05 14:17 UTC (permalink / raw)
  To: Sean Christopherson
  Cc: Paul Durrant, Hyunwoo Kim, Paolo Bonzini, Thomas Gleixner,
	Ingo Molnar, Borislav Petkov, Dave Hansen, x86, H. Peter Anvin,
	kvm, linux-kernel

This series addresses issues in KVM's Xen event channel delivery paths,
triggered by review of a patch from Hyunwoo Kim which fixed a TOCTOU
race in kvm_xen_set_evtchn_fast().

The first three patches are preparatory cleanups:
 • Rename the 'longmode' hypercall parameter to 'is_64bit' to
   distinguish it from the VM-wide shinfo mode.
 • Introduce kvm_xen_has_64bit_shinfo() with READ_ONCE() semantics.
 • Rename max_evtchn_port() to kvm_max_evtchn_port() in preparation
   for adding a variant that takes a latched bool.

Patches 4-5 fix TOCTOU races where kvm->arch.xen.long_mode is read 
multiple times without consistency. In practice these are harmless since 
the bitmaps are at the same offset in both layouts and corruption is 
limited to the guest's own shared_info page which doesn't get converted 
when switched between 32-bit and 64-bit anyway, but the fixes ensure 
internal consistency for any given invocation of the given function.

Patches 6-8 address a split-lock DoS vector identified by Sashiko: 
locked atomic operations on vcpu_info->evtchn_pending_sel can trigger
an #AC exception on hosts with split_lock_detect=fatal if the guest 
registers vcpu_info at a misaligned address. Patch 6 adds Xen-compatible 
alignment enforcement at registration time. Patches 7-8 switch to 32-bit 
locked operations which only require 4-byte alignment, handling the case 
where a 32-bit guest registers vcpu_info at a 4-byte-aligned address and 
later switches to 64-bit mode — which Xen supports, so so should KVM.

Based on v7.1-rc6.

(Sorry Sean, this conflicts with some stuff you have outstanding but
should probably go first?)

David Woodhouse (7):
      KVM: x86/xen: Rename 'longmode' to 'is_64bit' in hypercall handling
      KVM: x86/xen: Introduce kvm_xen_has_64bit_shinfo() macro
      KVM: x86/xen: Rename max_evtchn_port() to kvm_max_evtchn_port()
      KVM: x86/xen: Latch shinfo mode in kvm_xen_schedop_poll()
      KVM: x86/xen: Enforce alignment of vcpu_info registration
      KVM: x86/xen: Use 32-bit locked bts for vcpu_info evtchn_pending_sel
      KVM: x86/xen: Use 32-bit locked ops in kvm_xen_inject_pending_events()

Hyunwoo Kim (1):
      KVM: x86/xen: Latch shinfo mode in kvm_xen_set_evtchn_fast()

 arch/x86/kvm/xen.c | 186 +++++++++++++++++++++++++++++++++++------------------
 arch/x86/kvm/xen.h |   5 ++
 2 files changed, 127 insertions(+), 64 deletions(-)




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

end of thread, other threads:[~2026-07-08 15:48 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-05 14:17 [PATCH 0/8] KVM: x86/xen: Clean up 32-bit vs. 64-bit shared info mode handling David Woodhouse
2026-06-05 14:17 ` [PATCH 1/8] KVM: x86/xen: Rename 'longmode' to 'is_64bit' in hypercall handling David Woodhouse
2026-06-05 14:17 ` [PATCH 2/8] KVM: x86/xen: Introduce kvm_xen_has_64bit_shinfo() macro David Woodhouse
2026-06-06  9:30   ` David Laight
2026-06-06  9:35     ` David Woodhouse
2026-06-06 11:11       ` David Laight
2026-06-06 11:22         ` David Woodhouse
2026-06-05 14:17 ` [PATCH 3/8] KVM: x86/xen: Rename max_evtchn_port() to kvm_max_evtchn_port() David Woodhouse
2026-06-05 14:17 ` [PATCH 4/8] KVM: x86/xen: Latch shinfo mode in kvm_xen_set_evtchn_fast() David Woodhouse
2026-06-05 14:17 ` [PATCH 5/8] KVM: x86/xen: Latch shinfo mode in kvm_xen_schedop_poll() David Woodhouse
2026-06-05 14:17 ` [PATCH 6/8] KVM: x86/xen: Enforce alignment of vcpu_info registration David Woodhouse
2026-06-05 14:17 ` [PATCH 7/8] KVM: x86/xen: Use 32-bit locked bts for vcpu_info evtchn_pending_sel David Woodhouse
2026-07-08 15:48   ` Sean Christopherson
2026-06-05 14:17 ` [PATCH 8/8] KVM: x86/xen: Use 32-bit locked ops in kvm_xen_inject_pending_events() David Woodhouse
2026-07-08 15:23   ` Sean Christopherson
2026-07-08 15:41     ` David Woodhouse

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