tracing: Use linker magic instead of recasting ftrace_ops_list_func()
authorSteven Rostedt (VMware) <rostedt@goodmis.org>
Wed, 17 Jun 2020 20:56:16 +0000 (16:56 -0400)
committerSteven Rostedt (VMware) <rostedt@goodmis.org>
Wed, 20 Oct 2021 00:33:12 +0000 (20:33 -0400)
commit34cdd18b8d245f3e901e5325313c27de727ab80d
tree4ed5ee40076e2018161e568a980cd3885636b39c
parentaffc659246293df42ba2d184c674cc959c05aa02
tracing: Use linker magic instead of recasting ftrace_ops_list_func()

In an effort to enable -Wcast-function-type in the top-level Makefile to
support Control Flow Integrity builds, all function casts need to be
removed.

This means that ftrace_ops_list_func() can no longer be defined as
ftrace_ops_no_ops(). The reason for ftrace_ops_no_ops() is to use that when
an architecture calls ftrace_ops_list_func() with only two parameters
(called from assembly). And to make sure there's no C side-effects, those
archs call ftrace_ops_no_ops() which only has two parameters, as
ftrace_ops_list_func() has four parameters.

Instead of a typecast, use vmlinux.lds.h to define ftrace_ops_list_func() to
arch_ftrace_ops_list_func() that will define the proper set of parameters.

Link: https://lore.kernel.org/r/20200614070154.6039-1-oscar.carter@gmx.com
Link: https://lkml.kernel.org/r/20200617165616.52241bde@oasis.local.home
Link: https://lore.kernel.org/all/20211005053922.GA702049@embeddedor/
Requested-by: Oscar Carter <oscar.carter@gmx.com>
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
include/asm-generic/vmlinux.lds.h
include/linux/ftrace.h
kernel/trace/ftrace.c