Skip to content

Commit aefb2f2

Browse files
leitaoIngo Molnar
authored andcommitted
x86/bugs: Rename CONFIG_RETPOLINE => CONFIG_MITIGATION_RETPOLINE
Step 5/10 of the namespace unification of CPU mitigations related Kconfig options. [ mingo: Converted a few more uses in comments/messages as well. ] Suggested-by: Josh Poimboeuf <[email protected]> Signed-off-by: Breno Leitao <[email protected]> Signed-off-by: Ingo Molnar <[email protected]> Reviewed-by: Ariel Miculas <[email protected]> Acked-by: Josh Poimboeuf <[email protected]> Cc: Linus Torvalds <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent ea4654e commit aefb2f2

File tree

39 files changed

+62
-62
lines changed

39 files changed

+62
-62
lines changed

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -473,8 +473,8 @@ Spectre variant 2
473473
-mindirect-branch=thunk-extern -mindirect-branch-register options.
474474
If the kernel is compiled with a Clang compiler, the compiler needs
475475
to support -mretpoline-external-thunk option. The kernel config
476-
CONFIG_RETPOLINE needs to be turned on, and the CPU needs to run with
477-
the latest updated microcode.
476+
CONFIG_MITIGATION_RETPOLINE needs to be turned on, and the CPU needs
477+
to run with the latest updated microcode.
478478

479479
On Intel Skylake-era systems the mitigation covers most, but not all,
480480
cases. See :ref:`[3] <spec_ref3>` for more details.
@@ -609,8 +609,8 @@ kernel command line.
609609
Selecting 'on' will, and 'auto' may, choose a
610610
mitigation method at run time according to the
611611
CPU, the available microcode, the setting of the
612-
CONFIG_RETPOLINE configuration option, and the
613-
compiler with which the kernel was built.
612+
CONFIG_MITIGATION_RETPOLINE configuration option,
613+
and the compiler with which the kernel was built.
614614

615615
Selecting 'on' will also enable the mitigation
616616
against user space to user space task attacks.

Documentation/admin-guide/kernel-parameters.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6007,8 +6007,8 @@
60076007
Selecting 'on' will, and 'auto' may, choose a
60086008
mitigation method at run time according to the
60096009
CPU, the available microcode, the setting of the
6010-
CONFIG_RETPOLINE configuration option, and the
6011-
compiler with which the kernel was built.
6010+
CONFIG_MITIGATION_RETPOLINE configuration option,
6011+
and the compiler with which the kernel was built.
60126012

60136013
Selecting 'on' will also enable the mitigation
60146014
against user space to user space task attacks.

arch/x86/Kconfig

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2457,7 +2457,7 @@ config CALL_PADDING
24572457

24582458
config FINEIBT
24592459
def_bool y
2460-
depends on X86_KERNEL_IBT && CFI_CLANG && RETPOLINE
2460+
depends on X86_KERNEL_IBT && CFI_CLANG && MITIGATION_RETPOLINE
24612461
select CALL_PADDING
24622462

24632463
config HAVE_CALL_THUNKS
@@ -2495,7 +2495,7 @@ config MITIGATION_PAGE_TABLE_ISOLATION
24952495

24962496
See Documentation/arch/x86/pti.rst for more details.
24972497

2498-
config RETPOLINE
2498+
config MITIGATION_RETPOLINE
24992499
bool "Avoid speculative indirect branches in kernel"
25002500
select OBJTOOL if HAVE_OBJTOOL
25012501
default y
@@ -2507,7 +2507,7 @@ config RETPOLINE
25072507

25082508
config RETHUNK
25092509
bool "Enable return-thunks"
2510-
depends on RETPOLINE && CC_HAS_RETURN_THUNK
2510+
depends on MITIGATION_RETPOLINE && CC_HAS_RETURN_THUNK
25112511
select OBJTOOL if HAVE_OBJTOOL
25122512
default y if X86_64
25132513
help

arch/x86/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ KBUILD_CFLAGS += -Wno-sign-compare
192192
KBUILD_CFLAGS += -fno-asynchronous-unwind-tables
193193

194194
# Avoid indirect branches in kernel to deal with Spectre
195-
ifdef CONFIG_RETPOLINE
195+
ifdef CONFIG_MITIGATION_RETPOLINE
196196
KBUILD_CFLAGS += $(RETPOLINE_CFLAGS)
197197
# Additionally, avoid generating expensive indirect jumps which
198198
# are subject to retpolines for small number of switch cases.
@@ -301,7 +301,7 @@ vdso-install-$(CONFIG_IA32_EMULATION) += arch/x86/entry/vdso/vdso32.so.dbg
301301

