Commit 582077c9 authored by Peter Zijlstra's avatar Peter Zijlstra
Browse files

x86/cfi: Clean up linkage



With the introduction of kCFI the addition of ENDBR to
SYM_FUNC_START* no longer suffices to make the function indirectly
callable. This now requires the use of SYM_TYPED_FUNC_START.

As such, remove the implicit ENDBR from SYM_FUNC_START* and add some
explicit annotations to fix things up again.

Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: default avatarSami Tolvanen <samitolvanen@google.com>
Link: https://lore.kernel.org/r/20250207122546.409116003@infradead.org
parent 2981557c
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
 */

#include <linux/linkage.h>
#include <linux/objtool.h>
#include <asm/frame.h>

#define STATE1	%xmm0
@@ -1071,6 +1072,7 @@ SYM_FUNC_END(_aesni_inc)
 *		      size_t len, u8 *iv)
 */
SYM_FUNC_START(aesni_ctr_enc)
	ANNOTATE_NOENDBR
	FRAME_BEGIN
	cmp $16, LEN
	jb .Lctr_enc_just_ret
+1 −0
Original line number Diff line number Diff line
@@ -431,6 +431,7 @@ For 32-bit we have the following conventions - kernel is built with
/* rdi:	arg1 ... normal C conventions. rax is saved/restored. */
.macro THUNK name, func
SYM_FUNC_START(\name)
	ANNOTATE_NOENDBR
	pushq %rbp
	movq %rsp, %rbp

+2 −0
Original line number Diff line number Diff line
@@ -5,6 +5,7 @@

#include <linux/export.h>
#include <linux/linkage.h>
#include <linux/objtool.h>
#include <asm/msr-index.h>
#include <asm/unwind_hints.h>
#include <asm/segment.h>
@@ -17,6 +18,7 @@
.pushsection .noinstr.text, "ax"

SYM_FUNC_START(entry_ibpb)
	ANNOTATE_NOENDBR
	movl	$MSR_IA32_PRED_CMD, %ecx
	movl	$PRED_CMD_IBPB, %eax
	xorl	%edx, %edx
+3 −0
Original line number Diff line number Diff line
@@ -175,6 +175,7 @@ SYM_CODE_END(entry_SYSCALL_64)
 */
.pushsection .text, "ax"
SYM_FUNC_START(__switch_to_asm)
	ANNOTATE_NOENDBR
	/*
	 * Save callee-saved registers
	 * This must match the order in inactive_task_frame
@@ -742,6 +743,7 @@ _ASM_NOKPROBE(common_interrupt_return)
 * Is in entry.text as it shouldn't be instrumented.
 */
SYM_FUNC_START(asm_load_gs_index)
	ANNOTATE_NOENDBR
	FRAME_BEGIN
	swapgs
.Lgs_change:
@@ -1526,6 +1528,7 @@ SYM_CODE_END(rewind_stack_and_make_dead)
 * refactored in the future if needed.
 */
SYM_FUNC_START(clear_bhb_loop)
	ANNOTATE_NOENDBR
	push	%rbp
	mov	%rsp, %rbp
	movl	$5, %ecx
+1 −0
Original line number Diff line number Diff line
@@ -58,6 +58,7 @@ SYM_CODE_END(asm_fred_entrypoint_kernel)

#if IS_ENABLED(CONFIG_KVM_INTEL)
SYM_FUNC_START(asm_fred_entry_from_kvm)
	ANNOTATE_NOENDBR
	push %rbp
	mov %rsp, %rbp

Loading