Skip to content

Commit eeb9f34

Browse files
jpoimboebp3tk0v
authored andcommitted
x86/srso: Fix unret validation dependencies
CONFIG_CPU_SRSO isn't dependent on CONFIG_CPU_UNRET_ENTRY (AMD Retbleed), so the two features are independently configurable. Fix several issues for the (presumably rare) case where CONFIG_CPU_SRSO is enabled but CONFIG_CPU_UNRET_ENTRY isn't. Fixes: fb3bd91 ("x86/srso: Add a Speculative RAS Overflow mitigation") Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org> Signed-off-by: Ingo Molnar <mingo@kernel.org> Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de> Acked-by: Borislav Petkov (AMD) <bp@alien8.de> Link: https://lore.kernel.org/r/299fb7740174d0f2335e91c58af0e9c242b4bac1.1693889988.git.jpoimboe@kernel.org
1 parent dc6306a commit eeb9f34

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@
271271
.Lskip_rsb_\@:
272272
.endm
273273

274-
#ifdef CONFIG_CPU_UNRET_ENTRY
274+
#if defined(CONFIG_CPU_UNRET_ENTRY) || defined(CONFIG_CPU_SRSO)
275275
#define CALL_UNTRAIN_RET "call entry_untrain_ret"
276276
#else
277277
#define CALL_UNTRAIN_RET ""
@@ -312,7 +312,7 @@
312312

313313
.macro UNTRAIN_RET_FROM_CALL
314314
#if defined(CONFIG_CPU_UNRET_ENTRY) || defined(CONFIG_CPU_IBPB_ENTRY) || \
315-
defined(CONFIG_CALL_DEPTH_TRACKING)
315+
defined(CONFIG_CALL_DEPTH_TRACKING) || defined(CONFIG_CPU_SRSO)
316316
VALIDATE_UNRET_END
317317
ALTERNATIVE_3 "", \
318318
CALL_UNTRAIN_RET, X86_FEATURE_UNRET, \

include/linux/objtool.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,8 @@
130130
* it will be ignored.
131131
*/
132132
.macro VALIDATE_UNRET_BEGIN
133-
#if defined(CONFIG_NOINSTR_VALIDATION) && defined(CONFIG_CPU_UNRET_ENTRY)
133+
#if defined(CONFIG_NOINSTR_VALIDATION) && \
134+
(defined(CONFIG_CPU_UNRET_ENTRY) || defined(CONFIG_CPU_SRSO))
134135
.Lhere_\@:
135136
.pushsection .discard.validate_unret
136137
.long .Lhere_\@ - .

scripts/Makefile.vmlinux_o

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ objtool-enabled := $(or $(delay-objtool),$(CONFIG_NOINSTR_VALIDATION))
3737

3838
vmlinux-objtool-args-$(delay-objtool) += $(objtool-args-y)
3939
vmlinux-objtool-args-$(CONFIG_GCOV_KERNEL) += --no-unreachable
40-
vmlinux-objtool-args-$(CONFIG_NOINSTR_VALIDATION) += --noinstr $(if $(CONFIG_CPU_UNRET_ENTRY), --unret)
40+
vmlinux-objtool-args-$(CONFIG_NOINSTR_VALIDATION) += --noinstr \
41+
$(if $(or $(CONFIG_CPU_UNRET_ENTRY),$(CONFIG_CPU_SRSO)), --unret)
4142

4243
objtool-args = $(vmlinux-objtool-args-y) --link
4344

0 commit comments

Comments
 (0)