OSDN Git Service

x86/ibt,ftrace: Search for __fentry__ location
authorPeter Zijlstra <peterz@infradead.org>
Tue, 8 Mar 2022 15:30:29 +0000 (16:30 +0100)
committerPeter Zijlstra <peterz@infradead.org>
Tue, 15 Mar 2022 09:32:37 +0000 (10:32 +0100)
commitaebfd12521d9c7d0b502cf6d06314cfbcdccfe3b
tree32b122cd707b1a26aef2d1ac5612f013ee2821e4
parent6649fa876da4c505548b8e8945a6fc48e62e427c
x86/ibt,ftrace: Search for __fentry__ location

Currently a lot of ftrace code assumes __fentry__ is at sym+0. However
with Intel IBT enabled the first instruction of a function will most
likely be ENDBR.

Change ftrace_location() to not only return the __fentry__ location
when called for the __fentry__ location, but also when called for the
sym+0 location.

Then audit/update all callsites of this function to consistently use
these new semantics.

Suggested-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Acked-by: Masami Hiramatsu <mhiramat@kernel.org>
Acked-by: Josh Poimboeuf <jpoimboe@redhat.com>
Link: https://lore.kernel.org/r/20220308154318.227581603@infradead.org
arch/x86/kernel/kprobes/core.c
kernel/bpf/trampoline.c
kernel/kprobes.c
kernel/trace/ftrace.c