History

ftrace: Fix function_graph tracer interaction with BPF trampoline

Depending on type of BPF programs served by BPF trampoline it can call original function. In such case the trampoline will skip one stack frame while returning. That will confuse function_graph tracer and will cause crashes with bad RIP. Teach graph tracer to skip functions that have BPF trampoline attached.

Alexei Starovoitov committed 6 years ago

Commit ff205761 parent a61f8104 files · +21 −26Browse files

Showing the changes to include/linux (1 of 4 files). Show all

Unified · Split

include/linux/ftrace.h+5−0
@@ -264,6 +264,7 @@ int ftrace_modify_direct_caller(struct ftrace_func_entry *entry, · 263 unmodified lines
264264 struct dyn_ftrace *rec,
265265 unsigned long old_addr,
266266 unsigned long new_addr);
267+unsigned long ftrace_find_rec_direct(unsigned long ip);
267268 #else
268269 # define ftrace_direct_func_count 0
269270 static inline int register_ftrace_direct(unsigned long ip, unsigned long addr)
@@ -290,6 +291,10 @@ static inline int ftrace_modify_direct_caller(struct ftrace_func_entry *entry, · 20 unmodified lines
290291 {
291292 return -ENODEV;
292293 }
294+static inline unsigned long ftrace_find_rec_direct(unsigned long ip)
295+{
296+ return 0;
297+}
293298 #endif /* CONFIG_DYNAMIC_FTRACE_WITH_DIRECT_CALLS */
294299
295300 #ifndef CONFIG_HAVE_DYNAMIC_FTRACE_WITH_DIRECT_CALLS

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t