Commit b17c2baa authored by Peter Zijlstra's avatar Peter Zijlstra Committed by Borislav Petkov
Browse files

x86: Prepare inline-asm for straight-line-speculation



Replace all ret/retq instructions with ASM_RET in preparation of
making it more than a single instruction.

Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
Link: https://lore.kernel.org/r/20211204134907.964635458@infradead.org
parent f94909ce
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -18,6 +18,10 @@
#define __ALIGN_STR	__stringify(__ALIGN)
#endif

#else /* __ASSEMBLY__ */

#define ASM_RET	"ret\n\t"

#endif /* __ASSEMBLY__ */

#endif /* _ASM_X86_LINKAGE_H */
+1 −1
Original line number Diff line number Diff line
@@ -671,7 +671,7 @@ bool __raw_callee_save___native_vcpu_is_preempted(long cpu);
	    "call " #func ";"						\
	    PV_RESTORE_ALL_CALLER_REGS					\
	    FRAME_END							\
	    "ret;"							\
	    ASM_RET							\
	    ".size " PV_THUNK_NAME(func) ", .-" PV_THUNK_NAME(func) ";"	\
	    ".popsection")

+2 −2
Original line number Diff line number Diff line
@@ -48,7 +48,7 @@ asm (".pushsection .text;"
	"jne   .slowpath;"
	"pop   %rdx;"
	FRAME_END
	"ret;"
	ASM_RET
	".slowpath: "
	"push   %rsi;"
	"movzbl %al,%esi;"
@@ -56,7 +56,7 @@ asm (".pushsection .text;"
	"pop    %rsi;"
	"pop    %rdx;"
	FRAME_END
	"ret;"
	ASM_RET
	".size " PV_UNLOCK ", .-" PV_UNLOCK ";"
	".popsection");

+1 −1
Original line number Diff line number Diff line
@@ -714,7 +714,7 @@ asm (
"	.type		int3_magic, @function\n"
"int3_magic:\n"
"	movl	$1, (%" _ASM_ARG1 ")\n"
"	ret\n"
	ASM_RET
"	.size		int3_magic, .-int3_magic\n"
"	.popsection\n"
);
+1 −1
Original line number Diff line number Diff line
@@ -1051,7 +1051,7 @@ asm(
	"	addl $4, %esp\n"
	"	popfl\n"
#endif
	"	ret\n"
	ASM_RET
	".size __kretprobe_trampoline, .-__kretprobe_trampoline\n"
);
NOKPROBE_SYMBOL(__kretprobe_trampoline);
Loading