Skip to content

Commit 72a2be6

Browse files
committed
Merge tag 'kernel-5.14.0-611.2.1.el9_7' from 9.7
Bring in changes from 9.7 tag kernel-5.14.0-611.2.1.el9_7 Conflicts: Makefile.rhelver changes dropped arch/x86/include/asm/cpufeatures.h changes kept arch/x86/kernel/cpu/scattered.c changes kept Signed-off-by: Augusto Caringi <acaringi@redhat.com>
2 parents df8ce83 + 460d72c commit 72a2be6

Some content is hidden

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

73 files changed

+1892
-534
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -531,6 +531,7 @@ What: /sys/devices/system/cpu/vulnerabilities
531531
/sys/devices/system/cpu/vulnerabilities/spectre_v1
532532
/sys/devices/system/cpu/vulnerabilities/spectre_v2
533533
/sys/devices/system/cpu/vulnerabilities/srbds
534+
/sys/devices/system/cpu/vulnerabilities/tsa
534535
/sys/devices/system/cpu/vulnerabilities/tsx_async_abort
535536
Date: January 2018
536537
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
@@ -6711,6 +6711,19 @@
67116711
first trust source as a backend which is initialized
67126712
successfully during iteration.
67136713

6714+
tsa= [X86] Control mitigation for Transient Scheduler
6715+
Attacks on AMD CPUs. Search the following in your
6716+
favourite search engine for more details:
6717+
6718+
"Technical guidance for mitigating transient scheduler
6719+
attacks".
6720+
6721+
off - disable the mitigation
6722+
on - enable the mitigation (default)
6723+
user - mitigate only user/kernel transitions
6724+
vm - mitigate only guest/host transitions
6725+
6726+
67146727
tsc= Disable clocksource stability checks for TSC.
67156728
Format: <string>
67166729
[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/x86/Kconfig

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1318,6 +1318,7 @@ config X86_REBOOTFIXUPS
13181318
config MICROCODE
13191319
def_bool y
13201320
depends on CPU_SUP_AMD || CPU_SUP_INTEL
1321+
select CRYPTO_LIB_SHA256 if CPU_SUP_AMD
13211322

13221323
config MICROCODE_INITRD32
13231324
def_bool y
@@ -2744,6 +2745,15 @@ config MITIGATION_ITS
27442745
disabled, mitigation cannot be enabled via cmdline.
27452746
See <file:Documentation/admin-guide/hw-vuln/indirect-target-selection.rst>
27462747

2748+
config MITIGATION_TSA
2749+
bool "Mitigate Transient Scheduler Attacks"
2750+
depends on CPU_SUP_AMD
2751+
default y
2752+
help
2753+
Enable mitigation for Transient Scheduler Attacks. TSA is a hardware
2754+
security vulnerability on AMD CPUs which can lead to forwarding of
2755+
invalid info to subsequent instructions and thus can affect their
2756+
timing and thereby cause a leakage.
27472757
endif
27482758

27492759
config ARCH_HAS_ADD_PAGES

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/cpu_device_id.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,16 @@ struct x86_cpu_desc {
247247
.x86_microcode_rev = (revision), \
248248
}
249249

250+
#define AMD_CPU_DESC(fam, model, stepping, revision) { \
251+
.x86_family = (fam), \
252+
.x86_vendor = X86_VENDOR_AMD, \
253+
.x86_model = (model), \
254+
.x86_stepping = (stepping), \
255+
.x86_microcode_rev = (revision), \
256+
}
257+
250258
extern const struct x86_cpu_id *x86_match_cpu(const struct x86_cpu_id *match);
251259
extern bool x86_cpu_has_min_microcode_rev(const struct x86_cpu_desc *table);
260+
extern bool x86_match_min_microcode_rev(const struct x86_cpu_id *table);
252261

253262
#endif /* _ASM_X86_CPU_DEVICE_ID */

