]> git.baikalelectronics.ru Git - kernel.git/commit
ftrace: Do not let direct or IPMODIFY ftrace_ops be added to module and set trampolines
authorChengming Zhou <zhouchengming@bytedance.com>
Tue, 28 Jul 2020 18:05:54 +0000 (02:05 +0800)
committerSteven Rostedt (VMware) <rostedt@goodmis.org>
Fri, 31 Jul 2020 02:45:31 +0000 (22:45 -0400)
commit44fa3f16dc7f18a28bd13843fadb72e7f27bf4ca
treedda7c7bcb4e8c08e54f9d9864e31116c843f5676
parentf23a1d119264ac1eaf619998238d61f5ad127930
ftrace: Do not let direct or IPMODIFY ftrace_ops be added to module and set trampolines

When inserting a module, we find all ftrace_ops referencing it on the
ftrace_ops_list. But FTRACE_OPS_FL_DIRECT and FTRACE_OPS_FL_IPMODIFY
flags are special, and should not be set automatically. So warn and
skip ftrace_ops that have these two flags set and adding new code.
Also check if only one ftrace_ops references the module, in which case
we can use a trampoline as an optimization.

Link: https://lkml.kernel.org/r/20200728180554.65203-2-zhouchengming@bytedance.com
Signed-off-by: Chengming Zhou <zhouchengming@bytedance.com>
Signed-off-by: Muchun Song <songmuchun@bytedance.com>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
kernel/trace/ftrace.c