Return-path: Received: from userp2130.oracle.com ([156.151.31.86]) by Galois.linutronix.de with esmtps (TLS1.2:RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1fBWL4-0003ED-RA for speck@linutronix.de; Thu, 26 Apr 2018 04:08:52 +0200 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w3Q26Gfk080873 for ; Thu, 26 Apr 2018 02:08:43 GMT Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by userp2130.oracle.com with ESMTP id 2hfvrc15em-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 26 Apr 2018 02:08:43 +0000 Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w3Q28gwg016278 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 26 Apr 2018 02:08:43 GMT Received: from abhmp0016.oracle.com (abhmp0016.oracle.com [141.146.116.22]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id w3Q28g7H009583 for ; Thu, 26 Apr 2018 02:08:42 GMT Message-Id: <20180426020415.530907349@localhost.localdomain> Date: Wed, 25 Apr 2018 22:04:15 -0400 From: konrad.wilk@oracle.com Subject: [MODERATED] [PATCH v5 00/11] [PATCH v5] Patches formerly known as SSB or MDD Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit MIME-Version: 1.0 To: speck@linutronix.de List-ID: Since v4 - Added support for bit(4) of X86_FEATURE_ARCH_CAPABILITIES - Created bugzilla to hold the existing Intel docs - Have three CPU flags for all of this: X86_BUG_SPEC_STORE_BYPASS - CPU is susceptible. X86_FEATURE_RDS - CPU is able to turn off speculative store bypass X86_FEATURE_SPEC_STORE_BYPASS_DISABLE - engage the mitigation - Fixed my EFI build issue ( I changed the header but forgot to change the function names). - Extra patch (now up to 10) to deal with SPEC_CTRL whitelist so we don't try to WRMSRL SPEC_CTRL_RDS (Bit 2) on AMD machines. Since v3: - Fixed it per Boris's review. - Added Tim's comments. Couple of things: - Testing on baremetal shows (see 'rds' and 'spec_store_bypass'): processor : 39 vendor_id : GenuineIntel cpu family : 6 model : 79 model name : Intel(R) Xeon(R) CPU E5-2630 v4 @ 2.20GHz stepping : 1 microcode : 0xb00002d cpu MHz : 2430.874 cache size : 25600 KB physical id : 1 siblings : 20 core id : 12 cpu cores : 10 apicid : 57 initial apicid : 57 fpu : yes fpu_exception : yes cpuid level : 20 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb cat_l3 cdp_l3 invpcid_single pti intel_ppin tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm cqm rdt_a rdseed adx smap intel_pt xsaveopt cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local ibpb ibrs stibp dtherm ida arat pln pts rds bugs : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass bogomips : 4402.99 clflush size : 64 cache_alignment : 64 address sizes : 46 bits physical, 48 bits virtual power management: - On KVM hosts with -cpu +spec-ctrl,+rds: processor : 7 vendor_id : GenuineIntel cpu family : 6 model : 79 model name : Intel(R) Xeon(R) CPU E5-2630 v4 @ 2.20GHz stepping : 1 microcode : 0x1 cpu MHz : 2195.098 cache size : 16384 KB physical id : 7 siblings : 1 core id : 0 cpu cores : 1 apicid : 7 initial apicid : 7 fpu : yes fpu_exception : yes cpuid level : 13 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon rep_good nopl xtopology cpuid pni pclmulqdq ssse3 fma cx16 pcid ss e4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hyp ervisor lahf_lm abm 3dnowprefetch cpuid_fault invpcid_single pti fsgsbase tsc_ad just bmi1 hle avx2 smep bmi2 erms invpcid rtm rdseed adx smap xsaveopt ibpb ibrs arat umip rds bugs : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass bogomips : 4390.19 clflush size : 64 cache_alignmen[ 126.527208] serial8250: too much work for irq4 t : 64 address sizes : 40 bits physical, 48 bits virtual power management: Things folks already know, but just in case you are new: - The titles are obfuscated as Subject: are not encrypted. Nor are the MIME attachment file names. - The cover letter subject is also mangled as I can't say spec_store_bypass_disable in the title. - The Suggested-by and Reviewed-by have an XX in front of them so that git send-email does not include the CC on the mailbox file. Here is the diffstat including the non-scrambled names of the patches. Documentation/admin-guide/kernel-parameters.txt | 32 ++++ arch/x86/include/asm/cpufeatures.h | 3 + arch/x86/include/asm/msr-index.h | 2 + arch/x86/include/asm/nospec-branch.h | 41 ++++- arch/x86/kernel/cpu/amd.c | 16 ++ arch/x86/kernel/cpu/bugs.c | 234 ++++++++++++++++++++++-- arch/x86/kernel/cpu/common.c | 46 +++-- arch/x86/kernel/cpu/intel.c | 6 + arch/x86/kvm/cpuid.c | 2 +- arch/x86/kvm/svm.c | 6 +- arch/x86/kvm/vmx.c | 14 +- drivers/base/cpu.c | 8 + include/linux/cpu.h | 2 + 13 files changed, 369 insertions(+), 43 deletions(-) Konrad Rzeszutek Wilk (10): x86/bugs: Concentrate bug detection into a separate function x86/bugs: Concentrate bug reporting into a separate function x86/bugs: Read SPEC_CTRL MSR during boot and re-use reserved bits. KVM/SVM/VMX/x86/bugs: Support the combination of guest IBRS and ours. x86/bugs: Expose the /sys/../spec_store_bypass and X86_BUG_SPEC_STORE_BYPASS x86/bugs: Provide boot parameters for the spec_store_bypass_disable mitigation x86/bugs/Intel: set proper CPU features and latch mitigation for RDS x86/bugs: Whitelist allowed SPEC_CTRL MSR values x86/bugs/AMD: Add support to disable RDS on Fam[15,16,17]h if requested x86/KVM/VMX: Expose SPEC_CTRL Bit(2) to the guest