Commit ac61d439 authored by Breno Leitao's avatar Breno Leitao Committed by Ingo Molnar
Browse files

x86/bugs: Rename CONFIG_CPU_UNRET_ENTRY => CONFIG_MITIGATION_UNRET_ENTRY



Step 7/10 of the namespace unification of CPU mitigations related Kconfig options.

Suggested-by: default avatarJosh Poimboeuf <jpoimboe@kernel.org>
Signed-off-by: default avatarBreno Leitao <leitao@debian.org>
Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
Acked-by: default avatarJosh Poimboeuf <jpoimboe@kernel.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Link: https://lore.kernel.org/r/20231121160740.1249350-8-leitao@debian.org
parent 7b75782f
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -2516,7 +2516,7 @@ config RETHUNK
	  Requires a compiler with -mfunction-return=thunk-extern
	  support for full protection. The kernel may run slower.

config CPU_UNRET_ENTRY
config MITIGATION_UNRET_ENTRY
	bool "Enable UNRET on kernel entry"
	depends on CPU_SUP_AMD && RETHUNK && X86_64
	default y
+1 −1
Original line number Diff line number Diff line
@@ -63,7 +63,7 @@
# define DISABLE_RETHUNK	(1 << (X86_FEATURE_RETHUNK & 31))
#endif

#ifdef CONFIG_CPU_UNRET_ENTRY
#ifdef CONFIG_MITIGATION_UNRET_ENTRY
# define DISABLE_UNRET		0
#else
# define DISABLE_UNRET		(1 << (X86_FEATURE_UNRET & 31))
+3 −3
Original line number Diff line number Diff line
@@ -212,7 +212,7 @@
 */
.macro VALIDATE_UNRET_END
#if defined(CONFIG_NOINSTR_VALIDATION) && \
	(defined(CONFIG_CPU_UNRET_ENTRY) || defined(CONFIG_CPU_SRSO))
	(defined(CONFIG_MITIGATION_UNRET_ENTRY) || defined(CONFIG_CPU_SRSO))
	ANNOTATE_RETPOLINE_SAFE
	nop
#endif
@@ -271,7 +271,7 @@
.Lskip_rsb_\@:
.endm

#if defined(CONFIG_CPU_UNRET_ENTRY) || defined(CONFIG_CPU_SRSO)
#if defined(CONFIG_MITIGATION_UNRET_ENTRY) || defined(CONFIG_CPU_SRSO)
#define CALL_UNTRAIN_RET	"call entry_untrain_ret"
#else
#define CALL_UNTRAIN_RET	""
@@ -334,7 +334,7 @@ extern void __x86_return_thunk(void);
static inline void __x86_return_thunk(void) {}
#endif

#ifdef CONFIG_CPU_UNRET_ENTRY
#ifdef CONFIG_MITIGATION_UNRET_ENTRY
extern void retbleed_return_thunk(void);
#else
static inline void retbleed_return_thunk(void) {}
+1 −1
Original line number Diff line number Diff line
@@ -928,7 +928,7 @@ static void fix_erratum_1386(struct cpuinfo_x86 *c)

void init_spectral_chicken(struct cpuinfo_x86 *c)
{
#ifdef CONFIG_CPU_UNRET_ENTRY
#ifdef CONFIG_MITIGATION_UNRET_ENTRY
	u64 value;

	/*
+3 −3
Original line number Diff line number Diff line
@@ -982,10 +982,10 @@ static void __init retbleed_select_mitigation(void)
		return;

	case RETBLEED_CMD_UNRET:
		if (IS_ENABLED(CONFIG_CPU_UNRET_ENTRY)) {
		if (IS_ENABLED(CONFIG_MITIGATION_UNRET_ENTRY)) {
			retbleed_mitigation = RETBLEED_MITIGATION_UNRET;
		} else {
			pr_err("WARNING: kernel not compiled with CPU_UNRET_ENTRY.\n");
			pr_err("WARNING: kernel not compiled with MITIGATION_UNRET_ENTRY.\n");
			goto do_cmd_auto;
		}
		break;
@@ -1021,7 +1021,7 @@ static void __init retbleed_select_mitigation(void)
	case RETBLEED_CMD_AUTO:
		if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD ||
		    boot_cpu_data.x86_vendor == X86_VENDOR_HYGON) {
			if (IS_ENABLED(CONFIG_CPU_UNRET_ENTRY))
			if (IS_ENABLED(CONFIG_MITIGATION_UNRET_ENTRY))
				retbleed_mitigation = RETBLEED_MITIGATION_UNRET;
			else if (IS_ENABLED(CONFIG_MITIGATION_IBPB_ENTRY) &&
				 boot_cpu_has(X86_FEATURE_IBPB))
Loading