Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1517519

[PATCH 1/2] stacktrace: fix print_stack_trace printing timestamp twice

From Andrey Konovalov <andreyknvl@google.com>
Newsgroups linux.kernel
Subject [PATCH 1/2] stacktrace: fix print_stack_trace printing timestamp twice
Date 2016-11-08 20:40 +0100
Message-ID <sBkps-5em-45@gated-at.bofh.it> (permalink)
References <sBkpr-5em-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Right now print_stack_trace prints timestamp twice, the first time
it's done by printk when printing spaces, the second - by print_ip_sym.
As a result, stack traces in KASAN reports have double timestamps:
[   18.822232] Allocated by task 3838:
[   18.822232]  [   18.822232] [<ffffffff8107e236>] save_stack_trace+0x16/0x20
[   18.822232]  [   18.822232] [<ffffffff81509bd6>] save_stack+0x46/0xd0
[   18.822232]  [   18.822232] [<ffffffff81509e4b>] kasan_kmalloc+0xab/0xe0
....

Fix by calling printk only once.

Signed-off-by: Andrey Konovalov <andreyknvl@google.com>
---
 kernel/stacktrace.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/kernel/stacktrace.c b/kernel/stacktrace.c
index b6e4c16..56f510f 100644
--- a/kernel/stacktrace.c
+++ b/kernel/stacktrace.c
@@ -14,13 +14,15 @@
 void print_stack_trace(struct stack_trace *trace, int spaces)
 {
 	int i;
+	unsigned long ip;
 
 	if (WARN_ON(!trace->entries))
 		return;
 
 	for (i = 0; i < trace->nr_entries; i++) {
-		printk("%*c", 1 + spaces, ' ');
-		print_ip_sym(trace->entries[i]);
+		ip = trace->entries[i];
+		printk("%*c[<%p>] %pS\n", 1 + spaces, ' ',
+				(void *) ip, (void *) ip);
 	}
 }
 EXPORT_SYMBOL_GPL(print_stack_trace);
-- 
2.8.0.rc3.226.g39d4020

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH 0/2] kasan,stacktrace: improve error reports Andrey Konovalov <andreyknvl@google.com> - 2016-11-08 20:40 +0100
  [PATCH 1/2] stacktrace: fix print_stack_trace printing timestamp twice Andrey Konovalov <andreyknvl@google.com> - 2016-11-08 20:40 +0100

csiph-web