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]
Message-ID: <20190806113352.334d81b9@gandalf.local.home>
Date:   Tue, 6 Aug 2019 11:33:52 -0400
From:   Steven Rostedt <rostedt@...dmis.org>
To:     Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Cc:     Ingo Molnar <mingo@...hat.com>, linux-kernel@...r.kernel.org,
        Rasmus Villemoes <linux@...musvillemoes.dk>
Subject: Re: [PATCH v2] tracing: Be more clever when dumping hex in
 __print_hex()

On Tue,  6 Aug 2019 18:15:43 +0300
Andy Shevchenko <andriy.shevchenko@...ux.intel.com> wrote:

> Hex dump as many as 16 bytes at once in trace_print_hex_seq()
> instead of byte-by-byte approach.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
> ---
> v2: fix length calculation, so, when buf_len=16 it won't indefinitely loop
>  kernel/trace/trace_output.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/kernel/trace/trace_output.c b/kernel/trace/trace_output.c
> index cab4a5398f1d..d54ce252b05a 100644
> --- a/kernel/trace/trace_output.c
> +++ b/kernel/trace/trace_output.c
> @@ -219,10 +219,10 @@ trace_print_hex_seq(struct trace_seq *p, const unsigned char *buf, int buf_len,
>  {
>  	int i;
>  	const char *ret = trace_seq_buffer_ptr(p);
> +	const char *fmt = concatenate ? "%*phN" : "%*ph";
>  
> -	for (i = 0; i < buf_len; i++)
> -		trace_seq_printf(p, "%s%2.2x", concatenate || i == 0 ? "" : " ",
> -				 buf[i]);
> +	for (i = 0; i < buf_len; i += 16)
> +		trace_seq_printf(p, fmt, min(buf_len - i, 16), &buf[i]);

Cute.

I'll have to wrap my head around it a bit to make sure it's correct.

Thanks for sending this.

-- Steve

>  	trace_seq_putc(p, 0);
>  
>  	return ret;

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