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
264 struct dyn_ftrace *rec,264 struct dyn_ftrace *rec,
265 unsigned long old_addr,265 unsigned long old_addr,
266 unsigned long new_addr);266 unsigned long new_addr);
267unsigned long ftrace_find_rec_direct(unsigned long ip);
267#else268#else
268# define ftrace_direct_func_count 0269# define ftrace_direct_func_count 0
269static inline int register_ftrace_direct(unsigned long ip, unsigned long addr)270static 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
290{291{
291 return -ENODEV;292 return -ENODEV;
292}293}
294static inline unsigned long ftrace_find_rec_direct(unsigned long ip)
295{
296 return 0;
297}
293#endif /* CONFIG_DYNAMIC_FTRACE_WITH_DIRECT_CALLS */298#endif /* CONFIG_DYNAMIC_FTRACE_WITH_DIRECT_CALLS */
294 299
295#ifndef CONFIG_HAVE_DYNAMIC_FTRACE_WITH_DIRECT_CALLS300#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