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:	Thu, 14 Apr 2011 13:22:20 -0700
From:	Andrew Morton <akpm@...ux-foundation.org>
To:	Dave Hansen <dave@...1.net>
Cc:	Rusty Russell <rusty@...tcorp.com.au>,
	Jan Beulich <JBeulich@...ell.com>,
	Christoph Lameter <cl@...ux.com>,
	linux-mm <linux-mm@...ck.org>,
	lkml <linux-kernel@...r.kernel.org>
Subject: Re: BUILD_BUG_ON() breaks sparse gfp_t checks

On Thu, 14 Apr 2011 08:41:35 -0700
Dave Hansen <dave@...1.net> wrote:

> Running sparse on page_alloc.c today, it errors out:
>         
>         mm/page_alloc.c:96:5: warning: symbol 'percpu_pagelist_fraction' was not declared. Should it be static?
>         mm/page_alloc.c:175:5: warning: symbol 'min_free_kbytes' was not declared. Should it be static?
>         include/linux/gfp.h:254:17: error: bad constant expression
>         include/linux/gfp.h:254:17: error: cannot size expression
> 
> which is a line in gfp_zone():
> 
> 	BUILD_BUG_ON((GFP_ZONE_BAD >> bit) & 1);
> 
> That's really unfortunate, because it ends up hiding all of the other
> legitimate sparse messages (like I introduced with the appended patch):
> 
>         mm/page_alloc.c:96:5: warning: symbol 'percpu_pagelist_fraction' was not declared. Should it be static?
>         mm/page_alloc.c:175:5: warning: symbol 'min_free_kbytes' was not declared. Should it be static?
>         mm/page_alloc.c:3692:15: warning: symbol '__early_pfn_to_nid' was not declared. Should it be static?
>         mm/page_alloc.c:5315:59: warning: incorrect type in argument 1 (different base types)
>         mm/page_alloc.c:5315:59:    expected unsigned long [unsigned] [usertype] size
>         mm/page_alloc.c:5315:59:    got restricted gfp_t [usertype] <noident>
> ...
> 
> Is sparse broken, or is that ?  Even if it is, should we be working
> around this somehow?  It looks like we've basically crippled sparse in
> some spots.

Is sparse having conniptions over that monster expression for
GFP_ZONE_BAD?

The kernel calls gfp_zone() with a constant arg in very few places. 
This?

--- a/include/linux/gfp.h~a
+++ a/include/linux/gfp.h
@@ -249,14 +249,9 @@ static inline enum zone_type gfp_zone(gf
 
 	z = (GFP_ZONE_TABLE >> (bit * ZONES_SHIFT)) &
 					 ((1 << ZONES_SHIFT) - 1);
-
-	if (__builtin_constant_p(bit))
-		BUILD_BUG_ON((GFP_ZONE_BAD >> bit) & 1);
-	else {
 #ifdef CONFIG_DEBUG_VM
-		BUG_ON((GFP_ZONE_BAD >> bit) & 1);
+	BUG_ON((GFP_ZONE_BAD >> bit) & 1);
 #endif
-	}
 	return z;
 }
 
_

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