Linux kernel -stable discussions
 help / color / mirror / Atom feed
* [PATCH 6.6.y 02/17] KVM: x86/mmu: Flush TLBs if child SPTE is zapped when splitting a huge SPTE
       [not found] <20261204180337.2168031-1-pbonzini@redhat.com>
@ 2026-12-04 18:03 ` Paolo Bonzini
  2026-12-05 12:48   ` Sasha Levin
  2026-12-04 18:03 ` [PATCH 6.6.y 04/17] KVM: x86: Disable hypervisor (VMX Preemption) timer if TSC deadline wraps Paolo Bonzini
                   ` (11 subsequent siblings)
  12 siblings, 1 reply; 14+ messages in thread
From: Paolo Bonzini @ 2026-12-04 18:03 UTC (permalink / raw)
  To: linux-kernel, kvm
  Cc: Sean Christopherson, stable, Chris Mason, Stefan Teodorescu

From: Sean Christopherson <seanjc@google.com>

[ Upstream commit d31322f7c0003c4b3cba9d44c85fd73aa877c9f9 ]

Queue a TLB flush when eagerly splitting a huge SPTE and adding a child
SPTE to the rmap fails due to hitting the recycle threshold.  If adding to
the rmap fails, __rmap_add() zaps the entire list of rmaps, including the
recently-added child SPTE.  Eliding the flush in that case is unsafe as the
huge SPTE is still PRESENT, after the TLB flush  performed by __rmap_add(),
i.e. can be (re)cached by running vCPUs.

