ftrace: Fix regression with module command in stack_trace_filter
PATCH 1/1 ftrace: Fix regression with module command in stack_trace_filter
When executing the following command:
# echo "write*:mod:ext3" > /sys/kernel/tracing/stack_trace_filter
The current mod command causes a null pointer dereference. While commit 0f17976568b3f ("ftrace: Fix regression with module command in stack_trace_filter") has addressed part of the issue, it left a corner case unhandled, which still results in a kernel crash.
Signed-off-by guoweikang <[email protected]>
--- kernel/trace/ftrace.c | 3 +++ 1 file changed, 3 insertions(+)
kernel/trace/ftrace.c +3 -0
@@ -5093,6 +5093,9 @@ ftrace_mod_callback(struct trace_array *tr, struct ftrace_hash *hash,char *func;int ret; +if (!tr) +return -ENODEV ; +/* match_records() modifies func, and we need the original */ func =kstrdup (func_orig,GFP_KERNEL );if (!func)
Signature · 1 line
2.25.1
Steven Rostedt
maintainerQuoted 8 lines · On Wed, 20 Nov 2024 13:27:49 +0800 guoweikang <[email protected]>…
When executing the following command:
# echo "write*:mod:ext3" > /sys/kernel/tracing/stack_trace_filterThe current mod command causes a null pointer dereference. While commit
0f17976568b3f("ftrace: Fix regression with module command instack_trace_filter") has addressed part of the issue, it left a corner case unhandled, which still results in a kernel crash.
Ouch!
Thanks, I'll also mark this as stable.
-- Steve
Quoted 20 lines
Signed-off-by guoweikang <[email protected]>--- kernel/trace/ftrace.c | 3 +++ 1 file changed, 3 insertions(+)kernel/trace/ftrace.c +3
-0@@ -5093,6 +5093,9 @@ ftrace_mod_callback(struct trace_array *tr, struct ftrace_hash *hash,char *func;int ret; +if (!tr) +return -ENODEV ; +/* match_records() modifies func, and we need the original */ func =kstrdup (func_orig,GFP_KERNEL );if (!func)