FAILED: patch "[PATCH] KVM: x86: Disallow EFER.LME and EFER.LMA if long mode is not" failed to apply to 6.12-stable tree
Subsystems (3)
[email protected]
maintainerThe patch below does not apply to the 6.12-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.12.y
git checkout FETCH_HEAD
git cherry-pick -x e62392bf39ebfdf60d1d082799397fe1cbf8dfc5
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2026090915-drainer-judicial-082f@gregkh' --subject-prefix 'PATCH 6.12.y' 'HEAD^..'
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From e62392bf39ebfdf60d1d082799397fe1cbf8dfc5 Mon Sep 17 00:00:00 2001
From: Yosry Ahmed <[email protected]>
Date: Mon, 13 Jul 2026 18:10:17 +0000
Subject: [PATCH] KVM: x86: Disallow EFER.LME and EFER.LMA if long mode is not
supported
Remove EFER.LME and EFER.LMA from EFER reserved bits only if long mode is actually supported. KVM does check long-mode support before allowing the bits for guest writes and userspace writes through KVM_SET_SREGS* (in __kvm_valid_efer()), but userspace writes through KVM_SET_MSRS only check reserved bits.
In practice, this doesn't really matter. The true motiviation is getting rid of the #ifdeffery when initializing efer_reserved_bits.
arch/x86/kvm/msrs.c +1 -9
@@ -19,16 +19,8 @@ bool __read_mostly report_ignored_msrs = true;module_param (report_ignored_msrs, bool,0644 );EXPORT_SYMBOL_FOR_KVM_INTERNAL (report_ignored_msrs); -/* EFER defaults: -* - enable syscall per default because its emulated by KVM -* - enable LME and LMA per default on 64 bit KVM -*/ -#ifdef CONFIG_X86_64 -static -u64 __read_mostly efer_reserved_bits = ~((u64)(EFER_SCE |EFER_LME |EFER_LMA )); -#else +/* Enable syscall by default because its emulated by KVM */ static u64 __read_mostly efer_reserved_bits = ~((u64 )EFER_SCE ); -#endif #define MAX_IO_MSRS 256
arch/x86/kvm/x86.c +3 -0
@@ -6910,6 +6910,9 @@ EXPORT_SYMBOL_FOR_KVM_INTERNAL(kvm_setup_xss_caps);static void kvm_setup_efer_caps (void ) { +if (kvm_cpu_cap_has (X86_FEATURE_LM )) +kvm_enable_efer_bits (EFER_LME |EFER_LMA ); +if (kvm_cpu_cap_has (X86_FEATURE_NX ))kvm_enable_efer_bits (EFER_NX );
Sasha Levin
maintainerPATCH 1/1 KVM: x86: Disallow EFER.LME and EFER.LMA if long mode is not supported
From: Yosry Ahmed <[email protected]>
[ Upstream commit e62392bf39ebfdf60d1d082799397fe1cbf8dfc5 ]
Remove EFER.LME and EFER.LMA from EFER reserved bits only if long mode is actually supported. KVM does check long-mode support before allowing the bits for guest writes and userspace writes through KVM_SET_SREGS* (in __kvm_valid_efer()), but userspace writes through KVM_SET_MSRS only check reserved bits.
In practice, this doesn't really matter. The true motiviation is getting rid of the #ifdeffery when initializing efer_reserved_bits.
--- arch/x86/kvm/x86.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-)
arch/x86/kvm/x86.c +4 -9
@@ -108,16 +108,8 @@ EXPORT_SYMBOL_GPL(kvm_host);#define emul_to_vcpu (ctxt) \ ((struct kvm_vcpu *)(ctxt)->vcpu) -/* EFER defaults: -* - enable syscall per default because its emulated by KVM -* - enable LME and LMA per default on 64 bit KVM -*/ -#ifdef CONFIG_X86_64 -static -u64 __read_mostly efer_reserved_bits = ~((u64)(EFER_SCE |EFER_LME |EFER_LMA )); -#else +/* Enable syscall by default because its emulated by KVM */ static u64 __read_mostly efer_reserved_bits = ~((u64 )EFER_SCE ); -#endif static u64 __read_mostly cr4_reserved_bits =CR4_RESERVED_BITS ;
@@ -9822,6 +9814,9 @@ int kvm_x86_vendor_init(struct kvm_x86_init_ops *ops)if (r !=0 ) goto out_mmu_exit; +if (kvm_cpu_cap_has (X86_FEATURE_LM )) +kvm_enable_efer_bits (EFER_LME |EFER_LMA ); +kvm_ops_update (ops);for_each_online_cpu (cpu) {
Signature · 1 line
2.53.0
Re: [PATCH 6.12.y] KVM: x86: Disallow EFER.LME and EFER.LMA if long mode is not supported
Quoted 13 lines · Sasha Levin
From: Yosry Ahmed <[email protected]>
[ Upstream commit
e62392bf39ebfdf60d1d082799397fe1cbf8dfc5]Remove EFER.LME and EFER.LMA from EFER reserved bits only if long mode is actually supported. KVM does check long-mode support before allowing the bits for guest writes and userspace writes through KVM_SET_SREGS* (in
__kvm_valid_efer()), but userspace writes throughKVM_SET_MSRSonly check reserved bits.In practice, this doesn't really matter. The true motiviation is getting rid of the #ifdeffery when initializing
efer_reserved_bits.
Quoted 7 lines
Signed-off-by Yosry Ahmed <[email protected]>Signed-off-by Sean Christopherson <[email protected]>[ adapted EFER changes to x86.c, placing the capability check in kvm_x86_vendor_init() because kvm_setup_efer_caps() is absent. ]Signed-off-by Sasha Levin <[email protected]>---