lkml.org 
[lkml]   [2013]   [Jan]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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



\
 
 \ /
  Last update: 2013-01-25 15:43    [W:0.082 / U:0.100 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site