Skip to content

Commit 2a4fc18

Browse files
committed
Merge: Merge up content from 10.1
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-10/-/merge_requests/1487 JIRA: INTERNAL Upstream Status: RHEL only Signed-off-by: Jan Stancek <jstancek@redhat.com> This merges up the content from kernel-6.12.0-124.2.1.el10_1 and kernel-6.12.0-124.3.1.el10_1. Merged-by: Scott Weaver <scweaver@redhat.com>
2 parents aefaab0 + 2ca690b commit 2a4fc18

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+2496
-1268
lines changed

Documentation/ABI/testing/sysfs-devices-system-cpu

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -523,6 +523,7 @@ What: /sys/devices/system/cpu/vulnerabilities
523523
/sys/devices/system/cpu/vulnerabilities/spectre_v1
524524
/sys/devices/system/cpu/vulnerabilities/spectre_v2
525525
/sys/devices/system/cpu/vulnerabilities/srbds
526+
/sys/devices/system/cpu/vulnerabilities/tsa
526527
/sys/devices/system/cpu/vulnerabilities/tsx_async_abort
527528
Date: January 2018
528529
Contact: Linux kernel mailing list <linux-kernel@vger.kernel.org>

Documentation/admin-guide/hw-vuln/processor_mmio_stale_data.rst

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -157,9 +157,7 @@ This is achieved by using the otherwise unused and obsolete VERW instruction in
157157
combination with a microcode update. The microcode clears the affected CPU
158158
buffers when the VERW instruction is executed.
159159

160-
Kernel reuses the MDS function to invoke the buffer clearing:
161-
162-
mds_clear_cpu_buffers()
160+
Kernel does the buffer clearing with x86_clear_cpu_buffers().
163161

164162
On MDS affected CPUs, the kernel already invokes CPU buffer clear on
165163
kernel/userspace, hypervisor/guest and C-state (idle) transitions. No

Documentation/admin-guide/kernel-parameters.txt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7059,6 +7059,19 @@
70597059
having this key zero'ed is acceptable. E.g. in testing
70607060
scenarios.
70617061

7062+
tsa= [X86] Control mitigation for Transient Scheduler
7063+
Attacks on AMD CPUs. Search the following in your
7064+
favourite search engine for more details:
7065+
7066+
"Technical guidance for mitigating transient scheduler
7067+
attacks".
7068+
7069+
off - disable the mitigation
7070+
on - enable the mitigation (default)
7071+
user - mitigate only user/kernel transitions
7072+
vm - mitigate only guest/host transitions
7073+
7074+
70627075
tsc= Disable clocksource stability checks for TSC.
70637076
Format: <string>
70647077
[x86] reliable: mark tsc clocksource as reliable, this

Documentation/arch/x86/mds.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ enters a C-state.
9393

9494
The kernel provides a function to invoke the buffer clearing:
9595

96-
mds_clear_cpu_buffers()
96+
x86_clear_cpu_buffers()
9797

9898
Also macro CLEAR_CPU_BUFFERS can be used in ASM late in exit-to-user path.
9999
Other than CFLAGS.ZF, this macro doesn't clobber any registers.
@@ -185,9 +185,9 @@ Mitigation points
185185
idle clearing would be a window dressing exercise and is therefore not
186186
activated.
187187

188-
The invocation is controlled by the static key mds_idle_clear which is
189-
switched depending on the chosen mitigation mode and the SMT state of
190-
the system.
188+
The invocation is controlled by the static key cpu_buf_idle_clear which is
189+
switched depending on the chosen mitigation mode and the SMT state of the
190+
system.
191191

192192
The buffer clear is only invoked before entering the C-State to prevent
193193
that stale data from the idling CPU from spilling to the Hyper-Thread