arch/x86/include/asm/cpufeatures.h

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -459,6 +459,7 @@
459459
#define X86_FEATURE_NO_NESTED_DATA_BP (20*32+ 0) /* No Nested Data Breakpoints */
460460
#define X86_FEATURE_WRMSR_XX_BASE_NS (20*32+ 1) /* WRMSR to {FS,GS,KERNEL_GS}_BASE is non-serializing */
461461
#define X86_FEATURE_LFENCE_RDTSC (20*32+ 2) /* LFENCE always serializing / synchronizes RDTSC */
462+
#define X86_FEATURE_VERW_CLEAR (20*32+ 5) /* The memory form of VERW mitigates TSA */
462463
#define X86_FEATURE_NULL_SEL_CLR_BASE (20*32+ 6) /* Null Selector Clears Base */
463464
#define X86_FEATURE_AUTOIBRS (20*32+ 8) /* Automatic IBRS */
464465
#define X86_FEATURE_NO_SMM_CTL_MSR (20*32+ 9) /* SMM_CTL MSR is not present */
@@ -483,10 +484,13 @@
483484
#define X86_FEATURE_BHI_CTRL (21*32+ 2) /* BHI_DIS_S HW control available */
484485
#define X86_FEATURE_CLEAR_BHB_HW (21*32+ 3) /* BHI_DIS_S HW control enabled */
485486
#define X86_FEATURE_CLEAR_BHB_LOOP_ON_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_HETEROGENEOUS_CORES (21*32 + 6) /* Heterogeneous Core Topology */
488-
#define X86_FEATURE_AMD_WORKLOAD_CLASS (21*32 + 7) /* Workload Classification */
489-
#define X86_FEATURE_INDIRECT_THUNK_ITS (21*32 + 9) /* Use thunk for indirect branches in lower half of cacheline */
487+
#define X86_FEATURE_AMD_FAST_CPPC (21*32+ 5) /* Fast CPPC */
488+
#define X86_FEATURE_AMD_HETEROGENEOUS_CORES (21*32+ 6) /* Heterogeneous Core Topology */
489+
#define X86_FEATURE_AMD_WORKLOAD_CLASS (21*32+ 7) /* Workload Classification */
490+
#define X86_FEATURE_INDIRECT_THUNK_ITS (21*32+10) /* Use thunk for indirect branches in lower half of cacheline */
491+
#define X86_FEATURE_TSA_SQ_NO (21*32+11) /* AMD CPU not vulnerable to TSA-SQ */
492+
#define X86_FEATURE_TSA_L1_NO (21*32+12) /* AMD CPU not vulnerable to TSA-L1 */
493+
#define X86_FEATURE_CLEAR_CPU_BUF_VM (21*32+13) /* Clear CPU buffers using VERW before VMRUN */
490494

491495
/*
492496
* BUG word(s)
@@ -533,12 +537,13 @@
533537
#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 */
534538

535539
/* BUG word 2 */
536-
#define X86_BUG_SRSO X86_BUG(1*32 + 0) /* "srso" AMD SRSO bug */
537-
#define X86_BUG_DIV0 X86_BUG(1*32 + 1) /* "div0" AMD DIV0 speculation bug */
538-
#define X86_BUG_RFDS X86_BUG(1*32 + 2) /* "rfds" CPU is vulnerable to Register File Data Sampling */
539-
#define X86_BUG_BHI X86_BUG(1*32 + 3) /* "bhi" CPU is affected by Branch History Injection */
540-
#define X86_BUG_IBPB_NO_RET X86_BUG(1*32 + 4) /* "ibpb_no_ret" IBPB omits return target predictions */
541-
#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 */
542-
#define X86_BUG_ITS X86_BUG(1*32 + 6) /* "its" CPU is affected by Indirect Target Selection */
543-
#define X86_BUG_ITS_NATIVE_ONLY X86_BUG(1*32 + 7) /* "its_native_only" CPU is affected by ITS, VMX is not affected */
540+
#define X86_BUG_SRSO X86_BUG( 1*32+ 0) /* "srso" AMD SRSO bug */
541+
#define X86_BUG_DIV0 X86_BUG( 1*32+ 1) /* "div0" AMD DIV0 speculation bug */
542+
#define X86_BUG_RFDS X86_BUG( 1*32+ 2) /* "rfds" CPU is vulnerable to Register File Data Sampling */
543+
#define X86_BUG_BHI X86_BUG( 1*32+ 3) /* "bhi" CPU is affected by Branch History Injection */
544+
#define X86_BUG_IBPB_NO_RET X86_BUG( 1*32+ 4) /* "ibpb_no_ret" IBPB omits return target predictions */
545+
#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 */
546+
#define X86_BUG_ITS X86_BUG( 1*32+ 7) /* "its" CPU is affected by Indirect Target Selection */
547+
#define X86_BUG_ITS_NATIVE_ONLY X86_BUG( 1*32+ 8) /* "its_native_only" CPU is affected by ITS, VMX is not affected */
548+
#define X86_BUG_TSA X86_BUG( 1*32+ 9) /* "tsa" CPU is affected by Transient Scheduler Attacks */
544549
#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

arch/x86/include/asm/microcode.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,12 @@ struct ucode_cpu_info {
1717
void load_ucode_bsp(void);
1818
void load_ucode_ap(void);
1919
void microcode_bsp_resume(void);
20+
bool __init microcode_loader_disabled(void);
2021
#else
2122
static inline void load_ucode_bsp(void) { }
2223
static inline void load_ucode_ap(void) { }
2324
static inline void microcode_bsp_resume(void) { }
25+
static inline bool __init microcode_loader_disabled(void) { return false; }
2426
#endif
2527

2628
extern unsigned long initrd_start_early;

0 commit comments

Comments
 (0)