]> git.ipfire.org Git - thirdparty/linux.git/commit
KVM: nSVM: Restrict mapping vmcb12 on nested VMRUN
authorYosry Ahmed <yosry@kernel.org>
Tue, 3 Mar 2026 00:34:15 +0000 (00:34 +0000)
committerSean Christopherson <seanjc@google.com>
Thu, 5 Mar 2026 00:09:05 +0000 (16:09 -0800)
commitb709087e9e544259d1d075ced91cc4ab769a8ae2
tree359559bd417d70ce4b520d83d0d79b04bb8377db
parent84dc9fd0354d3d0e02faf2f7b3f4d1228c2571ea
KVM: nSVM: Restrict mapping vmcb12 on nested VMRUN

All accesses to the vmcb12 in the guest memory on nested VMRUN are
limited to nested_svm_vmrun() copying vmcb12 fields and writing them on
failed consistency checks. However, vmcb12 remains mapped throughout
nested_svm_vmrun().  Mapping and unmapping around usages is possible,
but it becomes easy-ish to introduce bugs where 'vmcb12' is used after
being unmapped.

Move reading the vmcb12, copying to cache, and consistency checks from
nested_svm_vmrun() into a new helper, nested_svm_copy_vmcb12_to_cache()
to limit the scope of the mapping.

Signed-off-by: Yosry Ahmed <yosry@kernel.org>
Link: https://patch.msgid.link/20260303003421.2185681-22-yosry@kernel.org
Signed-off-by: Sean Christopherson <seanjc@google.com>
arch/x86/kvm/svm/nested.c