Skip to content

Commit 0911b8c

Browse files
leitaoIngo Molnar
authored andcommitted
x86/bugs: Rename CONFIG_RETHUNK => CONFIG_MITIGATION_RETHUNK
Step 10/10 of the namespace unification of CPU mitigations related Kconfig options. [ mingo: Added one more case. ] Suggested-by: Josh Poimboeuf <jpoimboe@kernel.org> Signed-off-by: Breno Leitao <leitao@debian.org> Signed-off-by: Ingo Molnar <mingo@kernel.org> Acked-by: Josh Poimboeuf <jpoimboe@kernel.org> Cc: Linus Torvalds <torvalds@linux-foundation.org> Link: https://lore.kernel.org/r/20231121160740.1249350-11-leitao@debian.org
1 parent a033eec commit 0911b8c

File tree

13 files changed

+20
-20
lines changed

13 files changed

+20
-20
lines changed

arch/x86/Kconfig

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2462,7 +2462,7 @@ config FINEIBT
24622462

24632463
config HAVE_CALL_THUNKS
24642464
def_bool y
2465-
depends on CC_HAS_ENTRY_PADDING && RETHUNK && OBJTOOL
2465+
depends on CC_HAS_ENTRY_PADDING && MITIGATION_RETHUNK && OBJTOOL
24662466

24672467
config CALL_THUNKS
24682468
def_bool n
@@ -2505,7 +2505,7 @@ config MITIGATION_RETPOLINE
25052505
branches. Requires a compiler with -mindirect-branch=thunk-extern
25062506
support for full protection. The kernel may run slower.
25072507

2508-
config RETHUNK
2508+
config MITIGATION_RETHUNK
25092509
bool "Enable return-thunks"
25102510
depends on MITIGATION_RETPOLINE && CC_HAS_RETURN_THUNK
25112511
select OBJTOOL if HAVE_OBJTOOL
@@ -2518,7 +2518,7 @@ config RETHUNK
25182518

25192519
config MITIGATION_UNRET_ENTRY
25202520
bool "Enable UNRET on kernel entry"
2521-
depends on CPU_SUP_AMD && RETHUNK && X86_64
2521+
depends on CPU_SUP_AMD && MITIGATION_RETHUNK && X86_64
25222522
default y
25232523
help
25242524
Compile the kernel with support for the retbleed=unret mitigation.
@@ -2572,7 +2572,7 @@ config MITIGATION_IBRS_ENTRY
25722572

25732573
config MITIGATION_SRSO
25742574
bool "Mitigate speculative RAS overflow on AMD"
2575-
depends on CPU_SUP_AMD && X86_64 && RETHUNK
2575+
depends on CPU_SUP_AMD && X86_64 && MITIGATION_RETHUNK
25762576
default y
25772577
help
25782578
Enable the SRSO mitigation needed on AMD Zen1-4 machines.

arch/x86/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ RETPOLINE_VDSO_CFLAGS := -mretpoline
2222
endif
2323
RETPOLINE_CFLAGS += $(call cc-option,-mindirect-branch-cs-prefix)
2424

25-
ifdef CONFIG_RETHUNK
25+
ifdef CONFIG_MITIGATION_RETHUNK
2626
RETHUNK_CFLAGS := -mfunction-return=thunk-extern
2727
RETPOLINE_CFLAGS += $(RETHUNK_CFLAGS)
2828
endif

arch/x86/configs/i386_defconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ CONFIG_EFI_STUB=y
4242
CONFIG_HZ_1000=y
4343
CONFIG_KEXEC=y
4444
CONFIG_CRASH_DUMP=y
45-
# CONFIG_RETHUNK is not set
45+
# CONFIG_MITIGATION_RETHUNK is not set
4646
CONFIG_HIBERNATION=y
4747
CONFIG_PM_DEBUG=y
4848
CONFIG_PM_TRACE_RTC=y

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
(1 << (X86_FEATURE_RETPOLINE_LFENCE & 31)))
5858
#endif
5959

60-
#ifdef CONFIG_RETHUNK
60+
#ifdef CONFIG_MITIGATION_RETHUNK
6161
# define DISABLE_RETHUNK 0
6262
#else
6363
# define DISABLE_RETHUNK (1 << (X86_FEATURE_RETHUNK & 31))

arch/x86/include/asm/linkage.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040

4141
#ifdef __ASSEMBLY__
4242

43-
#if defined(CONFIG_RETHUNK) && !defined(__DISABLE_EXPORTS) && !defined(BUILD_VDSO)
43+
#if defined(CONFIG_MITIGATION_RETHUNK) && !defined(__DISABLE_EXPORTS) && !defined(BUILD_VDSO)
4444
#define RET jmp __x86_return_thunk
4545
#else /* CONFIG_MITIGATION_RETPOLINE */
4646
#ifdef CONFIG_MITIGATION_SLS
@@ -52,7 +52,7 @@
5252

