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:	Fri, 25 Jan 2013 09:03:18 -0500
From:	Aristeu Rozanski <aris@...hat.com>
To:	Andrew Morton <akpm@...ux-foundation.org>
Cc:	linux-kernel@...r.kernel.org, "Serge E. Hallyn" <serge@...lyn.com>,
	"Eric W. Biederman" <ebiederm@...ssion.com>
Subject: Re: [PATCH v2] userns: improve uid/gid map collision detection

On Thu, Jan 24, 2013 at 04:46:12PM -0800, Andrew Morton wrote:
> eek, a macro!  Macros are always bad.
> 
> This one is bad because
> 
> a) it's a macro
> 
> b) it evaluates its args multiple times and hence will cause nasty
>    bugs if called with expressions-with-side-effects.
> 
> c) it evaluates its args multiple times and if called with
>    non-trivial expressions the compiler might not be able to CSE those
>    expressions, leading to code bloat.
> 
> Add lo, this patch:
> 
> --- a/kernel/user_namespace.c~userns-improve-uid-gid-map-collision-detection-fix
> +++ a/kernel/user_namespace.c
> @@ -521,7 +521,11 @@ struct seq_operations proc_projid_seq_op
>  
>  static DEFINE_MUTEX(id_map_mutex);
>  
> -#define in_range(b,first,len) ((b)>=(first)&&(b)<(first)+(len))
> +static bool in_range(u32 b, u32 first, u32 len)
> +{
> +	return b >= first && b < first + len;
> +}
> +
>  static inline int extent_collision(struct uid_gid_map *new_map,
>  				   struct uid_gid_extent *extent)
>  {
> 
> reduces the user_namespace.o text from 4822 bytes to 4727 with
> gcc-4.4.4.  This is a remarkably large difference.

thanks Andrew

(I see Eric already answered about the config option)

-- 
Aristeu

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