Re: [PATCH 00/21] Fixes and lock cleanup+hardening

From: Sean Christopherson

Date: Tue Apr 07 2026 - 20:16:52 EST


On Tue, 10 Mar 2026 16:48:08 -0700, Sean Christopherson wrote:
> Fix several fatal SEV bugs, then clean up the SEV+ APIs to either document
> that they are safe to query outside of kvm->lock, or to use lockdep-protected
> version. The sev_mem_enc_register_region() goof is at least the second bug
> we've had related to checking for an SEV guest outside of kvm->lock, and in
> general it's nearly impossible to just "eyeball" the safety of KVM's usage.
>
> I included Carlos' guard() cleanups here to avoid annoying conflicts (well,
> to solve them now instead of when applying).
>
> [...]

Applied to kvm-x86 svm, even though it's very late in the cycle and this is
a chonker. If there are any problems, I'll just omit this from the pull
request (it's been in -next for a few days, so /knock-wood it's all good...).

[01/21] KVM: selftests: Remove duplicate LAUNCH_UPDATE_VMSA call in SEV-ES migrate test
https://github.com/kvm-x86/linux/commit/25a642b6abc9
[02/21] KVM: SEV: Reject attempts to sync VMSA of an already-launched/encrypted vCPU
https://github.com/kvm-x86/linux/commit/9b9f7962e3e8
[03/21] KVM: SEV: Protect *all* of sev_mem_enc_register_region() with kvm->lock
https://github.com/kvm-x86/linux/commit/b6408b6cec5d
[04/21] KVM: SEV: Disallow LAUNCH_FINISH if vCPUs are actively being created
https://github.com/kvm-x86/linux/commit/624bf3440d72
[05/21] KVM: SEV: Lock all vCPUs when synchronzing VMSAs for SNP launch finish
https://github.com/kvm-x86/linux/commit/88b16bf7bdc5
[06/21] KVM: SEV: Lock all vCPUs for the duration of SEV-ES VMSA synchronization
https://github.com/kvm-x86/linux/commit/c9ebe8648ef7
[07/21] KVM: SEV: Provide vCPU-scoped accessors for detecting SEV+ guests
https://github.com/kvm-x86/linux/commit/6d0d4cc7befc
[08/21] KVM: SEV: Add quad-underscore version of VM-scoped APIs to detect SEV+ guests
https://github.com/kvm-x86/linux/commit/8e7172f2f799
[09/21] KVM: SEV: Document the SEV-ES check when querying SMM support as "safe"
https://github.com/kvm-x86/linux/commit/4d61fc63ba87
[10/21] KVM: SEV: Move standard VM-scoped helpers to detect SEV+ guests to sev.c
https://github.com/kvm-x86/linux/commit/3fae1e8e1fdf
[11/21] KVM: SEV: Move SEV-specific VM initialization to sev.c
https://github.com/kvm-x86/linux/commit/18951f21c676
[12/21] KVM: SEV: WARN on unhandled VM type when initializing VM
https://github.com/kvm-x86/linux/commit/61d7f912b344
[13/21] KVM: SEV: Hide "struct kvm_sev_info" behind CONFIG_KVM_AMD_SEV=y
https://github.com/kvm-x86/linux/commit/332e201873c4
[14/21] KVM: SEV: Document that checking for SEV+ guests when reclaiming memory is "safe"
https://github.com/kvm-x86/linux/commit/0689ee7ace6b
[15/21] KVM: SEV: Assert that kvm->lock is held when querying SEV+ support
https://github.com/kvm-x86/linux/commit/c34c81e08d7f
[16/21] KVM: SEV: use mutex guard in snp_launch_update()
https://github.com/kvm-x86/linux/commit/b69560d32aa8
[17/21] KVM: SEV: use mutex guard in sev_mem_enc_ioctl()
https://github.com/kvm-x86/linux/commit/fa4e5564204f
[18/21] KVM: SEV: use mutex guard in sev_mem_enc_unregister_region()
https://github.com/kvm-x86/linux/commit/ec6d08c5a71c
[19/21] KVM: SEV: use mutex guard in snp_handle_guest_req()
https://github.com/kvm-x86/linux/commit/612b2ce45d98
[20/21] KVM: SVM: Move lock-protected allocation of SEV ASID into a separate helper
https://github.com/kvm-x86/linux/commit/af0cd8d7f455
[21/21] KVM: SEV: Goto an existing error label if charging misc_cg for an ASID fails
https://github.com/kvm-x86/linux/commit/11acc5d0cfb7

--
https://github.com/kvm-x86/linux/tree/next