arch/arm64/kvm/sys_regs.c

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1639,7 +1639,6 @@ static u64 __kvm_read_sanitised_id_reg(const struct kvm_vcpu *vcpu,
16391639
break;
16401640
case SYS_ID_AA64MMFR2_EL1:
16411641
val &= ~ID_AA64MMFR2_EL1_CCIDX_MASK;
1642-
val &= ~ID_AA64MMFR2_EL1_NV;
16431642
break;
16441643
case SYS_ID_AA64MMFR3_EL1:
16451644
val &= ID_AA64MMFR3_EL1_TCRX | ID_AA64MMFR3_EL1_S1POE |
@@ -2006,22 +2005,6 @@ static int set_id_aa64mmfr0_el1(struct kvm_vcpu *vcpu,
20062005
return set_id_reg(vcpu, rd, user_val);
20072006
}
20082007

2009-
static int set_id_aa64mmfr2_el1(struct kvm_vcpu *vcpu,
2010-
const struct sys_reg_desc *rd, u64 user_val)
2011-
{
2012-
u64 hw_val = read_sanitised_ftr_reg(SYS_ID_AA64MMFR2_EL1);
2013-
u64 nv_mask = ID_AA64MMFR2_EL1_NV_MASK;
2014-
2015-
/*
2016-
* We made the mistake to expose the now deprecated NV field,
2017-
* so allow userspace to write it, but silently ignore it.
2018-
*/
2019-
if ((hw_val & nv_mask) == (user_val & nv_mask))
2020-
user_val &= ~nv_mask;
2021-
2022-
return set_id_reg(vcpu, rd, user_val);
2023-
}
2024-
20252008
static int set_ctr_el0(struct kvm_vcpu *vcpu,
20262009
const struct sys_reg_desc *rd, u64 user_val)
20272010
{
@@ -2907,8 +2890,7 @@ static const struct sys_reg_desc sys_reg_descs[] = {
29072890
ID_AA64MMFR1_EL1_XNX |
29082891
ID_AA64MMFR1_EL1_VH |
29092892
ID_AA64MMFR1_EL1_VMIDBits)),
2910-
ID_FILTERED(ID_AA64MMFR2_EL1,
2911-
id_aa64mmfr2_el1, ~(ID_AA64MMFR2_EL1_RES0 |
2893+
ID_WRITABLE(ID_AA64MMFR2_EL1, ~(ID_AA64MMFR2_EL1_RES0 |
29122894
ID_AA64MMFR2_EL1_EVT |
29132895
ID_AA64MMFR2_EL1_FWB |
29142896
ID_AA64MMFR2_EL1_IDS |

arch/x86/Kconfig

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1339,6 +1339,7 @@ config X86_REBOOTFIXUPS
13391339
config MICROCODE
13401340
def_bool y
13411341
depends on CPU_SUP_AMD || CPU_SUP_INTEL
1342+
select CRYPTO_LIB_SHA256 if CPU_SUP_AMD
13421343

13431344
config MICROCODE_INITRD32
13441345
def_bool y
@@ -2770,6 +2771,15 @@ config MITIGATION_ITS
27702771
disabled, mitigation cannot be enabled via cmdline.
27712772
See <file:Documentation/admin-guide/hw-vuln/indirect-target-selection.rst>
27722773

2774+
config MITIGATION_TSA
2775+
bool "Mitigate Transient Scheduler Attacks"
2776+
depends on CPU_SUP_AMD
2777+
default y
2778+
help
2779+
Enable mitigation for Transient Scheduler Attacks. TSA is a hardware
2780+
security vulnerability on AMD CPUs which can lead to forwarding of
2781+
invalid info to subsequent instructions and thus can affect their
2782+
timing and thereby cause a leakage.
27732783
endif
27742784

27752785
config ARCH_HAS_ADD_PAGES

arch/x86/crypto/aesni-intel_glue.c

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1536,26 +1536,6 @@ DEFINE_GCM_ALGS(vaes_avx10_512, FLAG_AVX10_512,
15361536
AES_GCM_KEY_AVX10_SIZE, 800);
15371537
#endif /* CONFIG_AS_VAES && CONFIG_AS_VPCLMULQDQ */
15381538

1539-
/*
1540-
* This is a list of CPU models that are known to suffer from downclocking when
1541-
* zmm registers (512-bit vectors) are used. On these CPUs, the AES mode
1542-
* implementations with zmm registers won't be used by default. Implementations
1543-
* with ymm registers (256-bit vectors) will be used by default instead.
1544-
*/
1545-
static const struct x86_cpu_id zmm_exclusion_list[] = {
1546-
X86_MATCH_VFM(INTEL_SKYLAKE_X, 0),
1547-
X86_MATCH_VFM(INTEL_ICELAKE_X, 0),
1548-
X86_MATCH_VFM(INTEL_ICELAKE_D, 0),
1549-
X86_MATCH_VFM(INTEL_ICELAKE, 0),
1550-
X86_MATCH_VFM(INTEL_ICELAKE_L, 0),
1551-
X86_MATCH_VFM(INTEL_ICELAKE_NNPI, 0),
1552-
X86_MATCH_VFM(INTEL_TIGERLAKE_L, 0),
1553-
X86_MATCH_VFM(INTEL_TIGERLAKE, 0),
1554-
/* Allow Rocket Lake and later, and Sapphire Rapids and later. */
1555-
/* Also allow AMD CPUs (starting with Zen 4, the first with AVX-512). */
1556-
{},
1557-
};
1558-
15591539
static int __init register_avx_algs(void)
15601540
{
15611541
int err;
@@ -1600,7 +1580,7 @@ static int __init register_avx_algs(void)
16001580
if (err)
16011581
return err;
16021582

1603-
if (x86_match_cpu(zmm_exclusion_list)) {
1583+
if (boot_cpu_has(X86_FEATURE_PREFER_YMM)) {
16041584
int i;
16051585

16061586
aes_xts_alg_vaes_avx10_512.base.cra_priority = 1;

arch/x86/entry/entry.S

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,20 +34,20 @@ EXPORT_SYMBOL_GPL(write_ibpb);
3434

3535
/*
3636
* Define the VERW operand that is disguised as entry code so that
37-
* it can be referenced with KPTI enabled. This ensure VERW can be
37+
* it can be referenced with KPTI enabled. This ensures VERW can be
3838
* used late in exit-to-user path after page tables are switched.
3939
*/
4040
.pushsection .entry.text, "ax"
4141

4242
.align L1_CACHE_BYTES, 0xcc
43-
SYM_CODE_START_NOALIGN(mds_verw_sel)
43+
SYM_CODE_START_NOALIGN(x86_verw_sel)
4444
UNWIND_HINT_UNDEFINED
4545
ANNOTATE_NOENDBR
4646
.word __KERNEL_DS
4747
.align L1_CACHE_BYTES, 0xcc
48-
SYM_CODE_END(mds_verw_sel);
48+
SYM_CODE_END(x86_verw_sel);
4949
/* For KVM */
50-
EXPORT_SYMBOL_GPL(mds_verw_sel);
50+
EXPORT_SYMBOL_GPL(x86_verw_sel);
5151

5252
.popsection
5353

arch/x86/include/asm/cpufeatures.h

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -458,6 +458,7 @@
458458
#define X86_FEATURE_NO_NESTED_DATA_BP (20*32+ 0) /* No Nested Data Breakpoints */
459459
#define X86_FEATURE_WRMSR_XX_BASE_NS (20*32+ 1) /* WRMSR to {FS,GS,KERNEL_GS}_BASE is non-serializing */
460460
#define X86_FEATURE_LFENCE_RDTSC (20*32+ 2) /* LFENCE always serializing / synchronizes RDTSC */
461+
#define X86_FEATURE_VERW_CLEAR (20*32+ 5) /* The memory form of VERW mitigates TSA */
461462
#define X86_FEATURE_NULL_SEL_CLR_BASE (20*32+ 6) /* Null Selector Clears Base */
462463
#define X86_FEATURE_AUTOIBRS (20*32+ 8) /* Automatic IBRS */
463464
#define X86_FEATURE_NO_SMM_CTL_MSR (20*32+ 9) /* SMM_CTL MSR is not present */
@@ -481,10 +482,16 @@
481482
#define X86_FEATURE_CLEAR_BHB_LOOP (21*32+ 1) /* Clear branch history at syscall entry using SW loop */
482483
#define X86_FEATURE_BHI_CTRL (21*32+ 2) /* BHI_DIS_S HW control available */
483484
#define X86_FEATURE_CLEAR_BHB_HW (21*32+ 3) /* BHI_DIS_S HW control enabled */
484-
#define X86_FEATURE_CLEAR_BHB_LOOP_ON_VMEXIT (21*32+ 4) /* Clear branch history at vmexit using SW loop */
485-
#define X86_FEATURE_AMD_FAST_CPPC (21*32 + 5) /* Fast CPPC */
486-
#define X86_FEATURE_AMD_HETEROGENEOUS_CORES (21*32 + 6) /* Heterogeneous Core Topology */
487-
#define X86_FEATURE_INDIRECT_THUNK_ITS (21*32 + 9) /* Use thunk for indirect branches in lower half of cacheline */
485+
#define X86_FEATURE_CLEAR_BHB_VMEXIT (21*32+ 4) /* Clear branch history at vmexit using SW loop */
486+
#define X86_FEATURE_AMD_FAST_CPPC (21*32+ 5) /* Fast CPPC */
487+
#define X86_FEATURE_AMD_HTR_CORES (21*32+ 6) /* Heterogeneous Core Topology */
488+
#define X86_FEATURE_AMD_WORKLOAD_CLASS (21*32+ 7) /* Workload Classification */
489+
#define X86_FEATURE_PREFER_YMM (21*32+ 8) /* Avoid ZMM registers due to downclocking */
490+
#define X86_FEATURE_APX (21*32+ 9) /* Advanced Performance Extensions */
491+
#define X86_FEATURE_INDIRECT_THUNK_ITS (21*32+10) /* Use thunk for indirect branches in lower half of cacheline */
492+
#define X86_FEATURE_TSA_SQ_NO (21*32+11) /* AMD CPU not vulnerable to TSA-SQ */
493+
#define X86_FEATURE_TSA_L1_NO (21*32+12) /* AMD CPU not vulnerable to TSA-L1 */
494+
#define X86_FEATURE_CLEAR_CPU_BUF_VM (21*32+13) /* Clear CPU buffers using VERW before VMRUN */
488495

489496
/*
490497
* BUG word(s)
@@ -523,20 +530,21 @@
523530
#define X86_BUG_ITLB_MULTIHIT X86_BUG(23) /* "itlb_multihit" CPU may incur MCE during certain page attribute changes */
524531
#define X86_BUG_SRBDS X86_BUG(24) /* "srbds" CPU may leak RNG bits if not mitigated */
525532
#define X86_BUG_MMIO_STALE_DATA X86_BUG(25) /* "mmio_stale_data" CPU is affected by Processor MMIO Stale Data vulnerabilities */
526-
#define X86_BUG_MMIO_UNKNOWN X86_BUG(26) /* "mmio_unknown" CPU is too old and its MMIO Stale Data status is unknown */
533+
/* unused, was #define X86_BUG_MMIO_UNKNOWN X86_BUG(26) "mmio_unknown" CPU is too old and its MMIO Stale Data status is unknown */
527534
#define X86_BUG_RETBLEED X86_BUG(27) /* "retbleed" CPU is affected by RETBleed */
528535
#define X86_BUG_EIBRS_PBRSB X86_BUG(28) /* "eibrs_pbrsb" EIBRS is vulnerable to Post Barrier RSB Predictions */
529536
#define X86_BUG_SMT_RSB X86_BUG(29) /* "smt_rsb" CPU is vulnerable to Cross-Thread Return Address Predictions */
530537
#define X86_BUG_GDS X86_BUG(30) /* "gds" CPU is affected by Gather Data Sampling */
531538
#define X86_BUG_TDX_PW_MCE X86_BUG(31) /* "tdx_pw_mce" CPU may incur #MC if non-TD software does partial write to TDX private memory */
532539

533540
/* BUG word 2 */
534-
#define X86_BUG_SRSO X86_BUG(1*32 + 0) /* "srso" AMD SRSO bug */
535-
#define X86_BUG_DIV0 X86_BUG(1*32 + 1) /* "div0" AMD DIV0 speculation bug */
536-
#define X86_BUG_RFDS X86_BUG(1*32 + 2) /* "rfds" CPU is vulnerable to Register File Data Sampling */
537-
#define X86_BUG_BHI X86_BUG(1*32 + 3) /* "bhi" CPU is affected by Branch History Injection */
538-
#define X86_BUG_IBPB_NO_RET X86_BUG(1*32 + 4) /* "ibpb_no_ret" IBPB omits return target predictions */
539-
#define X86_BUG_SPECTRE_V2_USER X86_BUG(1*32 + 5) /* "spectre_v2_user" CPU is affected by Spectre variant 2 attack between user processes */
540-
#define X86_BUG_ITS X86_BUG(1*32 + 6) /* "its" CPU is affected by Indirect Target Selection */
541-
#define X86_BUG_ITS_NATIVE_ONLY X86_BUG(1*32 + 7) /* "its_native_only" CPU is affected by ITS, VMX is not affected */
541+
#define X86_BUG_SRSO X86_BUG( 1*32+ 0) /* "srso" AMD SRSO bug */
542+
#define X86_BUG_DIV0 X86_BUG( 1*32+ 1) /* "div0" AMD DIV0 speculation bug */
543+
#define X86_BUG_RFDS X86_BUG( 1*32+ 2) /* "rfds" CPU is vulnerable to Register File Data Sampling */
544+
#define X86_BUG_BHI X86_BUG( 1*32+ 3) /* "bhi" CPU is affected by Branch History Injection */
545+
#define X86_BUG_IBPB_NO_RET X86_BUG( 1*32+ 4) /* "ibpb_no_ret" IBPB omits return target predictions */
546+
#define X86_BUG_SPECTRE_V2_USER X86_BUG( 1*32+ 5) /* "spectre_v2_user" CPU is affected by Spectre variant 2 attack between user processes */
547+
#define X86_BUG_ITS X86_BUG( 1*32+ 7) /* "its" CPU is affected by Indirect Target Selection */
548+
#define X86_BUG_ITS_NATIVE_ONLY X86_BUG( 1*32+ 8) /* "its_native_only" CPU is affected by ITS, VMX is not affected */
549+
#define X86_BUG_TSA X86_BUG( 1*32+ 9) /* "tsa" CPU is affected by Transient Scheduler Attacks */
542550
#endif /* _ASM_X86_CPUFEATURES_H */

arch/x86/include/asm/irqflags.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,13 @@ static __always_inline void native_irq_enable(void)
4444

4545
static __always_inline void native_safe_halt(void)
4646
{
47-
mds_idle_clear_cpu_buffers();
47+
x86_idle_clear_cpu_buffers();
4848
asm volatile("sti; hlt": : :"memory");
4949
}
5050

5151
static __always_inline void native_halt(void)
5252
{
53-
mds_idle_clear_cpu_buffers();
53+
x86_idle_clear_cpu_buffers();
5454
asm volatile("hlt": : :"memory");
5555
}
5656

0 commit comments

Comments
 (0)