linux/arch/x86/kvm
Sean Christopherson 973ea70393 KVM: SEV: Do cache maintenance on the source VM *before* clearing SEV state
Explicitly flush caches after intra-host migration before clearing "SEV
active" on the source VM, as doing cache maintenance afterwards creates a
tiny window where memory reclaim could return memory to the host without
performing a cache flush, e.g. as pointed out by Sashiko:

  CPU1 in sev_migrate_from():
    src->active = false;

  CPU2 running concurrent unmap:
    Since active is false, the automatic cache flush in
    sev_guest_memory_reclaimed is skipped.
    The host frees and reallocates the page.

  CPU1 in sev_migrate_from():
    sev_writeback_caches(src_kvm);
    Executes a hardware cache flush (wbnoinvd), which writes the guest's old
    dirty ciphertext over the new page owner's data.

Fixes: 93de2a6a4b ("KVM: SEV: Do cache maintenance on the source VM during intra-host migration")
Cc: stable@vger.kernel.org
Reported-by: Sashiko Bot <sashiko-bot@kernel.org>
Closes: https://lore.kernel.org/all/20260923165304.1662E1F000FF@smtp.kernel.org
Signed-off-by: Sean Christopherson <seanjc@google.com>
Message-ID: <20260928154644.2559454-3-seanjc@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
History 2026-09-28 17:11:49 -04:00
..
mmu KVM: x86/mmu: Bail from shadow walks if the root is invalid or a dummy 2026-09-26 01:15:43 -04:00
svm KVM: SEV: Do cache maintenance on the source VM *before* clearing SEV state 2026-09-28 17:11:49 -04:00
vmx KVM: nVMX: Force MSR bitmap refresh if runtime eVMCS controls are modified 2026-09-26 02:22:15 -04:00
.gitignore KVM: x86: use a separate asm-offsets.c file 2022-11-09 12:10:17 -05:00
cpuid.c Arm: 2026-08-25 11:48:04 -07:00
cpuid.h KVM: x86: Fix wrong return value type in guest_cpuid_has() 2026-05-28 06:01:52 -07:00
debugfs.c KVM: x86: Use fls() instead of ffs() for rmaps histogram bucketing 2026-05-28 06:09:24 -07:00
emulate.c Arm: 2026-08-25 11:48:04 -07:00
fpu.h KVM: x86: Move kvm_{load,put}_guest_fpu() to fpu.h 2026-06-24 08:13:09 -04:00
hyperv.c KVM x86 misc changes for 7.3 2026-08-18 13:41:51 +02:00
hyperv.h KVM: x86: Move "struct kvm_vcpu_hv" and all children from kvm_host.h => hyperv.h 2026-07-08 13:41:21 -07:00
i8254.c treewide: Replace kmalloc with kmalloc_obj for non-scalar types 2026-02-21 01:02:28 -08:00
i8254.h KVM: x86: Move IRQ mask notifier infrastructure to I/O APIC emulation 2025-06-20 13:52:52 -07:00
i8259.c KVM: x86: WARN and fail kvm_set_irq() if a PIC or I/O APIC vector is invalid 2026-06-24 11:53:36 +02:00
ioapic.c KVM: x86: Move a pile of stuff from kvm_host.h => x86.h 2026-06-24 08:24:05 -04:00
ioapic.h KVM: x86: Move __kvm_irq_line_state() from kvm_host.h => ioapic.h 2026-06-24 08:24:05 -04:00
irq.c Merge tag 'kvm-riscv-7.3-1' of https://github.com/kvm-riscv/linux into HEAD 2026-08-18 13:09:51 +02:00
irq.h KVM: x86: Don't WARN if IRQ disappears when Xen emulation is enabled. 2026-07-27 12:44:00 -07:00
Kconfig KVM: guest_memfd: Rename prepare() hook and Kconfig to make_private() / CONVERT 2026-07-27 09:42:42 -07:00
kvm-asm-offsets.c KVM: VMX: remove regs argument of __vmx_vcpu_run 2026-04-28 06:56:06 -04:00
kvm_emulate.h KVM: x86: Consolidate CPUID fault handling for emulator and interception logic 2026-05-27 11:21:41 -07:00
kvm_onhyperv.c KVM: x86: Export KVM-internal symbols for sub-modules only 2025-09-30 13:40:02 -04:00
kvm_onhyperv.h KVM: x86: Move Hyper-V partition assist page out of Hyper-V emulation context 2023-12-07 09:34:01 -08:00
lapic.c KVM x86 misc changes for 7.3 2026-08-18 13:41:51 +02:00
lapic.h KVM: x86: Move "struct kvm_apic_map" definition from kvm_host.h => lapic.h 2026-07-08 13:41:20 -07:00
Makefile KVM: x86: Move the bulk of MSR specific code from x86.c to msrs.{c,h} 2026-06-24 08:13:09 -04:00
mmu.h KVM: x86: Add static calls for nested virtualization ops 2026-07-10 09:07:07 -07:00
msrs.c Arm: 2026-08-25 11:48:04 -07:00
msrs.h KVM: x86: Move supported EFER bits to kvm_caps 2026-07-22 13:41:55 -07:00
mtrr.c KVM: x86: Move the bulk of MSR specific code from x86.c to msrs.{c,h} 2026-06-24 08:13:09 -04:00
pmu.c KVM: x86/pmu: Move Intel PMU global MSRs to intel_is_valid_msr() 2026-09-11 12:02:07 -07:00
pmu.h KVM: x86/pmu: Clean up vPMU comments and stray blank lines 2026-08-05 16:42:23 -07:00
regs.c KVM: x86: Check EFER validity on KVM_SET_SREGS* 2026-07-22 13:42:29 -07:00
regs.h KVM: x86: Move CR and DR macro definitions from kvm_host.h => regs.h 2026-07-08 13:41:18 -07:00
reverse_cpuid.h treewide: Explicitly include the x86 CPUID headers 2026-05-06 14:29:59 +02:00
smm.c KVM: nVMX: Synthesize SHUTDOWN on RSM if L2 requires emulation 2026-07-31 14:03:08 -07:00
smm.h KVM: x86: Save and reload SSP to/from SMRAM 2025-09-23 09:11:22 -07:00
trace.h KVM: x86: Fix null pointer deref due to dummy array in trace_kvm_inj_exception() 2026-07-13 06:24:36 -07:00
tss.h KVM: x86: Add static asserts to document connection b/w TSS structs and macros 2026-07-08 13:41:19 -07:00
vmenter.h KVM: VMX: Macrofy GPR swapping in __vmx_vcpu_run() 2026-05-30 22:41:00 +02:00
x86.c KVM: x86: Fill kvm_run exit fields in common get_nested_state_pages() error paths 2026-09-22 07:32:50 -07:00
x86.h KVM x86 misc changes for 7.3 2026-08-18 13:41:51 +02:00
xen.c Arm: 2026-08-25 11:48:04 -07:00
xen.h KVM: x86: Remove runtime Xen TSC frequency CPUID update 2026-08-07 09:11:56 -07:00