public inbox for linux-trace-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ftrace: fix address for jmp mode in t_show
@ 2025-12-16  3:45 Menglong Dong
  2025-12-16 16:28 ` Steven Rostedt
  0 siblings, 1 reply; 3+ messages in thread
From: Menglong Dong @ 2025-12-16  3:45 UTC (permalink / raw)
  To: rostedt
  Cc: mhiramat, mark.rutland, mathieu.desnoyers, menglong8.dong, ast,
	jiang.biao, linux-kernel, linux-trace-kernel

The address from ftrace_find_rec_direct() is printed directly in t_show().
This can mislead symbol offsets if it has the "jmp" bit in the last bit.

Fix this by printing the address that returned by ftrace_jmp_get().

Fixes: 25e4e3565d45 ("ftrace: Introduce FTRACE_OPS_FL_JMP")
Signed-off-by: Menglong Dong <dongml2@chinatelecom.cn>
---
 kernel/trace/ftrace.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index bbb37c0f8c6c..d4c41fb76a25 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -4492,8 +4492,12 @@ static int t_show(struct seq_file *m, void *v)
 			unsigned long direct;
 
 			direct = ftrace_find_rec_direct(rec->ip);
-			if (direct)
-				seq_printf(m, "\n\tdirect-->%pS", (void *)direct);
+			if (direct) {
+				seq_printf(m, ftrace_is_jmp(direct) ?
+					      "\n\tdirect(jmp)-->%pS" :
+					      "\n\tdirect-->%pS",
+					   (void *)ftrace_jmp_get(direct));
+			}
 		}
 	}
 
-- 
2.52.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-12-17  1:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-16  3:45 [PATCH] ftrace: fix address for jmp mode in t_show Menglong Dong
2025-12-16 16:28 ` Steven Rostedt
2025-12-17  1:32   ` Menglong Dong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox