]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
KVM: x86: Harden SEV-ES MMIO against on-stack use-after-free
authorSean Christopherson <seanjc@google.com>
Wed, 25 Feb 2026 01:20:42 +0000 (17:20 -0800)
committerSean Christopherson <seanjc@google.com>
Tue, 3 Mar 2026 00:02:52 +0000 (16:02 -0800)
commit144089f5c3944cf6383d53ab5d941b74924a0989
tree56a520c4c53b93dd83eaf77e78e1943e648699bb
parent72f36f99072c3b79451af38274d59ac30cc064c6
KVM: x86: Harden SEV-ES MMIO against on-stack use-after-free

Add a sanity check to ensure KVM doesn't use an on-stack variable when
handling an MMIO request for an SEV-ES guest.  The source/destination
for SEV-ES MMIO should _always_ be the #VMGEXIT scratch area.

Opportunistically update the comment in the completion side of things
to clarify that frag->data doesn't need to be copied anywhere, and the
VMEGEXIT is trap-like (the current comment doesn't clarify *how* RIP is
advanced).

Tested-by: Tom Lendacky <thomas.lendacky@gmail.com>
Tested-by: Rick Edgecombe <rick.p.edgecombe@intel.com>
Link: https://patch.msgid.link/20260225012049.920665-8-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
arch/x86/kvm/x86.c