]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
ftrace: Fix address for jmp mode in t_show()
authorMenglong Dong <menglong8.dong@gmail.com>
Wed, 17 Dec 2025 03:00:53 +0000 (11:00 +0800)
committerSteven Rostedt (Google) <rostedt@goodmis.org>
Wed, 17 Dec 2025 22:53:59 +0000 (17:53 -0500)
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().

Link: https://patch.msgid.link/20251217030053.80343-1-dongml2@chinatelecom.cn
Fixes: 25e4e3565d45 ("ftrace: Introduce FTRACE_OPS_FL_JMP")
Signed-off-by: Menglong Dong <dongml2@chinatelecom.cn>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
kernel/trace/ftrace.c

index 3ec2033c077436445c01a25d75d360fa69573496..ef2d5dca6f70c6a3c34e2490bb5821c1e2e97748 100644 (file)
@@ -4518,8 +4518,11 @@ 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, "\n\tdirect%s-->%pS",
+                                          ftrace_is_jmp(direct) ? "(jmp)" : "",
+                                          (void *)ftrace_jmp_get(direct));
+                       }
                }
        }