Przeglądaj źródła

ftrace: Fix output of enabled_functions for showing tramp

When showing all tramps registered to a ftrace record in the file
enabled_functions, it exits the loop with ops == NULL. But then it is
suppose to show the function on the ops->trampoline and
add_trampoline_func() is called with the given ops. But because ops is now
NULL (to exit the loop), it always shows the static trampoline instead of
the one that is really registered to the record.

The call to add_trampoline_func() that shows the trampoline for the given
ops needs to be called at every iteration.

Fixes: 39daa7b9e895 "ftrace: Show all tramps registered to a record on ftrace_bug()"
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Steven Rostedt (Red Hat) 9 lat temu
rodzic
commit
030f4e1cb8
1 zmienionych plików z 4 dodań i 3 usunięć
  1. 4 3
      kernel/trace/ftrace.c

+ 4 - 3
kernel/trace/ftrace.c

@@ -3322,7 +3322,7 @@ static int t_show(struct seq_file *m, void *v)
 
 
 	seq_printf(m, "%ps", (void *)rec->ip);
 	seq_printf(m, "%ps", (void *)rec->ip);
 	if (iter->flags & FTRACE_ITER_ENABLED) {
 	if (iter->flags & FTRACE_ITER_ENABLED) {
-		struct ftrace_ops *ops = NULL;
+		struct ftrace_ops *ops;
 
 
 		seq_printf(m, " (%ld)%s%s",
 		seq_printf(m, " (%ld)%s%s",
 			   ftrace_rec_count(rec),
 			   ftrace_rec_count(rec),
@@ -3335,13 +3335,14 @@ static int t_show(struct seq_file *m, void *v)
 					seq_printf(m, "\ttramp: %pS (%pS)",
 					seq_printf(m, "\ttramp: %pS (%pS)",
 						   (void *)ops->trampoline,
 						   (void *)ops->trampoline,
 						   (void *)ops->func);
 						   (void *)ops->func);
+					add_trampoline_func(m, ops, rec);
 					ops = ftrace_find_tramp_ops_next(rec, ops);
 					ops = ftrace_find_tramp_ops_next(rec, ops);
 				} while (ops);
 				} while (ops);
 			} else
 			} else
 				seq_puts(m, "\ttramp: ERROR!");
 				seq_puts(m, "\ttramp: ERROR!");
-
+		} else {
+			add_trampoline_func(m, NULL, rec);
 		}
 		}
-		add_trampoline_func(m, ops, rec);
 	}	
 	}	
 
 
 	seq_putc(m, '\n');
 	seq_putc(m, '\n');