lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 6 Nov 2019 20:50:58 +0000
From:   Dmitry Safonov <dima@...sta.com>
To:     Max Filippov <jcmvbkbc@...il.com>, linux-xtensa@...ux-xtensa.org
Cc:     Chris Zankel <chris@...kel.net>, linux-kernel@...r.kernel.org,
        Petr Mladek <pmladek@...e.com>
Subject: Re: [PATCH] xtensa: improve stack dumping

Hi Max,

On 11/6/19 6:16 PM, Max Filippov wrote:
> Collect whole stack dump lines in a buffer and print the whole buffer
> when it's ready with pr_info instead of pr_cont. This makes stack dump
> lines consistent in SMP case and relies less on pr_cont/printk
> differences related to timestamps.
> Make size of stack dump configurable.
> Drop extra newline output in show_trace as its output format does not
> depend on CONFIG_KALLSYMS.
> 
> Signed-off-by: Max Filippov <jcmvbkbc@...il.com>

[..]

>  void show_stack(struct task_struct *task, unsigned long *sp)
>  {
>  	int i = 0;
>  	unsigned long *stack;
> +	char buf[9 * 8 + 1];
>  
>  	if (!sp)
>  		sp = stack_pointer(task);
> @@ -512,10 +510,12 @@ void show_stack(struct task_struct *task, unsigned long *sp)
>  	for (i = 0; i < kstack_depth_to_print; i++) {
>  		if (kstack_end(sp))
>  			break;
> -		pr_cont(" %08lx", *sp++);
> +		sprintf(buf + (i % 8) * 9, " %08lx", *sp++);

buf is on the stack, does sprintf() put null-terminator for hex?

>  		if (i % 8 == 7)
> -			pr_cont("\n");
> +			pr_info("%s\n", buf);
>  	}
> +	if (i % 8)
> +		pr_info("%s\n", buf);

If the stack trace ends with (i % 8 == 7), you'll double-print the last
line?

Thanks,
          Dmitry

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