Kernel Panic when stressing ftrace function_profiler https://bugzilla.redhat.com/show_bug.cgi?id=500156 This patch does not fix the whole issue but removes a few probable spots where the panic could originate from. [root@void ~]# while true > do echo "starting new test..." > ./function_profiler.sh sleep 2 > /dev/null > dmesg -c > ./function_profiler.sh ls -la > /dev/null > dmesg -c; > done starting new test... starting new test... ... Kernel panic - not syncing: Fatal exception Signed-off-by: Luis Claudio R. Goncalves <lgoncalv@xxxxxxxxxx> --- diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c index 8509861..3228291 100644 --- a/kernel/trace/ftrace.c +++ b/kernel/trace/ftrace.c @@ -372,7 +372,8 @@ static int function_stat_show(struct seq_file *m, void *v) #ifdef CONFIG_FUNCTION_GRAPH_TRACER seq_printf(m, " "); avg = rec->time; - do_div(avg, rec->counter); + if (rec->counter) + do_div(avg, rec->counter); mutex_lock(&mutex); trace_seq_init(&s); diff --git a/kernel/trace/trace_functions_graph.c b/kernel/trace/trace_functions_graph.c index 10f6ad7..e352d82 100644 --- a/kernel/trace/trace_functions_graph.c +++ b/kernel/trace/trace_functions_graph.c @@ -436,7 +436,7 @@ trace_print_graph_duration(unsigned long long duration, struct trace_seq *s) int ret, len; int i; - sprintf(msecs_str, "%lu", (unsigned long) duration); + snprintf(msecs_str, sizeof(msecs_str), "%lu", (unsigned long) duration); /* Print msecs */ ret = trace_seq_printf(s, "%s", msecs_str); -- [ Luis Claudio R. Goncalves Bass - Gospel - RT ] [ Fingerprint: 4FDD B8C4 3C59 34BD 8BE9 2696 7203 D980 A448 C8F8 ] -- To unsubscribe from this list: send the line "unsubscribe linux-rt-users" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html