Skip to content

Commit c5a3d3c

Browse files
committed
Merge tag 'x86_cpu_for_v5.19_rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull x86 CPU feature updates from Borislav Petkov: - Remove a bunch of chicken bit options to turn off CPU features which are not really needed anymore - Misc fixes and cleanups * tag 'x86_cpu_for_v5.19_rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: x86/speculation: Add missing prototype for unpriv_ebpf_notify() x86/pm: Fix false positive kmemleak report in msr_build_context() x86/speculation/srbds: Do not try to turn mitigation off when not supported x86/cpu: Remove "noclflush" x86/cpu: Remove "noexec" x86/cpu: Remove "nosmep" x86/cpu: Remove CONFIG_X86_SMAP and "nosmap" x86/cpu: Remove "nosep" x86/cpu: Allow feature bit names from /proc/cpuinfo in clearcpuid=
2 parents 3a755eb + 2147c43 commit c5a3d3c

File tree

20 files changed

+120
-203
lines changed

20 files changed

+120
-203
lines changed

Documentation/admin-guide/kernel-parameters.txt

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -631,12 +631,17 @@
631631
Defaults to zero when built as a module and to
632632
10 seconds when built into the kernel.
633633

634-
clearcpuid=BITNUM[,BITNUM...] [X86]
634+
clearcpuid=X[,X...] [X86]
635635
Disable CPUID feature X for the kernel. See
636636
arch/x86/include/asm/cpufeatures.h for the valid bit
637-
numbers. Note the Linux specific bits are not necessarily
638-
stable over kernel options, but the vendor specific
637+
numbers X. Note the Linux-specific bits are not necessarily
638+
stable over kernel options, but the vendor-specific
639639
ones should be.
640+
X can also be a string as appearing in the flags: line
641+
in /proc/cpuinfo which does not have the above
642+
instability issue. However, not all features have names
643+
in /proc/cpuinfo.
644+
Note that using this option will taint your kernel.
640645
Also note that user programs calling CPUID directly
641646
or using the feature without checking anything
642647
will still see it. This just prevents it from
@@ -3478,8 +3483,6 @@
34783483

34793484
nocache [ARM]
34803485

3481-
noclflush [BUGS=X86] Don't use the CLFLUSH instruction
3482-
34833486
delayacct [KNL] Enable per-task delay accounting
34843487

34853488
nodsp [SH] Disable hardware DSP at boot time.
@@ -3490,16 +3493,11 @@
34903493

34913494
noexec [IA-64]
34923495

3493-
noexec [X86]
3494-
On X86-32 available only on PAE configured kernels.
3495-
noexec=on: enable non-executable mappings (default)
3496-
noexec=off: disable non-executable mappings
3497-
3498-
nosmap [X86,PPC]
3496+
nosmap [PPC]
34993497
Disable SMAP (Supervisor Mode Access Prevention)
35003498
even if it is supported by processor.
35013499

3502-
nosmep [X86,PPC64s]
3500+
nosmep [PPC64s]
35033501
Disable SMEP (Supervisor Mode Execution Prevention)
35043502
even if it is supported by processor.
35053503

@@ -3699,8 +3697,6 @@
36993697

37003698
nosbagart [IA-64]
37013699

3702-
nosep [BUGS=X86-32] Disables x86 SYSENTER/SYSEXIT support.
3703-
37043700
nosgx [X86-64,SGX] Disables Intel SGX kernel support.
37053701

37063702
nosmp [SMP] Tells an SMP kernel to act as a UP kernel,

Documentation/x86/cpuinfo.rst

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,9 +140,8 @@ from #define X86_FEATURE_UMIP (16*32 + 2).
140140

141141
In addition, there exists a variety of custom command-line parameters that
142142
disable specific features. The list of parameters includes, but is not limited
143-
to, nofsgsbase, nosmap, and nosmep. 5-level paging can also be disabled using
144-
"no5lvl". SMAP and SMEP are disabled with the aforementioned parameters,
145-
respectively.
143+
to, nofsgsbase, nosgx, noxsave, etc. 5-level paging can also be disabled using
144+
"no5lvl".
146145

147146
e: The feature was known to be non-functional.
148147
----------------------------------------------

Documentation/x86/x86_64/boot-options.rst

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -157,15 +157,6 @@ Rebooting
157157
newer BIOS, or newer board) using this option will ignore the built-in
158158
quirk table, and use the generic default reboot actions.
159159

160-
Non Executable Mappings
161-
=======================
162-
163-
noexec=on|off
164-
on
165-
Enable(default)
166-
off
167-
Disable
168-
169160
NUMA
170161
====
171162

arch/x86/Kconfig

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1831,17 +1831,6 @@ config ARCH_RANDOM
18311831
If supported, this is a high bandwidth, cryptographically
18321832
secure hardware random number generator.
18331833

1834-
config X86_SMAP
1835-
def_bool y
1836-
prompt "Supervisor Mode Access Prevention" if EXPERT
1837-
help
1838-
Supervisor Mode Access Prevention (SMAP) is a security
1839-
feature in newer Intel processors. There is a small
1840-
performance cost if this enabled and turned on; there is
1841-
also a small increase in the kernel size if this is enabled.
1842-
1843-
If unsure, say Y.
1844-
18451834
config X86_UMIP
18461835
def_bool y
18471836
prompt "User Mode Instruction Prevention" if EXPERT

arch/x86/include/asm/cpufeature.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,17 @@ enum cpuid_leafs
3434
CPUID_8000_001F_EAX,
3535
};
3636

