[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2a6c133d-a42e-34ca-108c-b1399b939d65@virtuozzo.com>
Date: Wed, 9 Nov 2016 19:10:34 +0300
From: Andrey Ryabinin <aryabinin@...tuozzo.com>
To: Andrey Konovalov <andreyknvl@...gle.com>,
Alexander Potapenko <glider@...gle.com>,
Dmitry Vyukov <dvyukov@...gle.com>,
<kasan-dev@...glegroups.com>, <linux-mm@...ck.org>,
<linux-kernel@...r.kernel.org>, <mingo@...hat.com>
CC: <kcc@...gle.com>
Subject: Re: [PATCH 1/2] stacktrace: fix print_stack_trace printing timestamp
twice
On 11/08/2016 10:37 PM, Andrey Konovalov wrote:
> 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@...gle.com>
Right, since commit 4bcc595ccd80 ("printk: reinstate KERN_CONT for printing continuation lines")
printk requires KERN_CONT to continue log messages, and print_ip_sym() doesn't have it.
After a small nit bellow fixed:
Acked-by: Andrey Ryabinin <aryabinin@...tuozzo.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;
This can be inside for loop.
>
> 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);
>
Powered by blists - more mailing lists