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: <20160629064348.GA12326@krava>
Date:	Wed, 29 Jun 2016 08:43:48 +0200
From:	Jiri Olsa <jolsa@...hat.com>
To:	Steven Rostedt <rostedt@...dmis.org>
Cc:	Rasmus Villemoes <linux@...musvillemoes.dk>,
	Jiri Olsa <jolsa@...nel.org>,
	lkml <linux-kernel@...r.kernel.org>,
	Frederic Weisbecker <fweisbec@...il.com>
Subject: Re: [RFC/PATCH] lib/vsprintf: Add support to store cpumask

On Tue, Jun 28, 2016 at 06:06:47PM -0400, Steven Rostedt wrote:
> On Tue, 28 Jun 2016 21:27:29 +0200
> Rasmus Villemoes <linux@...musvillemoes.dk> wrote:
> 
> > > I probably should make a trace_printk() that doesn't default to the
> > > binary print, to handle things like this.
> > >
> > >   trace_printk_ptr()?
> > >
> > > Or even just see if I can find a way that detects this in the fmt
> > > string. Hmm, that probably can't be done at compile time :-/  
> > 
> > Well, not with gcc itself, but it wouldn't be too hard to make smatch
> > complain loudly if trace_printk is used on a format string with any %p
> > extension (directing people to use trace_printk_ptr()) - the format
> > parsing (and type checking) is already there.
> 
> Well, actually gcc can (see below). Although, the more I think about
> this, the more I'm thinking that the bin_printk() should be default
> just copy the pointer content. As the whole point of bin_printk() is to
> print the content at another time. And since pointers should not be
> dereferenced later, it should be saved at the moment the bprintk() is
> called and not dereferenced later.
> 
> -- Steve
> 
> diff --git a/include/linux/kernel.h b/include/linux/kernel.h
> index 94aa10ffe156..62693900cc4b 100644
> --- a/include/linux/kernel.h
> +++ b/include/linux/kernel.h
> @@ -631,7 +631,24 @@ do {									\
>  									\
>  	__trace_printk_check_format(fmt, ##args);			\
>  									\
> -	if (__builtin_constant_p(fmt))					\
> +	if (__builtin_constant_p(fmt) &&				\
> +	    !__builtin_strstr(fmt, "%pF") &&				\
> +	    !__builtin_strstr(fmt, "%pf") &&				\
> +	    !__builtin_strstr(fmt, "%pR") &&				\
> +	    !__builtin_strstr(fmt, "%pr") &&				\
> +	    !__builtin_strstr(fmt, "%pb") &&				\
> +	    !__builtin_strstr(fmt, "%pM") &&				\
> +	    !__builtin_strstr(fmt, "%pI") &&				\
> +	    !__builtin_strstr(fmt, "%pE") &&				\
> +	    !__builtin_strstr(fmt, "%pU") &&				\
> +	    !__builtin_strstr(fmt, "%pV") &&				\
> +	    !__builtin_strstr(fmt, "%pN") &&				\
> +	    !__builtin_strstr(fmt, "%pa") &&				\
> +	    !__builtin_strstr(fmt, "%pd") &&				\
> +	    !__builtin_strstr(fmt, "%pC") &&				\
> +	    !__builtin_strstr(fmt, "%pD") &&				\
> +	    !__builtin_strstr(fmt, "%pg") &&				\
> +	    !__builtin_strstr(fmt, "%pG"))				\
>  		__trace_bprintk(_THIS_IP_, trace_printk_fmt, ##args);	\
>  	else								\
>  		__trace_printk(_THIS_IP_, fmt, ##args);			\

is this one working? it seems better to me than adding new trace_printk_ptr


jirka

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