37+
#define X86_CAP_FMT_NUM "%d:%d"
38+
#define x86_cap_flag_num(flag) ((flag) >> 5), ((flag) & 31)
39+
3740
#ifdef CONFIG_X86_FEATURE_NAMES
3841
extern const char * const x86_cap_flags[NCAPINTS*32];
3942
extern const char * const x86_power_flags[32];
4043
#define X86_CAP_FMT "%s"
4144
#define x86_cap_flag(flag) x86_cap_flags[flag]
4245
#else
43-
#define X86_CAP_FMT "%d:%d"
44-
#define x86_cap_flag(flag) ((flag) >> 5), ((flag) & 31)
46+
#define X86_CAP_FMT X86_CAP_FMT_NUM
47+
#define x86_cap_flag x86_cap_flag_num
4548
#endif
4649

4750
/*

arch/x86/include/asm/disabled-features.h

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,6 @@
1010
* cpu_feature_enabled().
1111
*/
1212

13-
#ifdef CONFIG_X86_SMAP
14-
# define DISABLE_SMAP 0
15-
#else
16-
# define DISABLE_SMAP (1<<(X86_FEATURE_SMAP & 31))
17-
#endif
18-
1913
#ifdef CONFIG_X86_UMIP
2014
# define DISABLE_UMIP 0
2115
#else
@@ -86,7 +80,7 @@
8680
#define DISABLED_MASK6 0
8781
#define DISABLED_MASK7 (DISABLE_PTI)
8882
#define DISABLED_MASK8 (DISABLE_TDX_GUEST)
89-
#define DISABLED_MASK9 (DISABLE_SMAP|DISABLE_SGX)
83+
#define DISABLED_MASK9 (DISABLE_SGX)
9084
#define DISABLED_MASK10 0
9185
#define DISABLED_MASK11 0
9286
#define DISABLED_MASK12 0

arch/x86/include/asm/proto.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ void xen_entry_INT80_compat(void);
3939
#endif
4040

4141
void x86_configure_nx(void);
42-
void x86_report_nx(void);
4342

4443
extern int reboot_force;
4544

arch/x86/include/asm/smap.h

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -19,25 +19,14 @@
1919

2020
#ifdef __ASSEMBLY__
2121

22-
#ifdef CONFIG_X86_SMAP
23-
2422
#define ASM_CLAC \
2523
ALTERNATIVE "", __ASM_CLAC, X86_FEATURE_SMAP
2624

2725
#define ASM_STAC \
2826
ALTERNATIVE "", __ASM_STAC, X86_FEATURE_SMAP
2927

30-
#else /* CONFIG_X86_SMAP */
31-
32-
#define ASM_CLAC
33-
#define ASM_STAC
34-
35-
#endif /* CONFIG_X86_SMAP */
36-
3728
#else /* __ASSEMBLY__ */
3829

39-
#ifdef CONFIG_X86_SMAP
40-
4130
static __always_inline void clac(void)
4231
{
4332
/* Note: a barrier is implicit in alternative() */
@@ -76,19 +65,6 @@ static __always_inline void smap_restore(unsigned long flags)
7665
#define ASM_STAC \
7766
ALTERNATIVE("", __ASM_STAC, X86_FEATURE_SMAP)
7867

79-
#else /* CONFIG_X86_SMAP */
80-
81-
static inline void clac(void) { }
82-
static inline void stac(void) { }
83-
84-
static inline unsigned long smap_save(void) { return 0; }
85-
static inline void smap_restore(unsigned long flags) { }
86-
87-
#define ASM_CLAC
88-
#define ASM_STAC
89-
90-
#endif /* CONFIG_X86_SMAP */
91-
9268
#endif /* __ASSEMBLY__ */
9369

9470
#endif /* _ASM_X86_SMAP_H */

arch/x86/include/asm/suspend_32.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ struct saved_context {
1919
u16 gs;
2020
unsigned long cr0, cr2, cr3, cr4;
2121
u64 misc_enable;
22-
bool misc_enable_saved;
2322
struct saved_msrs saved_msrs;
2423
struct desc_ptr gdt_desc;
2524
struct desc_ptr idt;
@@ -28,6 +27,7 @@ struct saved_context {
2827
unsigned long tr;
2928
unsigned long safety;
3029
unsigned long return_address;
30+
bool misc_enable_saved;
3131
} __attribute__((packed));
3232

3333
/* routines for saving/restoring kernel state */

arch/x86/include/asm/suspend_64.h

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,13 @@
1414
* Image of the saved processor state, used by the low level ACPI suspend to
1515
* RAM code and by the low level hibernation code.
1616
*
17-
* If you modify it, fix arch/x86/kernel/acpi/wakeup_64.S and make sure that
18-
* __save/__restore_processor_state(), defined in arch/x86/kernel/suspend_64.c,
19-
* still work as required.
17+
* If you modify it, check how it is used in arch/x86/kernel/acpi/wakeup_64.S
18+
* and make sure that __save/__restore_processor_state(), defined in
19+
* arch/x86/power/cpu.c, still work as required.
20+
*
21+
* Because the structure is packed, make sure to avoid unaligned members. For
22+
* optimisation purposes but also because tools like kmemleak only search for
23+
* pointers that are aligned.
2024
*/
2125
struct saved_context {
2226
struct pt_regs regs;
@@ -36,7 +40,6 @@ struct saved_context {
3640

3741
unsigned long cr0, cr2, cr3, cr4;
3842
u64 misc_enable;
39-
bool misc_enable_saved;
4043
struct saved_msrs saved_msrs;
4144
unsigned long efer;
4245
u16 gdt_pad; /* Unused */
@@ -48,6 +51,7 @@ struct saved_context {
4851
unsigned long tr;
4952
unsigned long safety;
5053
unsigned long return_address;
54+
bool misc_enable_saved;
5155
} __attribute__((packed));
5256

5357
#define loaddebug(thread,register) \

0 commit comments

Comments
 (0)