This is a note to let you know that I've just added the patch titled KVM/x86: Export RFDS_NO and RFDS_CLEAR to guests to the 5.10-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: kvm-x86-export-rfds_no-and-rfds_clear-to-guests.patch and it can be found in the queue-5.10 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From stable+bounces-27552-greg=kroah.com@xxxxxxxxxxxxxxx Tue Mar 12 23:41:33 2024 From: Pawan Gupta <pawan.kumar.gupta@xxxxxxxxxxxxxxx> Date: Tue, 12 Mar 2024 15:41:24 -0700 Subject: KVM/x86: Export RFDS_NO and RFDS_CLEAR to guests To: stable@xxxxxxxxxxxxxxx Cc: Dave Hansen <dave.hansen@xxxxxxxxxxxxxxx>, Thomas Gleixner <tglx@xxxxxxxxxxxxx>, Josh Poimboeuf <jpoimboe@xxxxxxxxxx> Message-ID: <20240312-delay-verw-backport-5-10-y-v2-11-ad081ccd89ca@xxxxxxxxxxxxxxx> Content-Disposition: inline From: Pawan Gupta <pawan.kumar.gupta@xxxxxxxxxxxxxxx> commit 2a0180129d726a4b953232175857d442651b55a0 upstream. Mitigation for RFDS requires RFDS_CLEAR capability which is enumerated by MSR_IA32_ARCH_CAPABILITIES bit 27. If the host has it set, export it to guests so that they can deploy the mitigation. RFDS_NO indicates that the system is not vulnerable to RFDS, export it to guests so that they don't deploy the mitigation unnecessarily. When the host is not affected by X86_BUG_RFDS, but has RFDS_NO=0, synthesize RFDS_NO to the guest. Signed-off-by: Pawan Gupta <pawan.kumar.gupta@xxxxxxxxxxxxxxx> Signed-off-by: Dave Hansen <dave.hansen@xxxxxxxxxxxxxxx> Reviewed-by: Thomas Gleixner <tglx@xxxxxxxxxxxxx> Acked-by: Josh Poimboeuf <jpoimboe@xxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- arch/x86/kvm/x86.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -1389,7 +1389,8 @@ static unsigned int num_msr_based_featur ARCH_CAP_SKIP_VMENTRY_L1DFLUSH | ARCH_CAP_SSB_NO | ARCH_CAP_MDS_NO | \ ARCH_CAP_PSCHANGE_MC_NO | ARCH_CAP_TSX_CTRL_MSR | ARCH_CAP_TAA_NO | \ ARCH_CAP_SBDR_SSDP_NO | ARCH_CAP_FBSDP_NO | ARCH_CAP_PSDP_NO | \ - ARCH_CAP_FB_CLEAR | ARCH_CAP_RRSBA | ARCH_CAP_PBRSB_NO | ARCH_CAP_GDS_NO) + ARCH_CAP_FB_CLEAR | ARCH_CAP_RRSBA | ARCH_CAP_PBRSB_NO | ARCH_CAP_GDS_NO | \ + ARCH_CAP_RFDS_NO | ARCH_CAP_RFDS_CLEAR) static u64 kvm_get_arch_capabilities(void) { @@ -1426,6 +1427,8 @@ static u64 kvm_get_arch_capabilities(voi data |= ARCH_CAP_SSB_NO; if (!boot_cpu_has_bug(X86_BUG_MDS)) data |= ARCH_CAP_MDS_NO; + if (!boot_cpu_has_bug(X86_BUG_RFDS)) + data |= ARCH_CAP_RFDS_NO; if (!boot_cpu_has(X86_FEATURE_RTM)) { /* Patches currently in stable-queue which might be from kroah.com@xxxxxxxxxxxxxxx are queue-5.10/x86-rfds-mitigate-register-file-data-sampling-rfds.patch queue-5.10/x86-entry_32-add-verw-just-before-userspace-transition.patch queue-5.10/x86-bugs-add-asm-helpers-for-executing-verw.patch queue-5.10/kvm-x86-export-rfds_no-and-rfds_clear-to-guests.patch queue-5.10/x86-asm-add-_asm_rip-macro-for-x86-64-rip-suffix.patch queue-5.10/x86-entry_64-add-verw-just-before-userspace-transition.patch queue-5.10/x86-mmio-disable-kvm-mitigation-when-x86_feature_clear_cpu_buf-is-set.patch queue-5.10/x86-bugs-use-alternative-instead-of-mds_user_clear-static-key.patch queue-5.10/documentation-hw-vuln-add-documentation-for-rfds.patch queue-5.10/kvm-vmx-use-bt-jnc-i.e.-eflags.cf-to-select-vmresume-vs.-vmlaunch.patch queue-5.10/kvm-vmx-move-verw-closer-to-vmentry-for-mds-mitigation.patch