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.
Showing the changes to include/linux (1 of 4 files). Show all
Unified · Split
| @@ -264,6 +264,7 @@ int ftrace_modify_direct_caller(struct ftrace_func_entry *entry, · 263 unmodified lines | ||
| 264 | 264 | struct dyn_ftrace *rec, |
| 265 | 265 | unsigned long old_addr, |
| 266 | 266 | unsigned long new_addr); |
| 267 | +unsigned long ftrace_find_rec_direct(unsigned long ip); | |
| 267 | 268 | #else |
| 268 | 269 | # define ftrace_direct_func_count 0 |
| 269 | 270 | 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 | ||
| 290 | 291 | { |
| 291 | 292 | return -ENODEV; |
| 292 | 293 | } |
| 294 | +static inline unsigned long ftrace_find_rec_direct(unsigned long ip) | |
| 295 | +{ | |
| 296 | + return 0; | |
| 297 | +} | |
| 293 | 298 | #endif /* CONFIG_DYNAMIC_FTRACE_WITH_DIRECT_CALLS */ |
| 294 | 299 | |
| 295 | 300 | #ifndef CONFIG_HAVE_DYNAMIC_FTRACE_WITH_DIRECT_CALLS |