Push the TLB flush out from __rmap_add() to its two callers by returning a
bool to indicate that a TLB flush is needed.  Return "TLB flush needed"
instead of success/failuire so that a feature cleanup can simply return the
result of kvm_zap_all_rmap_sptes() (which *should* always be true; if there
isn't at least one rmap entry, then things have really gone sideways).

Fixes: 0378739401cf ("KVM: x86/mmu: Avoid unnecessary flush on eager page split")
Cc: stable@vger.kernel.org
Reported-by: Chris Mason <mason@kernel.org>
Reported-by: Stefan Teodorescu <fane@google.com>
Signed-off-by: Sean Christopherson <seanjc@google.com>
Link: https://patch.msgid.link/20261113155010.442816-2-seanjc@google.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 arch/x86/kvm/mmu/mmu.c | 21 ++++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)

diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c
index d6e83ea0c49b..df613193ae4c 100644
--- a/arch/x86/kvm/mmu/mmu.c
+++ b/arch/x86/kvm/mmu/mmu.c
@@ -1621,7 +1621,7 @@ static bool kvm_test_age_rmap(struct kvm *kvm, struct kvm_rmap_head *rmap_head,
 
 #define RMAP_RECYCLE_THRESHOLD 1000
 
-static void __rmap_add(struct kvm *kvm,
+static bool __rmap_add(struct kvm *kvm,
 		       struct kvm_mmu_memory_cache *cache,
 		       const struct kvm_memory_slot *slot,
 		       u64 *spte, gfn_t gfn, unsigned int access)
@@ -1641,8 +1641,9 @@ static void __rmap_add(struct kvm *kvm,
 		kvm->stat.max_mmu_rmap_size = rmap_count;
 	if (rmap_count > RMAP_RECYCLE_THRESHOLD) {
 		kvm_zap_all_rmap_sptes(kvm, rmap_head);
-		kvm_flush_remote_tlbs_gfn(kvm, gfn, sp->role.level);
+		return true;
 	}
+	return false;
 }
 
 static void rmap_add(struct kvm_vcpu *vcpu, const struct kvm_memory_slot *slot,
@@ -1650,7 +1651,9 @@ static void rmap_add(struct kvm_vcpu *vcpu, const struct kvm_memory_slot *slot,
 {
 	struct kvm_mmu_memory_cache *cache = &vcpu->arch.mmu_pte_list_desc_cache;
 
-	__rmap_add(vcpu->kvm, cache, slot, spte, gfn, access);
+	if (__rmap_add(vcpu->kvm, cache, slot, spte, gfn, access))
+		kvm_flush_remote_tlbs_gfn(vcpu->kvm, gfn,
+					  sptep_to_sp(spte)->role.level);
 }
 
 bool kvm_age_gfn(struct kvm *kvm, struct kvm_gfn_range *range)
@@ -6421,7 +6424,7 @@ static void shadow_mmu_split_huge_page(struct kvm *kvm,
 		 *
 		 * However, if a given SPTE points to a lower level page table,
 		 * that lower level page table may only be partially populated.
-		 * Installing such SPTEs would effectively unmap a potion of the
+		 * Installing such SPTEs would effectively unmap a portion of the
 		 * huge page. Unmapping guest memory always requires a TLB flush
 		 * since a subsequent operation on the unmapped regions would
 		 * fail to detect the need to flush.
@@ -6433,7 +6436,15 @@ static void shadow_mmu_split_huge_page(struct kvm *kvm,
 
 		spte = make_huge_page_split_spte(kvm, huge_spte, sp->role, index);
 		mmu_spte_set(sptep, spte);
-		__rmap_add(kvm, cache, slot, sptep, gfn, sp->role.access);
+
+		/*
+		 * Queue a TLB flush if adding the SPTE to the rmap zapped the
+		 * child SPTE that was just added.  In that case, replacing the
+		 * huge SPTE with a shadow page will effectively unmap guest
+		 * memory (see above), as the huge SPTE is still PRESENT and
+		 * can be (re)cached in the TLB before it is replaced.
+		 */
+		flush |= __rmap_add(kvm, cache, slot, sptep, gfn, sp->role.access);
 	}
 
 	__link_shadow_page(kvm, cache, huge_sptep, sp, flush);
-- 
2.56.1



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

* [PATCH 6.6.y 04/17] KVM: x86: Disable hypervisor (VMX Preemption) timer if TSC deadline wraps
       [not found] <20261204180337.2168031-1-pbonzini@redhat.com>
  2026-12-04 18:03 ` [PATCH 6.6.y 02/17] KVM: x86/mmu: Flush TLBs if child SPTE is zapped when splitting a huge SPTE Paolo Bonzini
@ 2026-12-04 18:03 ` Paolo Bonzini
  2026-12-04 18:03 ` [PATCH 6.6.y 05/17] KVM: x86: Reset local APIC timer metadata on RESET, INIT, and KVM_SET_LAPIC Paolo Bonzini
                   ` (10 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: Paolo Bonzini @ 2026-12-04 18:03 UTC (permalink / raw)
  To: linux-kernel, kvm
  Cc: Sean Christopherson, Stefan Teodorescu, David Woodhouse, stable

From: Sean Christopherson <seanjc@google.com>

[ Upstream commit 0b135caf3230bc4030c32bb7da5b8d4af64c379c ]

Disable the VMX Preemption Timer, by configuring the deadline to be '0',
if converting from a one-shot/periodic expiry to a deadline would wrap the
TSC, i.e. would result in a deadline that's far in the past, even though
the expiry is firmly in the future.  Architecturally, delivering the APIC
timer IRQ way too early is obviously wrong, but the bigger problem is what
can happen if the APIC timer is in periodic mode.

If the guest sets its TSC to a large value, but not _too_ large, puts it
APIC timer into periodic mode, and then programs the maximal period, then
KVM will compute a TSC deadline that is far "earlier" than the current TSC,
but with plenty of headroom for guest TSC to continue counting without the
TSC itself wrapping.  Even though the VMX side of things detects that the
timer has already expired, KVM leaves the hypervisor timer armed so that it
can compute the new deadline/expiry from the VM-Exit handler.  On the VMX
side of things, KVM handles the "deadline in the past" by forcing the VMX
Preemption Timer to '0', which generates an immediate VM-Exit.

All of that would be "fine", except that KVM handles VMX Preemption Timer
exits in its fastpath, will recompute the same in-the-past deadline, and
constantly re-enter the guest with a timer value of '0'.  Architecturally,
the SDM states that such behavior can trigger a VM-Exit *without* fetching
any instructions in the guest.

  It is possible for the VMX-preemption timer to expire during VM entry
  (e.g., if the value in the VMX-preemption timer-value field is zero). If
  this happens (and if the VM entry was not to the wait-for-SIPI state), a
  VM exit occurs with its normal priority after any event injection and
  before execution of any instruction following VM entry.

Empirically, on bare metal, if the timer expires "during" VM-Entry, the CPU
may or may not recognize IRQs (it's not clear exactly what conditions lead
to IRQs being recognized or not).  In the worst case scenario, the host can
experience hard lockups if the tight entry<=>exit loop never opens a window
for host IRQs to be recognized.

The problem is especially noticeable when running as a KVM guest, as KVM
*never* opens a window for host (L1) IRQs, even with non-zero (but small)
VMX Preemption Timer values, as KVM-as-L0 starts the timer fairly early in
the nested VM-Enter flow and so the timer always expires before the nested
VM-Enter gets to the point where it checks for L1 IRQs.

Opportunistically read TSC and ktime in close succession when computing the
target expiration and the TSC deadline, to minimize the divergence between
the two (though in practice, reading the values even a few hundred cycles
apart is a complete non-issue.

Fixes: 26efe2fd92e5 ("KVM: VMX: Handle preemption timer fastpath")
Fixes: 8003c9ae204e ("KVM: LAPIC: add APIC Timer periodic/oneshot mode VMX preemption timer support")
Reported-by: Stefan Teodorescu <fane@google.com>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: stable@vger.kernel.org
Signed-off-by: Sean Christopherson <seanjc@google.com>
Link: https://patch.msgid.link/20261028183358.1798566-2-seanjc@google.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 arch/x86/kvm/lapic.c | 37 ++++++++++++++++++++++++-------------
 1 file changed, 24 insertions(+), 13 deletions(-)

diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c
index 346e6688109a..1fdb3f396d72 100644
--- a/arch/x86/kvm/lapic.c
+++ b/arch/x86/kvm/lapic.c
@@ -1977,6 +1977,26 @@ static inline u64 tmict_to_ns(struct kvm_lapic *apic, u32 tmict)
 	return (u64)tmict * APIC_BUS_CYCLE_NS * (u64)apic->divide_count;
 }
 
+static u64 ns_to_tsc_deadline(struct kvm_lapic *apic, s64 delta)
+{
+	u64 tsc_now = rdtsc();
+	u64 deadline;
+
+	/*
+	 * Disable the hypervisor timer, which is deadline-based, if converting
+	 * the one-shot/periodic expiry to a TSC deadline wraps the TSC, i.e.
+	 * results in a deadline far in the past, even though the expiry itself
+	 * is in the future.  Alternatively, KVM could track the deadline as a
+	 * 128 bit value, but in practice the deadline will only wrap if the
+	 * guest is doing weird things with TSC (which is writable via MSR).
+	 */
+	if (check_add_overflow(kvm_read_l1_tsc(apic->vcpu, tsc_now),
+			       nsec_to_cycles(apic->vcpu, delta), &deadline))
+		return 0;
+
+	return deadline;
+}
+
 static void update_target_expiration(struct kvm_lapic *apic, uint32_t old_divisor)
 {
 	ktime_t now, remaining;
@@ -1995,19 +2015,14 @@ static void update_target_expiration(struct kvm_lapic *apic, uint32_t old_diviso
 	ns_remaining_new = mul_u64_u32_div(ns_remaining_old,
 	                                   apic->divide_count, old_divisor);
 
-	apic->lapic_timer.tscdeadline +=
-		nsec_to_cycles(apic->vcpu, ns_remaining_new) -
-		nsec_to_cycles(apic->vcpu, ns_remaining_old);
 	apic->lapic_timer.target_expiration = ktime_add_ns(now, ns_remaining_new);
+	apic->lapic_timer.tscdeadline = ns_to_tsc_deadline(apic, ns_remaining_new);
 }
 
 static bool set_target_expiration(struct kvm_lapic *apic, u32 count_reg)
 {
-	ktime_t now;
-	u64 tscl = rdtsc();
 	s64 deadline;
 
-	now = ktime_get();
 	apic->lapic_timer.period =
 			tmict_to_ns(apic, kvm_lapic_get_reg(apic, APIC_TMICT));
 
@@ -2044,10 +2059,8 @@ static bool set_target_expiration(struct kvm_lapic *apic, u32 count_reg)
 		}
 	}
 
-	apic->lapic_timer.tscdeadline = kvm_read_l1_tsc(apic->vcpu, tscl) +
-		nsec_to_cycles(apic->vcpu, deadline);
-	apic->lapic_timer.target_expiration = ktime_add_ns(now, deadline);
-
+	apic->lapic_timer.target_expiration = ktime_add_ns(ktime_get(), deadline);
+	apic->lapic_timer.tscdeadline = ns_to_tsc_deadline(apic, deadline);
 	return true;
 }
 
@@ -2055,7 +2068,6 @@ static void advance_periodic_target_expiration(struct kvm_lapic *apic)
 {
 	struct kvm_timer *ktimer = &apic->lapic_timer;
 	ktime_t now = ktime_get();
-	u64 tscl = rdtsc();
 	ktime_t delta;
 
 	/*
@@ -2086,8 +2098,7 @@ static void advance_periodic_target_expiration(struct kvm_lapic *apic)
 	 * excessively large due to it an unsigned value.
 	 */
 	delta = ktime_sub(ktimer->target_expiration, now);
-	ktimer->tscdeadline = kvm_read_l1_tsc(apic->vcpu, tscl) +
-			      nsec_to_cycles(apic->vcpu, delta);
+	ktimer->tscdeadline = ns_to_tsc_deadline(apic, ktime_to_ns(delta));
 }
 
 static void start_sw_period(struct kvm_lapic *apic)
-- 
2.56.1



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

* [PATCH 6.6.y 05/17] KVM: x86: Reset local APIC timer metadata on RESET, INIT, and KVM_SET_LAPIC
       [not found] <20261204180337.2168031-1-pbonzini@redhat.com>
  2026-12-04 18:03 ` [PATCH 6.6.y 02/17] KVM: x86/mmu: Flush TLBs if child SPTE is zapped when splitting a huge SPTE Paolo Bonzini
  2026-12-04 18:03 ` [PATCH 6.6.y 04/17] KVM: x86: Disable hypervisor (VMX Preemption) timer if TSC deadline wraps Paolo Bonzini
@ 2026-12-04 18:03 ` Paolo Bonzini
  2026-12-04 18:03 ` [PATCH 6.6.y 06/17] KVM: x86/mmu: Flush all TLB entries, not a precise range, when yielding Paolo Bonzini
                   ` (9 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: Paolo Bonzini @ 2026-12-04 18:03 UTC (permalink / raw)
  To: linux-kernel, kvm
  Cc: Sean Christopherson, Stefan Teodorescu, David Woodhouse, stable

From: Sean Christopherson <seanjc@google.com>

[ Upstream commit c876175f4bb87e3e19c6ecdf9b67beb895fe8bda ]

Reset all of the local APIC timer's metadata that's tied to the current
state of the timer on INIT (and RESET) and KVM_SET_LAPIC, *except* for the
TSC deadline when doing KVM_SET_LAPIC, as kvm_timer.tscdeadline subtly
holds/tracks the value of MSR_IA32_TSC_DEADLINE and isn't computed by
__start_apic_timer().  In particular, leaving the target expiration as-is
allows a misbehaving guest to induce a divide error by overflowing a u64.

After INIT (or RESET), the divide count register is '0', which translates
to an actual divisor of '2'.  The other divisors are 1, 4, 8, 16, 32, 64,
and 128, so the guest can scale the target_expiration from 2x-64x after
every INIT (or cut it in half, but that's uninteresting).  After enough
multiplications, things go kablooie.  E.g. setting the target_expiration
to -1u (TMICT is a 32-bit value) and then scaling by 64x via a divisor
of 128 generates a #DE after 6 rounds of INIT:

  Oops: divide error: 0000 [#1] SMP
  CPU: 0 UID: 1000 PID: 604 Comm: div_error Not tainted 7.3.0-rc7-e86da2bfcc430-sink-all #7307 PREEMPTLAZY
  Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 0.0.0 02/06/2015
  RIP: 0010:kvm_lapic_reg_write+0x364/0x7d0 [kvm]
   <TASK>
   kvm_set_msr_common+0x649/0x1540 [kvm]
   vmx_set_msr+0xdb5/0x13a0 [kvm_intel]
   __kvm_set_msr+0xc4/0x2a0 [kvm]
   kvm_set_msr_ignored_check+0x1d/0x140 [kvm]
   __kvm_emulate_wrmsr+0x36/0x170 [kvm]
   vt_handle_exit+0x1e/0x50 [kvm_intel]
   kvm_arch_vcpu_ioctl_run+0x972/0x21c0 [kvm]
   kvm_vcpu_ioctl+0x2c7/0x960 [kvm]
   __x64_sys_ioctl+0x90/0xd0
   do_syscall_64+0x9c/0x4d0
   entry_SYSCALL_64_after_hwframe+0x4b/0x53
  RIP: 0033:0x421d1b
   </TASK>
  Modules linked in: kvm_intel kvm irqbypass

Opportunistically purge the target_expiration and expired_tscdeadline when
the timer mode changes to/from deadline mode, even though that path should
be fine (it doesn't interact with the divide count).

Fixes: c301b909e4b9 ("KVM: LAPIC: Apply change to TDCR right away to the timer")
Reported-by: Stefan Teodorescu <fane@google.com>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: stable@vger.kernel.org
Signed-off-by: Sean Christopherson <seanjc@google.com>
Link: https://patch.msgid.link/20261028183358.1798566-3-seanjc@google.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 arch/x86/kvm/lapic.c | 30 ++++++++++++++++++++++--------
 1 file changed, 22 insertions(+), 8 deletions(-)

diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c
index 1fdb3f396d72..61d70cf48bf0 100644
--- a/arch/x86/kvm/lapic.c
+++ b/arch/x86/kvm/lapic.c
@@ -1763,6 +1763,23 @@ static void cancel_apic_timer(struct kvm_lapic *apic)
 	atomic_set(&apic->lapic_timer.pending, 0);
 }
 
+static void __kvm_lapic_reset_timer(struct kvm_lapic *apic)
+{
+	struct kvm_timer *ktimer = &apic->lapic_timer;
+
+	cancel_apic_timer(apic);
+
+	ktimer->period = 0;
+	ktimer->target_expiration = 0;
+	ktimer->expired_tscdeadline = 0;
+}
+
+static void kvm_lapic_reset_timer(struct kvm_lapic *apic)
+{
+	__kvm_lapic_reset_timer(apic);
+	apic->lapic_timer.tscdeadline = 0;
+}
+
 static void apic_update_lvtt(struct kvm_lapic *apic)
 {
 	u32 timer_mode = kvm_lapic_get_reg(apic, APIC_LVTT) &
@@ -1771,10 +1788,8 @@ static void apic_update_lvtt(struct kvm_lapic *apic)
 	if (apic->lapic_timer.timer_mode != timer_mode) {
 		if (apic_lvtt_tscdeadline(apic) != (timer_mode ==
 				APIC_LVT_TIMER_TSCDEADLINE)) {
-			cancel_apic_timer(apic);
+			kvm_lapic_reset_timer(apic);
 			kvm_lapic_set_reg(apic, APIC_TMICT, 0);
-			apic->lapic_timer.period = 0;
-			apic->lapic_timer.tscdeadline = 0;
 		}
 		apic->lapic_timer.timer_mode = timer_mode;
 		limit_periodic_timer_frequency(apic);
@@ -2769,8 +2784,7 @@ void kvm_lapic_reset(struct kvm_vcpu *vcpu, bool init_event)
 	if (!apic)
 		return;
 
-	/* Stop the timer in case it's a reset to an active apic */
-	hrtimer_cancel(&apic->lapic_timer.timer);
+	kvm_lapic_reset_timer(apic);
 
 	/* The xAPIC ID is set at RESET even if the APIC was already enabled. */
 	if (!init_event)
@@ -2807,7 +2821,6 @@ void kvm_lapic_reset(struct kvm_vcpu *vcpu, bool init_event)
 	}
 	kvm_apic_update_apicv(vcpu);
 	update_divide_count(apic);
-	atomic_set(&apic->lapic_timer.pending, 0);
 
 	vcpu->arch.pv_eoi.msr_val = 0;
 	apic_update_ppr(apic);
@@ -3096,6 +3109,9 @@ int kvm_apic_set_state(struct kvm_vcpu *vcpu, struct kvm_lapic_state *s)
 		kvm_recalculate_apic_map(vcpu->kvm);
 		return r;
 	}
+
+	__kvm_lapic_reset_timer(apic);
+
 	memcpy(vcpu->arch.apic->regs, s->regs, sizeof(*s));
 
 	atomic_set_release(&apic->vcpu->kvm->arch.apic_map_dirty, DIRTY);
@@ -3103,8 +3119,6 @@ int kvm_apic_set_state(struct kvm_vcpu *vcpu, struct kvm_lapic_state *s)
 	kvm_apic_set_version(vcpu);
 
 	apic_update_ppr(apic);
-	cancel_apic_timer(apic);
-	apic->lapic_timer.expired_tscdeadline = 0;
 	apic_update_lvtt(apic);
 	apic_manage_nmi_watchdog(apic, kvm_lapic_get_reg(apic, APIC_LVT0));
 	update_divide_count(apic);
-- 
2.56.1



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

* [PATCH 6.6.y 06/17] KVM: x86/mmu: Flush all TLB entries, not a precise range, when yielding
       [not found] <20261204180337.2168031-1-pbonzini@redhat.com>
                   ` (2 preceding siblings ...)
  2026-12-04 18:03 ` [PATCH 6.6.y 05/17] KVM: x86: Reset local APIC timer metadata on RESET, INIT, and KVM_SET_LAPIC Paolo Bonzini
@ 2026-12-04 18:03 ` Paolo Bonzini
  2026-12-04 18:03 ` [PATCH 6.6.y 07/17] KVM: x86/mmu: Flush TLBs in kvm_unmap_gfn_range() if the unmap may block/yield Paolo Bonzini
                   ` (8 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: Paolo Bonzini @ 2026-12-04 18:03 UTC (permalink / raw)
  To: linux-kernel, kvm
  Cc: Kyle Zeng, stable, Kevin Liu, Stefan Teodorescu, Ulfar Erlingsson,
	Sean Christopherson

From: Kyle Zeng <kylebot@openai.com>

[ Upstream commit dc3709f44c9617c9fa6d5d0e71dc5b82f47a57b7 ]

Flush *all* TLB entries, not just the currently visible range of GFNs, when
yielding and dropping mmu_lock the shadow MMU, as a pending flush may cover
a bigger range than what is currently in scope, e.g. from a different
memslot or from a different page-table level.  Flushing only the range of
GFNs that are directly relevant to the current slot+level result in KVM
failing to TLB flush entries for previously-zapped SPTEs when running on
Hyper-V (the only time the range-based flushing is used).

Fixes: f285c633cb6d ("kvm: mmu: Used range based flushing in slot_handle_level_range")
Cc: stable@vger.kernel.org
Reported-by: Kevin Liu <kevin.liu@openai.com>
Reported-by: Stefan Teodorescu <fane@google.com>
Reported-by: Ulfar Erlingsson <ulfar@google.com>
Signed-off-by: Kyle Zeng <kylebot@openai.com>
[sean: split to separate patch, write changelog, rewrite comment, add more reporters]
Signed-off-by: Sean Christopherson <seanjc@google.com>
Link: https://patch.msgid.link/20261119172647.64295-4-seanjc@google.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 arch/x86/kvm/mmu/mmu.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c
index b79f937dd59e..b0ed5c2f1086 100644
--- a/arch/x86/kvm/mmu/mmu.c
+++ b/arch/x86/kvm/mmu/mmu.c
@@ -5954,8 +5954,12 @@ static __always_inline bool __walk_slot_rmaps(struct kvm *kvm,
 
 		if (need_resched() || rwlock_needbreak(&kvm->mmu_lock)) {
 			if (flush && flush_on_yield) {
-				kvm_flush_remote_tlbs_range(kvm, start_gfn,
-							    iterator.gfn - start_gfn + 1);
+				/*
+				 * DO NOT do a range-based flush, as the caller
+				 * may be zapping a range greater than what is
+				 * visible here!
+				 */
+				kvm_flush_remote_tlbs(kvm);
 				flush = false;
 			}
 			cond_resched_rwlock_write(&kvm->mmu_lock);
-- 
2.56.1



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

* [PATCH 6.6.y 07/17] KVM: x86/mmu: Flush TLBs in kvm_unmap_gfn_range() if the unmap may block/yield
       [not found] <20261204180337.2168031-1-pbonzini@redhat.com>
                   ` (3 preceding siblings ...)
  2026-12-04 18:03 ` [PATCH 6.6.y 06/17] KVM: x86/mmu: Flush all TLB entries, not a precise range, when yielding Paolo Bonzini
@ 2026-12-04 18:03 ` Paolo Bonzini
  2026-12-04 18:03 ` [PATCH 6.6.y 08/17] KVM: x86/xen: Pin kvm->mm prior to borrowing mm when setting event channel Paolo Bonzini
                   ` (7 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: Paolo Bonzini @ 2026-12-04 18:03 UTC (permalink / raw)
  To: linux-kernel, kvm
  Cc: Sean Christopherson, stable, Kevin Liu, Chris Mason, Kyle Zeng

From: Sean Christopherson <seanjc@google.com>

[ Upstream commit 27e2443f180a769a6e58a8f3821cacd01325bfc4 ]

Immediately flush TLBs if a flush is pending after unmapping a GFN range,
*before* returning to the caller, if the overall unmap operation may block,
i.e. if a *future* call to kvm_unmap_gfn_range() may yield and drop
mmu_lock.  Because kvm_unmap_gfn_range() starts with "flush = false", KVM
incorrectly loses track of the pending flush if an overall unmap operation
straddles multiple memslots.  KVM will still service the TLB flush before
the *caller* completes, but KVM relies on its mappings being completely
unreachable prior to dropping mmu_lock.

E.g. if a MMU notifier invalidation event runs after mmu_lock is dropped,
but before TLBs are flushed, then the MMU notifier task can observe the
missing PTE and return without issuing its own TLB flush, resulting in a
use-after-free (if the to-be-invalidated page was freed or moved).

Hack a fix into x86, but leave a TODO behind to undo the hack, or at least
make it less awful.  By dumb luck, x86 is the only arch that conditionally
yields *and* utilizes the common TLB flushing mechanism.

Fixes: e1eed5847b09 ("KVM: x86/mmu: Allow yielding during MMU notifier unmap/zap, if possible")
Cc: stable@vger.kernel.org
Reported-by: Kevin Liu <kevin.liu@openai.com>
Reported-by: Chris Mason <mason@kernel.org>
Cc: Kyle Zeng <kylebot@openai.com>
Signed-off-by: Sean Christopherson <seanjc@google.com>
Link: https://patch.msgid.link/20261119172647.64295-5-seanjc@google.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 arch/x86/kvm/mmu/mmu.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c
index b0ed5c2f1086..5a012d758c1e 100644
--- a/arch/x86/kvm/mmu/mmu.c
+++ b/arch/x86/kvm/mmu/mmu.c
@@ -1576,6 +1576,21 @@ bool kvm_unmap_gfn_range(struct kvm *kvm, struct kvm_gfn_range *range)
 	    range->slot->id == APIC_ACCESS_PAGE_PRIVATE_MEMSLOT)
 		kvm_make_all_cpus_request(kvm, KVM_REQ_APIC_PAGE_RELOAD);
 
+	/*
+	 * Immediately flush TLBs if a *future* invocation of the current unmap
+	 * operation may block, in which case the pending flush will be dropped
+	 * due to starting with "flush = false" above.
+	 *
+	 * TODO: Plumb @flush around common KVM so that pending flushes can be
+	 *       processed if and only if KVM actually yields, and so that this
+	 *       code doesn't rely on may_block being constant for the entirety
+	 *       of an unmap operation.
+	 */
+	if (flush && range->may_block) {
+		kvm_flush_remote_tlbs(kvm);
+		return false;
+	}
+
 	return flush;
 }
 
-- 
2.56.1



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

* [PATCH 6.6.y 08/17] KVM: x86/xen: Pin kvm->mm prior to borrowing mm when setting event channel
       [not found] <20261204180337.2168031-1-pbonzini@redhat.com>
                   ` (4 preceding siblings ...)
  2026-12-04 18:03 ` [PATCH 6.6.y 07/17] KVM: x86/mmu: Flush TLBs in kvm_unmap_gfn_range() if the unmap may block/yield Paolo Bonzini
@ 2026-12-04 18:03 ` Paolo Bonzini
  2026-12-04 18:03 ` [PATCH 6.6.y 09/17] KVM: Fold kvm_flush_shadow_all() into kvm_mmu_notifier_release() Paolo Bonzini
                   ` (6 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: Paolo Bonzini @ 2026-12-04 18:03 UTC (permalink / raw)
  To: linux-kernel, kvm; +Cc: Sean Christopherson, stable, Sashiko Bot

From: Sean Christopherson <seanjc@google.com>

[ Upstream commit d6d94b952ac457d3c34aad172cacf00ef01eef8c ]

When setting a Xen event channel from a kthread, get a reference to the
VM's mm prior to borrowing the mm, and bail with -EFAULT if the mm is dead
or dying.  The VM's irqfds are deactivated only when the VM itself is dying,
i.e. the worker can trigger event channel writes if the VM's process exits
before the VM itself is destroyed.

Note, there's no need to use mmput_async(), as kvm_xen_set_evtchn() borrows
an mm if and only if it's already running in a workqueue.

Fixes: 14243b387137 ("KVM: x86/xen: Add KVM_IRQ_ROUTING_XEN_EVTCHN and event channel delivery")
Cc: stable@vger.kernel.org
Reported-by: Sashiko Bot <sashiko-bot@kernel.org>
Signed-off-by: Sean Christopherson <seanjc@google.com>
Link: https://patch.msgid.link/20261120195742.55768-2-seanjc@google.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 arch/x86/kvm/xen.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/arch/x86/kvm/xen.c b/arch/x86/kvm/xen.c
index 335e046c6836..97cb4261d781 100644
--- a/arch/x86/kvm/xen.c
+++ b/arch/x86/kvm/xen.c
@@ -1685,6 +1685,9 @@ static int kvm_xen_set_evtchn(struct kvm_xen_evtchn *xe, struct kvm *kvm)
 		if (WARN_ON_ONCE(current->mm))
 			return -EINVAL;
 
+		if (!mmget_not_zero(kvm->mm))
+			return -EFAULT;
+
 		kthread_use_mm(kvm->mm);
 		mm_borrowed = true;
 	}
@@ -1720,8 +1723,10 @@ static int kvm_xen_set_evtchn(struct kvm_xen_evtchn *xe, struct kvm *kvm)
 
 	mutex_unlock(&kvm->arch.xen.xen_lock);
 
-	if (mm_borrowed)
+	if (mm_borrowed) {
 		kthread_unuse_mm(kvm->mm);
+		mmput(kvm->mm);
+	}
 
 	return rc;
 }
-- 
2.56.1



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

* [PATCH 6.6.y 09/17] KVM: Fold kvm_flush_shadow_all() into kvm_mmu_notifier_release()
       [not found] <20261204180337.2168031-1-pbonzini@redhat.com>
                   ` (5 preceding siblings ...)
  2026-12-04 18:03 ` [PATCH 6.6.y 08/17] KVM: x86/xen: Pin kvm->mm prior to borrowing mm when setting event channel Paolo Bonzini
@ 2026-12-04 18:03 ` Paolo Bonzini
  2026-12-04 18:03 ` [PATCH 6.6.y 11/17] KVM: WARN if there are in-flight memslot updates when a VM's process exits Paolo Bonzini
                   ` (5 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: Paolo Bonzini @ 2026-12-04 18:03 UTC (permalink / raw)
  To: linux-kernel, kvm; +Cc: Sean Christopherson, stable

From: Sean Christopherson <seanjc@google.com>

[ Upstream commit c9c6a91ce0371a7f951c3d2f2bad7bcead6a4840 ]

Fold kvm_flush_shadow_all() into kvm_mmu_notifier_release() now that all
all architectures use the generic mmu_notifier, i.e. all flow through
.release() when the VM and/or process is dying.  This will allow setting
mn_active_invalidate_count and _leaving_ it set when all SPTEs are zapped,
without having to worry about hypothetical scenarios where future KVM could
invoke kvm_flush_shadow_all() prior to the VM/process dying.

No functional change intended.

Cc: stable@vger.kernel.org
Signed-off-by: Sean Christopherson <seanjc@google.com>
Link: https://patch.msgid.link/20261120195742.55768-3-seanjc@google.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 virt/kvm/kvm_main.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index abbba4f8bf8a..f8f530859eca 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -393,11 +393,13 @@ void kvm_flush_remote_tlbs_memslot(struct kvm *kvm,
 	kvm_flush_remote_tlbs_range(kvm, memslot->base_gfn, memslot->npages);
 }
 
+#if !defined CONFIG_MMU_NOTIFIER || !defined KVM_ARCH_WANT_MMU_NOTIFIER
 static void kvm_flush_shadow_all(struct kvm *kvm)
 {
 	kvm_arch_flush_shadow_all(kvm);
 	kvm_arch_guest_memory_reclaimed(kvm);
 }
+#endif
 
 #ifdef KVM_ARCH_NR_OBJS_PER_MEMORY_CACHE
 static inline void *mmu_memory_cache_alloc_obj(struct kvm_mmu_memory_cache *mc,
@@ -914,7 +916,8 @@ static void kvm_mmu_notifier_release(struct mmu_notifier *mn,
 	int idx;
 
 	idx = srcu_read_lock(&kvm->srcu);
-	kvm_flush_shadow_all(kvm);
+	kvm_arch_flush_shadow_all(kvm);
+	kvm_arch_guest_memory_reclaimed(kvm);
 	srcu_read_unlock(&kvm->srcu, idx);
 }
 
-- 
2.56.1



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

* [PATCH 6.6.y 11/17] KVM: WARN if there are in-flight memslot updates when a VM's process exits
       [not found] <20261204180337.2168031-1-pbonzini@redhat.com>
                   ` (6 preceding siblings ...)
  2026-12-04 18:03 ` [PATCH 6.6.y 09/17] KVM: Fold kvm_flush_shadow_all() into kvm_mmu_notifier_release() Paolo Bonzini
@ 2026-12-04 18:03 ` Paolo Bonzini
  2026-12-04 18:03 ` [PATCH 6.6.y 12/17] KVM: Set mn_active_invalidate_count when the VM's mm is released Paolo Bonzini
                   ` (4 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: Paolo Bonzini @ 2026-12-04 18:03 UTC (permalink / raw)
  To: linux-kernel, kvm; +Cc: Sean Christopherson, stable

From: Sean Christopherson <seanjc@google.com>

[ Upstream commit fd00a80aa395b803832ebaf1c494d721e9483dbb ]

Move the sanity check on there being no outstanding memslot updates from VM
destruction to kvm_mmu_notifier_release(), i.e. WARN if there are
outstanding memslot updates when the VM is dying *or* the owning process is
exiting.  KVM subtly already guarantees (and relies on!) memslot updates to
be mutually exclusive with the mm dying.

If KVM unregistered its mmu_notifier between .invalidate_range_start() and
.invalidate_range_end(), then the invalidate count would be left elevated
until the VM is destroyed, but if there were an outstanding memslot update,
it would be impossible for the VM to be destroyed.

Opportunistically change the WARNs to WARN_ON_ONCE() so that a KVM bug
doesn't unintentionally DoS the host due to spamming dmesg (hanging a task
is bad enough).

Cc: stable@vger.kernel.org
Signed-off-by: Sean Christopherson <seanjc@google.com>
Link: https://patch.msgid.link/20261120195742.55768-4-seanjc@google.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 virt/kvm/kvm_main.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index c726e6469bf5..42e147975795 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -915,6 +915,14 @@ static void kvm_mmu_notifier_release(struct mmu_notifier *mn,
 	struct kvm *kvm = mmu_notifier_to_kvm(mn);
 	int idx;
 
+	/*
+	 * No threads can be waiting in kvm_swap_active_memslots() as KVM only
+	 * allows KVM_SET_USER_MEMORY_REGION{,2} in process context, and only
+	 * from the process that created the VM, i.e. to @mm.  If @mm is dying,
+	 * then there can't possibly be outstanding memslot updates.
+	 */
+	WARN_ON_ONCE(rcuwait_active(&kvm->mn_memslots_update_rcuwait));
+
 	idx = srcu_read_lock(&kvm->srcu);
 	kvm_arch_flush_shadow_all(kvm);
 	kvm_arch_guest_memory_reclaimed(kvm);
@@ -1338,7 +1346,6 @@ static void kvm_destroy_vm(struct kvm *kvm)
 	 * notifier between a start() and end(), then there shouldn't be any
 	 * in-progress invalidations.
 	 */
-	WARN_ON(rcuwait_active(&kvm->mn_memslots_update_rcuwait));
 	if (kvm->mn_active_invalidate_count)
 		kvm->mn_active_invalidate_count = 0;
 	else
-- 
2.56.1



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

* [PATCH 6.6.y 12/17] KVM: Set mn_active_invalidate_count when the VM's mm is released
       [not found] <20261204180337.2168031-1-pbonzini@redhat.com>
                   ` (7 preceding siblings ...)
  2026-12-04 18:03 ` [PATCH 6.6.y 11/17] KVM: WARN if there are in-flight memslot updates when a VM's process exits Paolo Bonzini
@ 2026-12-04 18:03 ` Paolo Bonzini
  2026-12-04 18:03 ` [PATCH 6.6.y 13/17] KVM: Invalidate all GFN=>PFN caches when VM and/or its process is dying Paolo Bonzini
                   ` (3 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: Paolo Bonzini @ 2026-12-04 18:03 UTC (permalink / raw)
  To: linux-kernel, kvm; +Cc: Sean Christopherson, stable

From: Sean Christopherson <seanjc@google.com>

[ Upstream commit fca5e4804655f39e40cf302ca37f6bd35445881b ]

Set mn_active_invalidate_count permanently (until the VM is destroyed) when
the VM's mmu_notifier release() hook is called, i.e. when the VM and/or its
process is dying.  This will allow using gfn_to_pfn_cache_invalidate_start()
more or less verbatim to invalidate all GPCs on .release(), without having
to play games with the sequence count.  As pointed out by Sashiko, a racing
hva_to_pfn_retry() could set its GPC valid after re-acquiring gpc->lock if
it's not forced to retry.

Isolate the mn_active_invalidate_count change on the off chance it causes
problems.  Elevating mn_active_invalidate_count should be a-ok because it's
already possible for kvm_mmu_notifier_release() to run while the count is
elevated *and* cause it to remain elevated, as .release() can be called
between .invalidate_range_start() and .invalidate_range_end().  If that
happens, the matching end() will never occur, but kvm_destroy_vm() will
squash the count before freeing memslots.  Note, there can't be any
in-flight memslot updates when .release() runs, as KVM only does memslot
updates from process context (except for the kvm_destroy_vm() case).

Adjust the sanity check on in-progress invalidations to account for an
invalidate count of '1' now being the effective baseline when the VM is
being destroyed.

Opportunistically tweak the comment to call out that unregistering the MMU
notifier between start() and end() doesn't *guarantee* KVM should observe
an in-progress invalidation, because KVM tracks those invalidations if and
only if there is a relevant memslot.

Opportunistically add a TODO to call out that KVM can stop squashing the
invalidate count once x86 stops abusing internal memslot updates to unmap
VMAs for KVM-internal memslots[*].

Link: https://lore.kernel.org/all/20261030212112.2598640-7-seanjc@google.com [*]
Cc: stable@vger.kernel.org
Signed-off-by: Sean Christopherson <seanjc@google.com>
Link: https://patch.msgid.link/20261120195742.55768-5-seanjc@google.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 virt/kvm/kvm_main.c | 42 ++++++++++++++++++++++++++++--------------
 1 file changed, 28 insertions(+), 14 deletions(-)

diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index 42e147975795..193c0dfea928 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -923,6 +923,16 @@ static void kvm_mmu_notifier_release(struct mmu_notifier *mn,
 	 */
 	WARN_ON_ONCE(rcuwait_active(&kvm->mn_memslots_update_rcuwait));
 
+	/*
+	 * Elevate the invalidate count to prevent concurrent walks of the user
+	 * page tables from fully succeeding if they race with teardown of the
+	 * page tables.  The elevated count will force lookups to always retry,
+	 * until eventually the lookup fails outright after teardown completes.
+	 */
+	spin_lock(&kvm->mn_invalidate_lock);
+	kvm->mn_active_invalidate_count++;
+	spin_unlock(&kvm->mn_invalidate_lock);
+
 	idx = srcu_read_lock(&kvm->srcu);
 	kvm_arch_flush_shadow_all(kvm);
 	kvm_arch_guest_memory_reclaimed(kvm);
@@ -1334,22 +1344,26 @@ static void kvm_destroy_vm(struct kvm *kvm)
 	kvm_coalesced_mmio_free(kvm);
 #if defined(CONFIG_MMU_NOTIFIER) && defined(KVM_ARCH_WANT_MMU_NOTIFIER)
 	mmu_notifier_unregister(&kvm->mmu_notifier, kvm->mm);
+
 	/*
-	 * At this point, pending calls to invalidate_range_start()
-	 * have completed but no more MMU notifiers will run, so
-	 * mn_active_invalidate_count may remain unbalanced.
-	 * No threads can be waiting in kvm_swap_active_memslots() as the
-	 * last reference on KVM has been dropped, but freeing
-	 * memslots would deadlock without this manual intervention.
-	 *
-	 * If the count isn't unbalanced, i.e. KVM did NOT unregister its MMU
-	 * notifier between a start() and end(), then there shouldn't be any
-	 * in-progress invalidations.
+	 * Sanity check KVM's tracking and internal use of start()+end(), e.g.
+	 * to detect a unpaired start() or end().  KVM increments the count in
+	 * kvm_mmu_notifier_release(), so the count must be at least 1; and
+	 * if kvm->mmu_invalidate_in_progress is set, then KVM unregistered
+	 * its MMU notifier between kvm_mmu_invalidate_range_start() and
+	 * kvm_mmu_invalidate_range_end(), so kvm->mn_active_invalidate_count must
+	 * have been elevated further by kvm_mmu_notifier_invalidate_range_start().
 	 */
-	if (kvm->mn_active_invalidate_count)
-		kvm->mn_active_invalidate_count = 0;
-	else
-		WARN_ON(kvm->mmu_invalidate_in_progress);
+	WARN_ON_ONCE(kvm->mn_active_invalidate_count < 1 + !!kvm->mmu_invalidate_in_progress);
+
+	/*
+	 * Squash the invalidate count so that arch code can update memslots
+	 * as part of VM destruction.
+	 *
+	 * TODO: Drop this once KVM x86 no longer relies on setting internal
+	 *       memslots to munmap() the corresponding VMAs.
+	 */
+	kvm->mn_active_invalidate_count = 0;
 #else
 	kvm_flush_shadow_all(kvm);
 #endif
-- 
2.56.1



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

* [PATCH 6.6.y 13/17] KVM: Invalidate all GFN=>PFN caches when VM and/or its process is dying
       [not found] <20261204180337.2168031-1-pbonzini@redhat.com>
                   ` (8 preceding siblings ...)
  2026-12-04 18:03 ` [PATCH 6.6.y 12/17] KVM: Set mn_active_invalidate_count when the VM's mm is released Paolo Bonzini
@ 2026-12-04 18:03 ` Paolo Bonzini
  2026-12-04 18:03 ` [PATCH 6.6.y 14/17] x86/fpu: Bail early from guest XFD update if XFD isn't supported Paolo Bonzini
                   ` (2 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: Paolo Bonzini @ 2026-12-04 18:03 UTC (permalink / raw)
  To: linux-kernel, kvm
  Cc: Sean Christopherson, stable, Amirmohammad Eftekhar, Chris Mason

From: Sean Christopherson <seanjc@google.com>

[ Upstream commit c4424cbaaf04f3d3113d838ef836529a533b390a ]

Invalidate all GPCs in kvm_flush_shadow_all(), i.e. when a VM or its owning
process is dying, to ensure a GPC can't be used after the associated mm has
exited, e.g. via a timer callback.  Take care to invalidate the caches
before notifying arch code that memory has been reclaimed, as all in-flight
accesses must complete before KVM SEV performs cache maintenance on the
affected memory.

  BUG: KASAN: use-after-free in kvm_xen_set_evtchn_fast+0x3fe/0xfd0 [kvm]
  Write of size 8 at addr ffff88852702c800 by task swapper/4/0
  CPU: 4 UID: 0 PID: 0 Comm: swapper/4 Not tainted 7.3.0-rc3-master-g587858367581-dirty-kasan #1 PREEMPT(lazy)
  Hardware name: LENOVO 21HMCTO1WW/21HMCTO1WW, BIOS N3XET48W (1.23 ) 11/01/2023
  Call Trace:
   <IRQ>
   dump_stack_lvl+0x91/0xf0
   print_report+0xd1/0x630
   kasan_report+0xf3/0x130
   kasan_check_range+0x11c/0x200
   __kasan_check_write+0x14/0x30
   kvm_xen_set_evtchn_fast+0x3fe/0xfd0 [kvm]
   xen_timer_callback+0x1eb/0x2b0 [kvm]
   __hrtimer_run_queues+0x43e/0x8b0
   hrtimer_interrupt+0x3aa/0xa00
   __sysvec_apic_timer_interrupt+0xc1/0x3a0
   sysvec_apic_timer_interrupt+0x8d/0xd0
   </IRQ>
   <TASK>
   asm_sysvec_apic_timer_interrupt+0x1b/0x20
  The buggy address belongs to the physical page:
  page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x7965608db pfn:0x52702c
  flags: 0x17ffffc0000000(node=0|zone=2|lastcpupid=0x1fffff)
  raw: 0017ffffc0000000 ffffea0014864108 ffffea001c118e48 0000000000000000
  raw: 00000007965608db 0000000000000000 00000000ffffffff 0000000000000000
  page dumped because: kasan: bad access detected

Alternatively, invalidate_all() could reuse invalidate_start(), but that'd
require tweaking invalidate_start() to special case "all", as simply
in 0=>ULONG_MAX is subtly misleading/wrong.  Because invalidate_start()
takes an exclusive @end, using ULONG_MAX wouldn't strictly guarantee that
all GPCs are invalidated.  That's somewhat of a moot point since GPCs only
ever deal with user addresses and CONFIG_HAVE_KVM_PFNCACHE is only selected
by x86, which guarantees ULONG_MAX is a kernel address.  But getting the
logic "right" the first time is easy enough.

Reusing invalidate_start() would also be suboptimal, as it requires taking
the per-GPC lock twice.  That's extremely unlikely to matter in practice,
but again, open coding invalidate_all() isn't complex, and avoids making
invalidate_start() itself (slightly) more complex.

Fixes: 982ed0de4753 ("KVM: Reinstate gfn_to_pfn_cache with invalidation support")
Cc: stable@vger.kernel.org
Reported-by: Amirmohammad Eftekhar <amirmohammad.eftekhar@cispa.de>
Closes: https://lore.kernel.org/all/20261017193911.40182-1-amirmohammad.eftekhar@cispa.de
Suggested-by: Amirmohammad Eftekhar <amirmohammad.eftekhar@cispa.de>
Reported-by: Chris Mason <mason@kernel.org>
Suggested-by: Chris Mason <mason@kernel.org>
Signed-off-by: Sean Christopherson <seanjc@google.com>
Link: https://patch.msgid.link/20261120195742.55768-6-seanjc@google.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 virt/kvm/kvm_main.c |  1 +
 virt/kvm/kvm_mm.h   |  2 ++
 virt/kvm/pfncache.c | 12 ++++++++++++
 3 files changed, 15 insertions(+)

diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index 193c0dfea928..b8ec5dbf5882 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -935,6 +935,7 @@ static void kvm_mmu_notifier_release(struct mmu_notifier *mn,
 
 	idx = srcu_read_lock(&kvm->srcu);
 	kvm_arch_flush_shadow_all(kvm);
+	gfn_to_pfn_cache_invalidate_all(kvm);
 	kvm_arch_guest_memory_reclaimed(kvm);
 	srcu_read_unlock(&kvm->srcu, idx);
 }
diff --git a/virt/kvm/kvm_mm.h b/virt/kvm/kvm_mm.h
index 180f1a09e6ba..fee29e7e20ae 100644
--- a/virt/kvm/kvm_mm.h
+++ b/virt/kvm/kvm_mm.h
@@ -28,6 +28,7 @@ void gfn_to_pfn_cache_invalidate_start(struct kvm *kvm,
 				       unsigned long start,
 				       unsigned long end,
 				       bool may_block);
+void gfn_to_pfn_cache_invalidate_all(struct kvm *kvm);
 #else
 static inline void gfn_to_pfn_cache_invalidate_start(struct kvm *kvm,
 						     unsigned long start,
@@ -35,6 +36,7 @@ static inline void gfn_to_pfn_cache_invalidate_start(struct kvm *kvm,
 						     bool may_block)
 {
 }
+static inline void gfn_to_pfn_cache_invalidate_all(struct kvm *kvm) { }
 #endif /* HAVE_KVM_PFNCACHE */
 
 #endif /* __KVM_MM_H__ */
diff --git a/virt/kvm/pfncache.c b/virt/kvm/pfncache.c
index 2d6aba677830..de2c33ee7b8b 100644
--- a/virt/kvm/pfncache.c
+++ b/virt/kvm/pfncache.c
@@ -19,6 +19,18 @@
 
 #include "kvm_mm.h"
 
+void gfn_to_pfn_cache_invalidate_all(struct kvm *kvm)
+{
+	struct gfn_to_pfn_cache *gpc;
+
+	guard(spinlock)(&kvm->gpc_lock);
+
+	list_for_each_entry(gpc, &kvm->gpc_list, list) {
+		guard(write_lock_irq)(&gpc->lock);
+		gpc->valid = false;
+	}
+}
+
 /*
  * MMU notifier 'invalidate_range_start' hook.
  */
-- 
2.56.1



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

* [PATCH 6.6.y 14/17] x86/fpu: Bail early from guest XFD update if XFD isn't supported
       [not found] <20261204180337.2168031-1-pbonzini@redhat.com>
                   ` (9 preceding siblings ...)
  2026-12-04 18:03 ` [PATCH 6.6.y 13/17] KVM: Invalidate all GFN=>PFN caches when VM and/or its process is dying Paolo Bonzini
@ 2026-12-04 18:03 ` Paolo Bonzini
  2026-12-04 18:03 ` [PATCH 6.6.y 16/17] x86/fpu: Ensure guest FPU is resident in hardware when updating actual XFD MSR Paolo Bonzini
  2026-12-04 18:03 ` [PATCH 6.6.y 17/17] KVM: VMX: Ensure pCPU is valid before sending IPI to deliver posted IRQ Paolo Bonzini
  12 siblings, 0 replies; 14+ messages in thread
From: Paolo Bonzini @ 2026-12-04 18:03 UTC (permalink / raw)
  To: linux-kernel, kvm; +Cc: Sean Christopherson, stable, Jim Mattson

From: Sean Christopherson <seanjc@google.com>

[ Upstream commit 389bafa29e91827ee95127c40893e64295e4499f ]

As is, KVM allows userspace to set guest XFD to 0 even if XFD isn't
supported; KVM unarguably shouldn't try to update guest XFD when the
kernel doesn't support XFD/XSAVE, but fixing that flaw could potentially
impact KVM's uABI.  Thus, ignore KVM-requested guest XFD updates if the
kernel doesn't support XFD.

The current code is subtly fine and does not corrupt guest_fpu->fpstate
by interpreting it as an xstate structure; xsave.header.xfeatures is
modified if and only if xfd != 0, which KVM does reject.  Still, it's
more defensive to return early and WARN if XFD is not set to 0.

Cc: stable@vger.kernel.org
Reported-by: Jim Mattson <jmattson@google.com>
Signed-off-by: Sean Christopherson <seanjc@google.com>
Link: https://patch.msgid.link/20261119001506.64568-2-seanjc@google.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 arch/x86/kernel/fpu/core.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/arch/x86/kernel/fpu/core.c b/arch/x86/kernel/fpu/core.c
index 75dad6e3c984..96d0b4dbe78c 100644
--- a/arch/x86/kernel/fpu/core.c
+++ b/arch/x86/kernel/fpu/core.c
@@ -296,6 +296,11 @@ void fpu_update_guest_xfd(struct fpu_guest *guest_fpu, u64 xfd)
 {
 	struct fpstate *fpstate = guest_fpu->fpstate;
 
+	if (!cpu_feature_enabled(X86_FEATURE_XFD)) {
+		WARN_ON_ONCE(xfd);
+		return;
+	}
+
 	fpregs_lock();
 
 	/*
-- 
2.56.1



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

* [PATCH 6.6.y 16/17] x86/fpu: Ensure guest FPU is resident in hardware when updating actual XFD MSR
       [not found] <20261204180337.2168031-1-pbonzini@redhat.com>
                   ` (10 preceding siblings ...)
  2026-12-04 18:03 ` [PATCH 6.6.y 14/17] x86/fpu: Bail early from guest XFD update if XFD isn't supported Paolo Bonzini
@ 2026-12-04 18:03 ` Paolo Bonzini
  2026-12-04 18:03 ` [PATCH 6.6.y 17/17] KVM: VMX: Ensure pCPU is valid before sending IPI to deliver posted IRQ Paolo Bonzini
  12 siblings, 0 replies; 14+ messages in thread
From: Paolo Bonzini @ 2026-12-04 18:03 UTC (permalink / raw)
  To: linux-kernel, kvm
  Cc: Sean Christopherson, stable, Stefan Teodorescu, Chris Mason,
	Josef Bacik, David Woodhouse, Jim Mattson, Dave Hansen

From: Sean Christopherson <seanjc@google.com>

[ Upstream commit 98d7c3da6a83babc4b209656411adde144ba9ece ]

When updating a guest FPU's XFD, ensure the guest FPU state is resident in
hardware.  Failure to do so means updating XFD may effectively clobber XFD,
and in the worst case scenario can lead to an #NM due to failing to update
XFD.  Specifically, if the guest FPU is in-use (associated with the current
task) and the current task has TIF_NEED_FPU_LOAD, then lock and load the
task's FPU regs.

The underlying issue is that TIF_NEED_FPU_LOAD doesn't actually mean the
FPU isn't resident in hardware, it only says the FPU *might* not be resident
in hardware and *may* need a reload.  E.g. if the current task was tagged
with TIF_NEED_FPU_LOAD by switch_fpu(), but never evicted from hardware,
then KVM's call to switch_fpu_return() will elide the xfd_update_state()
call (and the XRSTOR) due to the FPU being valid, and run the vCPU with a
stale XFD.

E.g. on a single pCPU 'A', timeshared by two vCPUs:

  vcpu0 / fpu0                          vcpu1 / fpu1
                                        TIF_NEED_FPU_LOAD = 1
                                        <schedules out>
  dirty TMM0 (XINUSE[18] == 1)
  wrmsr(MSR_IA32_XFD, 0x40000)
  fpu_sync_guest_vmexit_xfd_state()
  <schedules out>
  TIF_NEED_FPU_LOAD = 1 (switch_fpu())
  fpu_fpregs_owner_ctx = fpu0
  fpu0->last_cpu = A
                                        <schedules in>
                                        fpu_update_guest_xfd(fpu1, 0)
                                        wrmsrq(MSR_IA32_XFD, 0)
  fpregs_state_valid() == true
  |
  -> switch_fpu_return() skips
     restore_fpregs_from_fpstate() and
     xfd_update_state()

  fpu_swap_kvm_fpstate() (exit to user)
  |
  -> fpu0->regs.xsave.header.xfeatures
     is saved with XSTATE_BV[18] = 1

  fpu_swap_kvm_fpstate() (entry from user)
  |
  -> restore_fpregs_from_fpstate() => #NM

Alternatively, fpu_update_guest_xfd() could skip xfd_update_state() *and*
force an invalidation of the current FPU (set last_cpu = -1) to ensure the
correct XFD is loaded when doing switch_fpu_return().  However, that gets
all kinds of convoluted, and emulating an XFD write with TIF_NEED_FPU_LOAD=1
is very uncommon, and in all likelihood the guest FPU is going to be loaded
into hardware in the near future anyways, i.e. avoiding (maybe) loading the
guest FPU buys nothing but complexity.

Fixes: b45f72177594 ("x86/fpu: Clear XSTATE_BV[i] in guest XSAVE state whenever XFD[i]=1")
Cc: stable@vger.kernel.org
Reported-by: Stefan Teodorescu <fane@google.com>
Suggested-by: Stefan Teodorescu <fane@google.com>
Reported-by: Chris Mason <mason@kernel.org>
Suggested-by: Chris Mason <mason@kernel.org>
Cc: Josef Bacik <josef@toxicpanda.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: Jim Mattson <jmattson@google.com>
Acked-by: Dave Hansen <dave.hansen@linux.intel.com>
Signed-off-by: Sean Christopherson <seanjc@google.com>
Link: https://patch.msgid.link/20261119001506.64568-4-seanjc@google.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 arch/x86/kernel/fpu/core.c | 21 ++++++++++-----------
 1 file changed, 10 insertions(+), 11 deletions(-)

diff --git a/arch/x86/kernel/fpu/core.c b/arch/x86/kernel/fpu/core.c
index 84822f9e2dc4..f87d279be54b 100644
--- a/arch/x86/kernel/fpu/core.c
+++ b/arch/x86/kernel/fpu/core.c
@@ -319,19 +319,18 @@ void fpu_update_guest_xfd(struct fpu_guest *guest_fpu, u64 xfd)
 	}
 
 	/*
-	 * If the guest's FPU state is in hardware, just update XFD: the XSAVE
-	 * in fpu_swap_kvm_fpstate will clear XSTATE_BV[i] whenever XFD[i]=1.
-	 *
-	 * If however the guest's FPU state is NOT resident in hardware, clear
-	 * disabled components in XSTATE_BV now, or a subsequent XRSTOR will
-	 * attempt to load disabled components and generate #NM _in the host_.
+	 * If the guest's FPU state is in-use, then ensure the state is resident
+	 * in hardware and simply update XFD.  The guest is responsible for
+	 * clearing disabled components when doing its own XRSTOR operations,
+	 * and the XSAVE in fpu_swap_kvm_fpstate() when putting the guest FPU
+	 * will clear XSTATE_BV[i] whenever XFD[i]=1.
+	 */
+	fpregs_lock_and_load();
+	/*
+	 * Update XFD *after* loading FPU state, otherwise XRSTOR would try to
+	 * load XSTATE saved with the old XFD, but using the new XFD.
 	 */
-	fpregs_lock();
 	fpstate->xfd = xfd;
-
-	if (xfd && test_thread_flag(TIF_NEED_FPU_LOAD))
-		fpstate->regs.xsave.header.xfeatures &= ~xfd;
-
 	xfd_update_state(fpstate);
 	fpregs_unlock();
 }
-- 
2.56.1



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

* [PATCH 6.6.y 17/17] KVM: VMX: Ensure pCPU is valid before sending IPI to deliver posted IRQ
       [not found] <20261204180337.2168031-1-pbonzini@redhat.com>
                   ` (11 preceding siblings ...)
  2026-12-04 18:03 ` [PATCH 6.6.y 16/17] x86/fpu: Ensure guest FPU is resident in hardware when updating actual XFD MSR Paolo Bonzini
@ 2026-12-04 18:03 ` Paolo Bonzini
  12 siblings, 0 replies; 14+ messages in thread
From: Paolo Bonzini @ 2026-12-04 18:03 UTC (permalink / raw)
  To: linux-kernel, kvm
  Cc: Sean Christopherson, stable, Stefan Teodorescu, Sagi Shahar

From: Sean Christopherson <seanjc@google.com>

[ Upstream commit 55abfb5917d39e9511ca89d37f86cdc3a1d1797b ]

Verify the target pCPU is valid before sending an IPI to trigger CPU=>CPU
posted IRQ processing, as TDX invalidates vcpu->cpu when disassociating a
pCPU from a vCPU.  Ensure the relevant reads and writes are performed once,
to prevent vcpu->cpu from being re-read after it's been validated.

If a TDX vCPU's task is migrated immediately after a VM-Exit, and the CPU
sending the IPI is sufficiently delayed, KVM will attempt to send an IPI to
pCPU '-1', generate an out-of-bounds read, and ultimately crash.

  BUG: unable to handle page fault for address: ffffffff88021be8
  #PF: supervisor read access in kernel mode
  #PF: error_code(0x0000) - not-present page
  PGD 10a0815067 P4D 10a0815067 PUD 0
  Oops: 0000 [#1] SMP NOPTI
  CPU: 0 PID: 173535 Comm: repro Tainted: G           O       6.6.103-smp-1301.106.448.13 #1
  Hardware name: Google Izumi/Izumi, BIOS 0.20260728.0-16 07/28/2026
  RIP: 0010:memcpy+0xc/0x20
  Call Trace:
   <TASK>
   ? __x2apic_send_IPI_mask+0x71/0x160
   tdx_deliver_interrupt+0x75/0xe0 [kvm_intel]
   __apic_accept_irq+0xdf/0x240 [kvm]
   kvm_irq_delivery_to_apic+0x1df/0x2e0 [kvm]
   kvm_apic_send_ipi+0xa3/0x100 [kvm]
   kvm_x2apic_icr_write+0x47/0xc0 [kvm]
   __kvm_set_msr+0xa0/0x1c0 [kvm]
   kvm_set_msr_ignored_check+0x18/0xf0 [kvm]
   kvm_emulate_wrmsr+0x74/0x180 [kvm]
   tdx_handle_exit+0x238/0x13a0 [kvm_intel]

Note, using the "mask" variant to send the IPI is stupid and inefficient,
and actively contributed to making the bug worse.  Because TDX requires
x2APIC, if KVM had used the more obvious send_IPI(), then attempting to
send an IPI to '-1' would have morphed into a broadcast the IRQ to all CPUs
instead of an out-of-bounds read.  That wart will be fixed shortly.

Note #2, the flaw has existed since commit 705699a13994 ("KVM: nVMX: Enable
nested posted interrupt processing"), but was unreachable until TDX came
along and invalidated the CPU of a live vCPU.

Note #3, __kvm_vcpu_kick() and kvm_make_vcpu_request() already guard
against an invalid pCPU.

Note #4, tdx_vcpu_free() checks vcpu->cpu without using READ_ONCE(), but
that's a-ok since the vCPU is unreachable, i.e. vcpu->cpu can't change.

Note #5, invalidating vcpu->cpu probably means TDX is triggering a VM-wide
blast of IPIs to do KVM_REQ_GLOBAL_CLOCK_UPDATE => KVM_REQ_CLOCK_UPDATE,
because kvm_arch_vcpu_load() thinks the vCPU has never been loaded on any
CPU.  That too will be fixed in the near future.

Note #6, related to note #5, invoking kvm_x86_call(vcpu_load)(vcpu, cpu) in
the middle of kvm_arch_vcpu_load() changes vcpu->cpu to -1 for TDX vCPUs,
i.e. fixing that would fix #5 as well (although it's simpler to just make
the request during vCPU creation).

Note #7, the only reason reading vcpu->cpu multiple times when loading a
vCPU isn't completely broken is because loading a vCPU is mutually
exclusive with disassociating a vCPU from a pCPU, outside of the
aforementioned self-induced pain with .vcpu_load(), thanks to commit
15945e9ec195 ("KVM: TDX: Guard VM state transitions with "all" the locks").

Fixes: d789fa6efac9 ("KVM: TDX: Handle vCPU dissociation")
Cc: stable@vger.kernel.org
Reported-by: Stefan Teodorescu <fane@google.com>
Cc: Sagi Shahar <sagis@google.com>
Signed-off-by: Sean Christopherson <seanjc@google.com>
Link: https://patch.msgid.link/20261119173451.67434-1-seanjc@google.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 arch/x86/kvm/vmx/vmx.c | 5 +++--
 arch/x86/kvm/x86.c     | 2 +-
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c
index bf9512370146..12ee0436f4f0 100644
--- a/arch/x86/kvm/vmx/vmx.c
+++ b/arch/x86/kvm/vmx/vmx.c
@@ -4205,9 +4205,10 @@ static inline void kvm_vcpu_trigger_posted_interrupt(struct kvm_vcpu *vcpu,
 		 * not wait for any requested interrupts in PIR, and sending a
 		 * notification event also results in a benign, spurious event.
 		 */
+		int cpu = READ_ONCE(vcpu->cpu);
 
-		if (vcpu != kvm_get_running_vcpu())
-			__apic_send_IPI_mask(get_cpu_mask(vcpu->cpu), pi_vec);
+		if (cpu >= 0 && vcpu != kvm_get_running_vcpu())
+			__apic_send_IPI_mask(get_cpu_mask(cpu), pi_vec);
 		return;
 	}
 #endif
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index cc50327a0f13..8efc7b2b5755 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -4884,7 +4884,7 @@ void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu)
 			kvm_make_request(KVM_REQ_GLOBAL_CLOCK_UPDATE, vcpu);
 		if (vcpu->cpu != cpu)
 			kvm_make_request(KVM_REQ_MIGRATE_TIMER, vcpu);
-		vcpu->cpu = cpu;
+		WRITE_ONCE(vcpu->cpu, cpu);
 	}
 
 	kvm_make_request(KVM_REQ_STEAL_UPDATE, vcpu);
-- 
2.56.1


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

* Re: [PATCH 6.6.y 02/17] KVM: x86/mmu: Flush TLBs if child SPTE is zapped when splitting a huge SPTE
  2026-12-04 18:03 ` [PATCH 6.6.y 02/17] KVM: x86/mmu: Flush TLBs if child SPTE is zapped when splitting a huge SPTE Paolo Bonzini
@ 2026-12-05 12:48   ` Sasha Levin
  0 siblings, 0 replies; 14+ messages in thread
From: Sasha Levin @ 2026-12-05 12:48 UTC (permalink / raw)
  To: linux-kernel, kvm
  Cc: Sasha Levin, Sean Christopherson, stable, Chris Mason,
	Stefan Teodorescu, Paolo Bonzini

> [ Upstream commit d31322f7c0003c4b3cba9d44c85fd73aa877c9f9 ]
>
> Queue a TLB flush when eagerly splitting a huge SPTE and adding a child
> SPTE to the rmap fails due to hitting the recycle threshold.

Queued the series for 6.6, thanks.

-- 
Thanks,
Sasha

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

end of thread, other threads:[~2026-12-05 12:48 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20261204180337.2168031-1-pbonzini@redhat.com>
2026-12-04 18:03 ` [PATCH 6.6.y 02/17] KVM: x86/mmu: Flush TLBs if child SPTE is zapped when splitting a huge SPTE Paolo Bonzini
2026-12-05 12:48   ` Sasha Levin
2026-12-04 18:03 ` [PATCH 6.6.y 04/17] KVM: x86: Disable hypervisor (VMX Preemption) timer if TSC deadline wraps Paolo Bonzini
2026-12-04 18:03 ` [PATCH 6.6.y 05/17] KVM: x86: Reset local APIC timer metadata on RESET, INIT, and KVM_SET_LAPIC Paolo Bonzini
2026-12-04 18:03 ` [PATCH 6.6.y 06/17] KVM: x86/mmu: Flush all TLB entries, not a precise range, when yielding Paolo Bonzini
2026-12-04 18:03 ` [PATCH 6.6.y 07/17] KVM: x86/mmu: Flush TLBs in kvm_unmap_gfn_range() if the unmap may block/yield Paolo Bonzini
2026-12-04 18:03 ` [PATCH 6.6.y 08/17] KVM: x86/xen: Pin kvm->mm prior to borrowing mm when setting event channel Paolo Bonzini
2026-12-04 18:03 ` [PATCH 6.6.y 09/17] KVM: Fold kvm_flush_shadow_all() into kvm_mmu_notifier_release() Paolo Bonzini
2026-12-04 18:03 ` [PATCH 6.6.y 11/17] KVM: WARN if there are in-flight memslot updates when a VM's process exits Paolo Bonzini
2026-12-04 18:03 ` [PATCH 6.6.y 12/17] KVM: Set mn_active_invalidate_count when the VM's mm is released Paolo Bonzini
2026-12-04 18:03 ` [PATCH 6.6.y 13/17] KVM: Invalidate all GFN=>PFN caches when VM and/or its process is dying Paolo Bonzini
2026-12-04 18:03 ` [PATCH 6.6.y 14/17] x86/fpu: Bail early from guest XFD update if XFD isn't supported Paolo Bonzini
2026-12-04 18:03 ` [PATCH 6.6.y 16/17] x86/fpu: Ensure guest FPU is resident in hardware when updating actual XFD MSR Paolo Bonzini
2026-12-04 18:03 ` [PATCH 6.6.y 17/17] KVM: VMX: Ensure pCPU is valid before sending IPI to deliver posted IRQ Paolo Bonzini

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