History

ftrace: Protect direct_functions in ftrace_find_rec_direct

Fix accessing the __rcu pointer direct_functions with RCU protection.

Leon Hwang committed 3 months ago

Commit 63444b71 parent f0ece161 file · +2 −1Browse files

Unified · Split

kernel/trace/ftrace.c+2−1
@@ -2645,7 +2645,8 @@ unsigned long ftrace_find_rec_direct(unsigned long ip) · 2644 unmodified lines
26452645 {
26462646 struct ftrace_func_entry *entry;
26472647
2648− entry = __ftrace_lookup_ip(direct_functions, ip);
2648+ guard(preempt_notrace)();
2649+ entry = __ftrace_lookup_ip(rcu_dereference_sched(direct_functions), ip);
26492650 if (!entry)
26502651 return 0;
26512652