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: <1366672518.9609.142.camel@gandalf.local.home>
Date:	Mon, 22 Apr 2013 19:15:18 -0400
From:	Steven Rostedt <rostedt@...dmis.org>
To:	Andrew Morton <akpm@...ux-foundation.org>
Cc:	David Rientjes <rientjes@...gle.com>,
	Pekka Enberg <penberg@...nel.org>,
	LKML <linux-kernel@...r.kernel.org>, linux-mm@...ck.org,
	Christoph Lameter <cl@...ux.com>,
	Behan Webster <behanw@...verseincode.com>
Subject: Re: [PATCH] slab: Remove unnecessary __builtin_constant_p()

On Mon, 2013-04-22 at 14:16 -0700, Andrew Morton wrote:
> On Mon, 22 Apr 2013 16:58:21 -0400 Steven Rostedt <rostedt@...dmis.org> wrote:

> > When looking into this, we found the only two users of the index_of()
> > static function that has this issue, passes in size_of(), which will
> > always be a constant, making the check redundant.
> 
> Looking at the current callers is cheating.  What happens if someone
> adds another caller which doesn't use sizeof?

Well, as it required a size of something, if it was dynamic then what
would the size be of?

> 
> > Note, this is a bug in Clang that will hopefully be fixed soon. But for
> > now, this strange redundant compile time check is preventing Clang from
> > even testing the Linux kernel build.
> > </little birdie voice>
> > 
> > And I still think the original change log has rational for the change,
> > as it does make it rather confusing to what is happening there.
> 
> The patch made index_of() weaker!
> 
> It's probably all a bit academic, given that linux-next does
> 
> -/*
> - * This function must be completely optimized away if a constant is passed to
> - * it.  Mostly the same as what is in linux/slab.h except it returns an index.
> - */
> -static __always_inline int index_of(const size_t size)
> -{
> -	extern void __bad_size(void);
> -
> -	if (__builtin_constant_p(size)) {
> -		int i = 0;
> -
> -#define CACHE(x) \
> -	if (size <=x) \
> -		return i; \
> -	else \
> -		i++;
> -#include <linux/kmalloc_sizes.h>
> -#undef CACHE
> -		__bad_size();
> -	} else
> -		__bad_size();
> -	return 0;
> -}
> -

Looks like someone just ate the bird.

-- Steve


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