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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20140512141642.5eb526deed5ea32ad5bced72@linux-foundation.org>
Date:	Mon, 12 May 2014 14:16:42 -0700
From:	Andrew Morton <akpm@...ux-foundation.org>
To:	James Hogan <james.hogan@...tec.com>
Cc:	Johannes Berg <johannes@...solutions.net>,
	<linux-kernel@...r.kernel.org>,
	Peter Zijlstra <peterz@...radead.org>,
	Daniel Santos <daniel.santos@...ox.com>,
	"Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>,
	linux-next <linux-next@...r.kernel.org>,
	linux-metag <linux-metag@...r.kernel.org>
Subject: Re: [PATCH] compiler.h: don't use temporary variable in
 __compiletime_assert()

On Mon, 12 May 2014 14:42:04 +0100 James Hogan <james.hogan@...tec.com> wrote:

> > --- a/include/linux/compiler.h
> > +++ b/include/linux/compiler.h
> > @@ -324,11 +324,10 @@ void ftrace_likely_update(struct ftrace_branch_data *f, int val, int expect);
> >  
> >  #define __compiletime_assert(condition, msg, prefix, suffix)		\
> >  	do {								\
> > -		bool __cond = !(condition);				\
> >  		extern void prefix ## suffix(void) __compiletime_error(msg); \
> > -		if (__cond)						\
> > +		if (!(condition))					\
> >  			prefix ## suffix();				\
> > -		__compiletime_error_fallback(__cond);			\
> > +		__compiletime_error_fallback(!(condition));		\
> >  	} while (0)
> >  
> >  #define _compiletime_assert(condition, msg, prefix, suffix) \
> > 
> 
> Unfortunately this breaks the build of today's linux-next for the Meta
> architecture (arch/metag), which happens to use a fairly old compiler
> (based on gcc 4.2.4) which I presume is the reason why.
> 
> A bunch of compile time asserts fail, even in code which should be
> optimised out. E.g. here's one which I analysed:
> 
> mm/gup.c: In function ___follow_page_mask___:
> mm/gup.c:208: error: size of array ___type name___ is negative
> 
> Line 208 uses HPAGE_PMD_NR which expands to a HPAGE_PMD_SHIFT, which
> expands to a BUILD_BUG(). However that line is inside an if block
> conditioned on pmd_trans_huge(*pmd) which include/asm-generic/pgtable.h
> defines inline to return 0, so the whole block should already be being
> optimised out.
> 
> I don't understand why your patch should break things, I suspect it's
> related to the sparse behaviour you're trying to work around, but can we
> please drop this patch until a more portable workaround can be found?

Older gcc's often have this problem.

I suppose that build bustage is more serious than sparse false
positives so yes, let's please try to find an alternative.

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