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, 06 Jan 2010 13:23:13 -0800
From:	Roland Dreier <rdreier@...co.com>
To:	Andrew Morton <akpm@...ux-foundation.org>
Cc:	linux-kernel@...r.kernel.org,
	Bart Van Assche <bart.vanassche@...il.com>,
	David Dillow <dave@...dillows.org>
Subject: Re: [PATCH] log2.h: Macro-ize is_power_of_2() for use in BUILD_BUG_ON


 > We've had recurring struggles with various versions of gcc screwing up
 > constructs of this form and trying to emit the non-constant code when
 > the arg was clearly a compile-time constant.  One episode which comes
 > to mind was when we made changes to kmalloc().
 > 
 > Of course, that might not bite us in this case - it would need a lot of
 > coverage testing to find out.

Actually, after thinking about this a bit more I don't think this is
much of a risk in this case.  The bad case is where gcc gets the wrong
answer for __builtin_constant_p(), and in that case, we're left with the
status quo ante, ie a call to the original inline function implementation.

This will break a call to BUILD_BUG_ON() but that's visible at compile
time.  It's hard to think of a silent failure case that actually hurts
anything -- the macro and inline implementation are identical, except
that the macro implementation will work when gcc really needs a compile
time constant.

 - R.
--
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