Skip to content

Commit 800618f

Browse files
samitolvanenkees
authored andcommitted
arm64: ftrace: use function_nocfi for ftrace_call
With CONFIG_CFI_CLANG, the compiler replaces function pointers with jump table addresses, which breaks dynamic ftrace as the address of ftrace_call is replaced with the address of ftrace_call.cfi_jt. Use function_nocfi() to get the address of the actual function instead. Suggested-by: Ben Dai <ben.dai@unisoc.com> Signed-off-by: Sami Tolvanen <samitolvanen@google.com> Acked-by: Mark Rutland <mark.rutland@arm.com> Tested-by: Nathan Chancellor <nathan@kernel.org> Signed-off-by: Kees Cook <keescook@chromium.org> Link: https://lore.kernel.org/r/20210408182843.1754385-17-samitolvanen@google.com
1 parent 9562f3d commit 800618f

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

arch/arm64/kernel/ftrace.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ int ftrace_update_ftrace_func(ftrace_func_t func)
5555
unsigned long pc;
5656
u32 new;
5757

58-
pc = (unsigned long)&ftrace_call;
58+
pc = (unsigned long)function_nocfi(ftrace_call);
5959
new = aarch64_insn_gen_branch_imm(pc, (unsigned long)func,
6060
AARCH64_INSN_BRANCH_LINK);
6161

0 commit comments

Comments
 (0)