tracing: A few more updates to 6.3
Subsystems (3)
Steven Rostedt
maintainercover tracing: A few more updates to 6.3
Some more tracing fixes for 6.3:
- Reset direct->addr back to its original value on error in updating the direct trampoline code.
- Make lastcmd_mutex static.
git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace.git
trace/urgent
Head SHA1: 31c683967174b487939efaf65e41f5ff1404e141
Steven Rostedt (Google) (1):
tracing/synthetic: Make lastcmd_mutex static
Zheng Yejian (1):
ftrace: Fix issue that 'direct->addr' not restored in modify_ftrace_direct()
----
kernel/trace/ftrace.c | 15 +++++++++------ kernel/trace/trace_events_synth.c | 2 +- 2 files changed, 10 insertions(+), 7 deletions(-)
Steven Rostedt
maintainerPATCH 1/2 ftrace: Fix issue that direct->addr not restored in modify_ftrace_direct()
From: Zheng Yejian <[email protected]>
Syzkaller report a WARNING: "WARN_ON(!direct)" in modify_ftrace_direct().
Root cause is 'direct->addr' was changed from 'old_addr' to 'new_addr' but not restored if error happened on calling ftrace_modify_direct_caller(). Then it can no longer find 'direct' by that 'old_addr'.
To fix it, restore 'direct->addr' to 'old_addr' explicitly in error path.
--- kernel/trace/ftrace.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-)
kernel/trace/ftrace.c +9 -6
@@ -5667,12 +5667,15 @@ int modify_ftrace_direct(unsigned long ip, ret =0 ; } -if (unlikely (ret && new_direct)) { - direct->count++; -list_del_rcu (&new_direct->next); -synchronize_rcu_tasks (); -kfree (new_direct); - ftrace_direct_func_count--; +if (ret) { + direct->addr = old_addr; +if (unlikely (new_direct)) { + direct->count++; +list_del_rcu (&new_direct->next); +synchronize_rcu_tasks (); +kfree (new_direct); + ftrace_direct_func_count--; + } } out_unlock:
Signature · 1 line
2.39.2
Steven Rostedt
maintainerPATCH 2/2 tracing/synthetic: Make lastcmd_mutex static
In reply to Steven RostedtFrom: "Steven Rostedt (Google)" <[email protected]>
The lastcmd_mutex is only used in trace_events_synth.c and should be static.
--- kernel/trace/trace_events_synth.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/trace/trace_events_synth.c +1 -1
@@ -44,7 +44,7 @@ enum { ERRORS };static const char *err_text[] = {ERRORS }; -DEFINE_MUTEX (lastcmd_mutex); +static DEFINE_MUTEX (lastcmd_mutex);static char *last_cmd;static int errpos (const char *str)
Signature · 1 line
2.39.2