]> git.hungrycats.org Git - linux/commit
KVM: nSVM: Ignore EFER.LMA if EFER.LME=0 when preparing L2 state
authorSean Christopherson <seanjc@google.com>
Wed, 2 Sep 2026 23:20:25 +0000 (16:20 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 6 Nov 2026 17:06:09 +0000 (12:06 -0500)
commita4c2d0a9a9019e71c94ff2b8f56b8f7fc97bd71d
tree8abcfd4974bf8c058dd28694c0b63035a3e26f92
parent058173bce103b6ac405b2bbf61e29a7f3767348f
KVM: nSVM: Ignore EFER.LMA if EFER.LME=0 when preparing L2 state

commit 1c4c84a643b704e473cb171f7b61359ff29b12a4 upstream.

Force EFER.LMA=0 if EFER.LME=0 when preparing L2 state for VMRUN, i.e.
mimic real hardware's behavior of ignoring EFER.LMA if EFER.LME=0.  VMRUN
unfortunately allows the nonsensical combination, i.e. doesn't fail, but
KVM itself has an invariant EFER.LMA can be set et if and only if EFER.LME
is set.   Breaking that invariant can lead to a variety of issue,
particularly in MMU code that keys off EFER.LMA when determining whether to
emulate/virtualization 4/5-level paging versus PAE paging.

Cc: stable@vger.kernel.org
Cc: Yosry Ahmed <yosry@kernel.org>
Link: https://patch.msgid.link/20260902232028.2767071-3-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/x86/kvm/svm/nested.c