5353
#else /* __ASSEMBLY__ */
5454

55-
#if defined(CONFIG_RETHUNK) && !defined(__DISABLE_EXPORTS) && !defined(BUILD_VDSO)
55+
#if defined(CONFIG_MITIGATION_RETHUNK) && !defined(__DISABLE_EXPORTS) && !defined(BUILD_VDSO)
5656
#define ASM_RET "jmp __x86_return_thunk\n\t"
5757
#else /* CONFIG_MITIGATION_RETPOLINE */
5858
#ifdef CONFIG_MITIGATION_SLS

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@
289289
* where we have a stack but before any RET instruction.
290290
*/
291291
.macro __UNTRAIN_RET ibpb_feature, call_depth_insns
292-
#if defined(CONFIG_RETHUNK) || defined(CONFIG_MITIGATION_IBPB_ENTRY)
292+
#if defined(CONFIG_MITIGATION_RETHUNK) || defined(CONFIG_MITIGATION_IBPB_ENTRY)
293293
VALIDATE_UNRET_END
294294
ALTERNATIVE_3 "", \
295295
CALL_UNTRAIN_RET, X86_FEATURE_UNRET, \
@@ -328,7 +328,7 @@ extern retpoline_thunk_t __x86_indirect_thunk_array[];
328328
extern retpoline_thunk_t __x86_indirect_call_thunk_array[];
329329
extern retpoline_thunk_t __x86_indirect_jump_thunk_array[];
330330

331-
#ifdef CONFIG_RETHUNK
331+
#ifdef CONFIG_MITIGATION_RETHUNK
332332
extern void __x86_return_thunk(void);
333333
#else
334334
static inline void __x86_return_thunk(void) {}

arch/x86/include/asm/static_call.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
#define ARCH_DEFINE_STATIC_CALL_TRAMP(name, func) \
4747
__ARCH_DEFINE_STATIC_CALL_TRAMP(name, ".byte 0xe9; .long " #func " - (. + 4)")
4848

49-
#ifdef CONFIG_RETHUNK
49+
#ifdef CONFIG_MITIGATION_RETHUNK
5050
#define ARCH_DEFINE_STATIC_CALL_NULL_TRAMP(name) \
5151
__ARCH_DEFINE_STATIC_CALL_TRAMP(name, "jmp __x86_return_thunk")
5252
#else

arch/x86/kernel/alternative.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -769,7 +769,7 @@ void __init_or_module noinline apply_retpolines(s32 *start, s32 *end)
769769
}
770770
}
771771

772-
#ifdef CONFIG_RETHUNK
772+
#ifdef CONFIG_MITIGATION_RETHUNK
773773

774774
/*
775775
* Rewrite the compiler generated return thunk tail-calls.
@@ -842,7 +842,7 @@ void __init_or_module noinline apply_returns(s32 *start, s32 *end)
842842
}
843843
#else
844844
void __init_or_module noinline apply_returns(s32 *start, s32 *end) { }
845-
#endif /* CONFIG_RETHUNK */
845+
#endif /* CONFIG_MITIGATION_RETHUNK */
846846

847847
#else /* !CONFIG_MITIGATION_RETPOLINE || !CONFIG_OBJTOOL */
848848

arch/x86/kernel/static_call.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ void arch_static_call_transform(void *site, void *tramp, void *func, bool tail)
172172
}
173173
EXPORT_SYMBOL_GPL(arch_static_call_transform);
174174

175-
#ifdef CONFIG_RETHUNK
175+
#ifdef CONFIG_MITIGATION_RETHUNK
176176
/*
177177
* This is called by apply_returns() to fix up static call trampolines,
178178
* specifically ARCH_DEFINE_STATIC_CALL_NULL_TRAMP which is recorded as

arch/x86/lib/retpoline.S

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ SYM_CODE_END(__x86_indirect_jump_thunk_array)
127127
#undef GEN
128128
#endif
129129

130-
#ifdef CONFIG_RETHUNK
130+
#ifdef CONFIG_MITIGATION_RETHUNK
131131

132132
/*
133133
* Be careful here: that label cannot really be removed because in
@@ -386,4 +386,4 @@ SYM_CODE_START(__x86_return_thunk)
386386
SYM_CODE_END(__x86_return_thunk)
387387
EXPORT_SYMBOL(__x86_return_thunk)
388388

389-
#endif /* CONFIG_RETHUNK */
389+
#endif /* CONFIG_MITIGATION_RETHUNK */

0 commit comments

Comments
 (0)