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: <1389116048.32137.14.camel@joe-AO722>
Date:	Tue, 07 Jan 2014 09:34:08 -0800
From:	Joe Perches <joe@...ches.com>
To:	Pavel Machek <pavel@....cz>
Cc:	Tetsuo Handa <penguin-kernel@...ove.SAKURA.ne.jp>,
	keescook@...omium.org, akpm@...ux-foundation.org,
	geert@...ux-m68k.org, jkosina@...e.cz, viro@...iv.linux.org.uk,
	davem@...emloft.net, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] lib/vsprintf: add %pT[C012] format specifier

On Tue, 2014-01-07 at 09:37 +0100, Pavel Machek wrote:
> On Mon 2014-01-06 17:03:55, Joe Perches wrote:
> > On Tue, 2014-01-07 at 01:16 +0100, Pavel Machek wrote:
> > > > > > > diff --git a/lib/vsprintf.c b/lib/vsprintf.c
> > > > > > []
> > > > > > > @@ -1232,7 +1248,7 @@ char *pointer(const char *fmt, char *buf, char *end, void *ptr,
> > > > > > >  {
> > > > > > >  	int default_width = 2 * sizeof(void *) + (spec.flags & SPECIAL ? 2 : 0);
> > > > > > >  
> > > > > > > -	if (!ptr && *fmt != 'K') {
> > > > > > > +	if (!ptr && *fmt != 'K' && *fmt != 'T') {
> > > > > > 
> > > > > > I think this new 'T' comparison isn't necessary.
> > > > > 
> > > > > This is needed for allowing comm_name() to accept NULL instead of current.
> > > > 
> > > > Yeah, that's what I think isn't necessary.
> > > > 
> > > > current is current_thread_info()->task.
> > > > 
> > > > I think it's pretty lightweight in all arches and
> > > > it'd be simpler/more intelligible to not use NULL.
> > > > 
> > > > Andrew?  Any opinion?  Anyone else?
> > > 
> > > Andrew was worried about all the "current" duplication, IIRC. It is in
> > > the mail thread somewhere. And one condition in printk is price worth paying.
> > 
> > Hi Pavel.
> > 
> > I'm not nacking this, just stating my view.
> 
> And I believe Andrew clearly stated his view, on the very topic you
> asked him on.

I believe Andrew's view:

On Sat, 2013-12-28 at 12:08 -0800, Andrew Morton wrote:
> On Sat, 28 Dec 2013 11:53:25 -0800 Joe Perches <joe@...ches.com> wrote:
> > Tell me again, what's wrong with using p or current?
> > printk("%pt", current);
> 
> Nothing much.  It's just that all these callsites are generating the
> code to pass an argument which the callee already has access to. 
> Optimizing that will reduce text size a bit.

was that the argument passing was the primary issue.

Now that that's not done, this code actually uses a
different concept, that "NULL" is special when using
%pT.  If the argument isn't eliminated all together,
I think that new concept should be avoided.

The additional cost of using current vs NULL is ~zero.


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