Skip to content

Commit

Permalink
arm64: ftrace: use function_nocfi for ftrace_call
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Sami Tolvanen <[email protected]>
Acked-by: Mark Rutland <[email protected]>
Tested-by: Nathan Chancellor <[email protected]>
Signed-off-by: Kees Cook <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
  • Loading branch information
samitolvanen authored and kees committed Apr 8, 2021
1 parent 9562f3d commit 800618f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion arch/arm64/kernel/ftrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ int ftrace_update_ftrace_func(ftrace_func_t func)
unsigned long pc;
u32 new;

pc = (unsigned long)&ftrace_call;
pc = (unsigned long)function_nocfi(ftrace_call);
new = aarch64_insn_gen_branch_imm(pc, (unsigned long)func,
AARCH64_INSN_BRANCH_LINK);

Expand Down

0 comments on commit 800618f

Please sign in to comment.