302302
archprepare: checkbin
303303
checkbin:
304-
ifdef CONFIG_RETPOLINE
304+
ifdef CONFIG_MITIGATION_RETPOLINE
305305
ifeq ($(RETPOLINE_CFLAGS),)
306306
@echo "You are building kernel with non-retpoline compiler." >&2
307307
@echo "Please update your compiler." >&2

arch/x86/entry/vdso/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ CFL := $(PROFILING) -mcmodel=small -fPIC -O2 -fasynchronous-unwind-tables -m64 \
8787
-fno-omit-frame-pointer -foptimize-sibling-calls \
8888
-DDISABLE_BRANCH_PROFILING -DBUILD_VDSO
8989

90-
ifdef CONFIG_RETPOLINE
90+
ifdef CONFIG_MITIGATION_RETPOLINE
9191
ifneq ($(RETPOLINE_VDSO_CFLAGS),)
9292
CFL += $(RETPOLINE_VDSO_CFLAGS)
9393
endif
@@ -164,7 +164,7 @@ KBUILD_CFLAGS_32 += $(call cc-option, -foptimize-sibling-calls)
164164
KBUILD_CFLAGS_32 += -fno-omit-frame-pointer
165165
KBUILD_CFLAGS_32 += -DDISABLE_BRANCH_PROFILING
166166

167-
ifdef CONFIG_RETPOLINE
167+
ifdef CONFIG_MITIGATION_RETPOLINE
168168
ifneq ($(RETPOLINE_VDSO_CFLAGS),)
169169
KBUILD_CFLAGS_32 += $(RETPOLINE_VDSO_CFLAGS)
170170
endif

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
# define DISABLE_PTI (1 << (X86_FEATURE_PTI & 31))
5151
#endif
5252

53-
#ifdef CONFIG_RETPOLINE
53+
#ifdef CONFIG_MITIGATION_RETPOLINE
5454
# define DISABLE_RETPOLINE 0
5555
#else
5656
# define DISABLE_RETPOLINE ((1 << (X86_FEATURE_RETPOLINE & 31)) | \

arch/x86/include/asm/linkage.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,25 +42,25 @@
4242

4343
#if defined(CONFIG_RETHUNK) && !defined(__DISABLE_EXPORTS) && !defined(BUILD_VDSO)
4444
#define RET jmp __x86_return_thunk
45-
#else /* CONFIG_RETPOLINE */
45+
#else /* CONFIG_MITIGATION_RETPOLINE */
4646
#ifdef CONFIG_SLS
4747
#define RET ret; int3
4848
#else
4949
#define RET ret
5050
#endif
51-
#endif /* CONFIG_RETPOLINE */
51+
#endif /* CONFIG_MITIGATION_RETPOLINE */
5252

5353
#else /* __ASSEMBLY__ */
5454

5555
#if defined(CONFIG_RETHUNK) && !defined(__DISABLE_EXPORTS) && !defined(BUILD_VDSO)
5656
#define ASM_RET "jmp __x86_return_thunk\n\t"
57-
#else /* CONFIG_RETPOLINE */
57+
#else /* CONFIG_MITIGATION_RETPOLINE */
5858
#ifdef CONFIG_SLS
5959
#define ASM_RET "ret; int3\n\t"
6060
#else
6161
#define ASM_RET "ret\n\t"
6262
#endif
63-
#endif /* CONFIG_RETPOLINE */
63+
#endif /* CONFIG_MITIGATION_RETPOLINE */
6464

6565
#endif /* __ASSEMBLY__ */
6666

arch/x86/include/asm/nospec-branch.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@
241241
* instruction irrespective of kCFI.
242242
*/
243243
.macro JMP_NOSPEC reg:req
244-
#ifdef CONFIG_RETPOLINE
244+
#ifdef CONFIG_MITIGATION_RETPOLINE
245245
__CS_PREFIX \reg
246246
jmp __x86_indirect_thunk_\reg
247247
#else
@@ -251,7 +251,7 @@
251251
.endm
252252

253253
.macro CALL_NOSPEC reg:req
254-
#ifdef CONFIG_RETPOLINE
254+
#ifdef CONFIG_MITIGATION_RETPOLINE
255255
__CS_PREFIX \reg
256256
call __x86_indirect_thunk_\reg
257257
#else
@@ -378,7 +378,7 @@ static inline void call_depth_return_thunk(void) {}
378378

