[PATCH 0/2] KVM: SEV: Fixups for the cache maintenance fixes

From: Sean Christopherson

Date: Mon Sep 28 2026 - 11:51:37 EST


Two fixes, two bugs. I'm batting a 1.000. Fix a double-free and a race
pointed out by Sashiko.

Regarding fixing the double free, I initially said I'd just move the allocation
to avoid having to deal with CPUMASK_OFFSTACK=n[*], but that felt too much like
I was leaving trap for someone else. So instead I elected to nullify the
pointer with memset(), which has a fairly desirable side effect of clearing the
mask when CPUMASK_OFFSTACK=n.

[*] https://lore.kernel.org/all/arQMARDUTSjbWpMX@xxxxxxxxxx

Sean Christopherson (2):
KVM: SEV: Nullify "have run CPUs" mask pointer when freeing it
KVM: SEV: Do cache maintenance on the source VM *before* clearing SEV
state

arch/x86/kvm/svm/sev.c | 46 ++++++++++++++++++++++++++----------------
1 file changed, 29 insertions(+), 17 deletions(-)


base-commit: a4bab1c12fd528ccaafee00360e07463873404a9
--
2.56.0.rc1.315.gc6ed9934b7-goog