Skip to contentSkip to conversation

tracing: Cleanups for v6.10

GIT PULL Merged Steven Rostedt 2 participants 2 messages May 16, 2024 – May 18, 2024

Subsystems (2)
lore
Share & tools
lore

Steven Rostedt

author maintainer
#0 lore raw

Linus,

tracing cleanups for v6.10:

- Removed unused ftrace_direct_funcs variables

- Fix a possible NULL pointer dereference race in eventfs

- Update do_div() usage in trace event benchmark test

- Speedup direct function registration with asynchronous RCU callback. The synchronization was done in the registration code and this caused delays when registering direct callbacks. Move the freeing to a call_rcu() that will prevent delaying of the registering.

- Replace simple_strtoul() usage with kstrtoul()

Please pull the latest trace-v6.10 tree, which can be found at:

git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace.git
trace-v6.10

Tag SHA1: 7cb6620f9a48fbdda06bc070c3e6270a39edc76a Head SHA1: d4e9a968738bf66d3bb852dd5588d4c7afd6d7f4

Dr. David Alan Gilbert (2):
ftrace: Remove unused list 'ftrace_direct_funcs'
ftrace: Remove unused global 'ftrace_direct_func_count'

Hao Ge (1):
eventfs: Fix a possible null pointer dereference in eventfs_find_events()

Paul E. McKenney (1):
ftrace: Use asynchronous grace period for register_ftrace_direct()

Thorsten Blum (1):
tracing: Improve benchmark test performance by using do_div()

Yuran Pereira (1):
ftrace: Replaces simple_strtoul in ftrace

Zheng Yejian (1):
ftrace: Fix possible use-after-free issue in ftrace_location()

----

 fs/tracefs/event_inode.c       |  7 ++---
 include/linux/ftrace.h         |  3 --
 kernel/trace/fgraph.c          | 11 -------
 kernel/trace/ftrace.c          | 68 ++++++++++++++++++++++--------------------
 kernel/trace/trace_benchmark.c |  2 +-
 5 files changed, 39 insertions(+), 52 deletions(-)

---------------------------

fs/tracefs/event_inode.c +3 -4
index a878cea70f4c..0256afdd4acf 100644
@@ -345,10 +345,9 @@ static struct eventfs_inode *eventfs_find_events(struct dentry *dentry)
 		 * If the ei is being freed, the ownership of the children
 		 * doesn't matter.
 		 */
-		if (ei->is_freed) {
-			ei = NULL;
-			break;
-		}
+		if (ei->is_freed)
+			return NULL;
+
 		// Walk upwards until you find the events inode
 	} while (!ei->is_events);
 
include/linux/ftrace.h +0 -3
index 54d53f345d14..e3a83ebd1b33 100644
@@ -83,7 +83,6 @@ static inline void early_trace_init(void) { }
 
 struct module;
 struct ftrace_hash;
-struct ftrace_direct_func;
 
 #if defined(CONFIG_FUNCTION_TRACER) && defined(CONFIG_MODULES) && \
 	defined(CONFIG_DYNAMIC_FTRACE)
@@ -414,7 +413,6 @@ struct ftrace_func_entry {
 };
 
 #ifdef CONFIG_DYNAMIC_FTRACE_WITH_DIRECT_CALLS
-extern int ftrace_direct_func_count;
 unsigned long ftrace_find_rec_direct(unsigned long ip);
 int register_ftrace_direct(struct ftrace_ops *ops, unsigned long addr);
 int unregister_ftrace_direct(struct ftrace_ops *ops, unsigned long addr,
@@ -426,7 +424,6 @@ void ftrace_stub_direct_tramp(void);
 
 #else
 struct ftrace_ops;
-# define ftrace_direct_func_count 0
 static inline unsigned long ftrace_find_rec_direct(unsigned long ip)
 {
 	return 0;
kernel/trace/fgraph.c +0 -11
index c83c005e654e..a130b2d898f7 100644
@@ -125,17 +125,6 @@ int function_graph_enter(unsigned long ret, unsigned long func,
 {
 	struct ftrace_graph_ent trace;
 
-#ifndef CONFIG_HAVE_DYNAMIC_FTRACE_WITH_ARGS
-	/*
-	 * Skip graph tracing if the return location is served by direct trampoline,
-	 * since call sequence and return addresses are unpredictable anyway.
-	 * Ex: BPF trampoline may call original function and may skip frame
-	 * depending on type of BPF programs attached.
-	 */
-	if (ftrace_direct_func_count &&
-	    ftrace_find_rec_direct(ret - MCOUNT_INSN_SIZE))
-		return -EBUSY;
-#endif
 	trace.func = func;
 	trace.depth = ++current->curr_ret_depth;
 
kernel/trace/ftrace.c +35 -33

166 lines not on this page · raw message

kernel/trace/trace_benchmark.c +1 -1
index 811b08439406..e19c32f2a938 100644
@@ -104,7 +104,7 @@ static void trace_do_benchmark(void)
 		stddev = 0;
 
 	delta = bm_total;
-	delta = div64_u64(delta, bm_cnt);
+	do_div(delta, (u32)bm_cnt);
 	avg = delta;
 
 	if (stddev > 0) {
merge bot Merged
#1 lore raw
The pull request you sent on Thu, 16 May 2024 11:54:49 -0400:

The pull request you sent on Thu, 16 May 2024 11:54:49 -0400:

Quoted 1 line

git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace.git trace-v6.10

has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/594d28157f2d55c4f17f2e18c778da098446e594

Thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/prtracker.html