379379
#endif /* CONFIG_MITIGATION_CALL_DEPTH_TRACKING */
380380

381-
#ifdef CONFIG_RETPOLINE
381+
#ifdef CONFIG_MITIGATION_RETPOLINE
382382

383383
#define GEN(reg) \
384384
extern retpoline_thunk_t __x86_indirect_thunk_ ## reg;
@@ -399,7 +399,7 @@ static inline void call_depth_return_thunk(void) {}
399399

400400
/*
401401
* Inline asm uses the %V modifier which is only in newer GCC
402-
* which is ensured when CONFIG_RETPOLINE is defined.
402+
* which is ensured when CONFIG_MITIGATION_RETPOLINE is defined.
403403
*/
404404
# define CALL_NOSPEC \
405405
ALTERNATIVE_2( \

arch/x86/kernel/alternative.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -544,7 +544,7 @@ static inline bool is_jcc32(struct insn *insn)
544544
return insn->opcode.bytes[0] == 0x0f && (insn->opcode.bytes[1] & 0xf0) == 0x80;
545545
}
546546

547-
#if defined(CONFIG_RETPOLINE) && defined(CONFIG_OBJTOOL)
547+
#if defined(CONFIG_MITIGATION_RETPOLINE) && defined(CONFIG_OBJTOOL)
548548

549549
/*
550550
* CALL/JMP *%\reg
@@ -844,12 +844,12 @@ void __init_or_module noinline apply_returns(s32 *start, s32 *end)
844844
void __init_or_module noinline apply_returns(s32 *start, s32 *end) { }
845845
#endif /* CONFIG_RETHUNK */
846846

847-
#else /* !CONFIG_RETPOLINE || !CONFIG_OBJTOOL */
847+
#else /* !CONFIG_MITIGATION_RETPOLINE || !CONFIG_OBJTOOL */
848848

849849
void __init_or_module noinline apply_retpolines(s32 *start, s32 *end) { }
850850
void __init_or_module noinline apply_returns(s32 *start, s32 *end) { }
851851

852-
#endif /* CONFIG_RETPOLINE && CONFIG_OBJTOOL */
852+
#endif /* CONFIG_MITIGATION_RETPOLINE && CONFIG_OBJTOOL */
853853

854854
#ifdef CONFIG_X86_KERNEL_IBT
855855

arch/x86/kernel/cpu/bugs.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1103,7 +1103,7 @@ static enum spectre_v2_user_mitigation spectre_v2_user_stibp __ro_after_init =
11031103
static enum spectre_v2_user_mitigation spectre_v2_user_ibpb __ro_after_init =
11041104
SPECTRE_V2_USER_NONE;
11051105

1106-
#ifdef CONFIG_RETPOLINE
1106+
#ifdef CONFIG_MITIGATION_RETPOLINE
11071107
static bool spectre_v2_bad_module;
11081108

11091109
bool retpoline_module_ok(bool has_retpoline)
@@ -1416,7 +1416,7 @@ static enum spectre_v2_mitigation_cmd __init spectre_v2_parse_cmdline(void)
14161416
cmd == SPECTRE_V2_CMD_RETPOLINE_GENERIC ||
14171417
cmd == SPECTRE_V2_CMD_EIBRS_LFENCE ||
14181418
cmd == SPECTRE_V2_CMD_EIBRS_RETPOLINE) &&
1419-
!IS_ENABLED(CONFIG_RETPOLINE)) {
1419+
!IS_ENABLED(CONFIG_MITIGATION_RETPOLINE)) {
14201420
pr_err("%s selected but not compiled in. Switching to AUTO select\n",
14211421
mitigation_options[i].option);
14221422
return SPECTRE_V2_CMD_AUTO;
@@ -1470,7 +1470,7 @@ static enum spectre_v2_mitigation_cmd __init spectre_v2_parse_cmdline(void)
14701470

14711471
static enum spectre_v2_mitigation __init spectre_v2_select_retpoline(void)
14721472
{
1473-
if (!IS_ENABLED(CONFIG_RETPOLINE)) {
1473+
if (!IS_ENABLED(CONFIG_MITIGATION_RETPOLINE)) {
14741474
pr_err("Kernel not compiled with retpoline; no mitigation available!");
14751475
return SPECTRE_V2_NONE;
14761476
}

0 commit comments

Comments
 (0)