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, 19 Oct 2017 18:15:19 +0200
From:   Christian Brauner <christian.brauner@...onical.com>
To:     "Eric W. Biederman" <ebiederm@...ssion.com>
Cc:     Christian Brauner <christian.brauner@...ntu.com>,
        linux-kernel@...r.kernel.org, stgraber@...ntu.com, tycho@...ho.ws,
        serge@...lyn.com
Subject: Re: [PATCH 1/2 v3] user namespace: use union in {g,u}idmap struct

On Wed, Oct 18, 2017 at 07:48:14PM -0500, Eric W. Biederman wrote:
> Christian Brauner <christian.brauner@...onical.com> writes:
> 
> > I'm not sure why the build is complaining about how the union is initialized
> > here. This looks legitimate to me and I can't reproduce this locally with or
> > without the appended config. The struct introduced here is:
> >
> > #define UID_GID_MAP_MAX_EXTENTS 5
> >
> > struct uid_gid_extent {
> > 	u32 first;
> > 	u32 lower_first;
> > 	u32 count;
> > };
> >
> > struct uid_gid_map { /* 64 bytes -- 1 cache line */
> > 	u32 nr_extents;
> > 	union {
> > 		struct uid_gid_extent extent[UID_GID_MAP_MAX_EXTENTS];
> > 		struct {
> > 			struct uid_gid_extent *forward;
> > 			struct uid_gid_extent *reverse;
> > 		};
> > 	};
> > };
> >
> > And the initialization in kernel/user.c which I didn't change looks correct.
> > But maybe I'm missing the point.
> 
> You may want to check your compiler version this feels like a compiler
> dependent error.
> 
> It looks like gcc isn't happy about not having braces for the anonymous
> union of extent and the anonymouns structure that holds forward and
> reverse.
> 
> FYI since I am commenting.  I took a quick skim through your code today
> and at first glance everything looks good.  The performance is nice and
> fast, and the changes look reasonable at first glance.

Thanks. Glad to hear.

> 
> I think there are some nits that can be picked but nothing yet that
> indicates the code is working incorrectly.

Do you want me to wait for your feedback? If not I'd send a new version of the
patch with an additonal patch for kernel/user.c to use enclosing brackets when
initializing the union in the struct.

Christian

> 
> Eric
> 
> > On Thu, Oct 19, 2017 at 06:51:48AM +0800, kbuild test robot wrote:
> >> Hi Christian,
> >> 
> >> [auto build test ERROR on linus/master]
> >> [also build test ERROR on v4.14-rc5 next-20171017]
> >> [if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
> >> 
> >> url:    https://github.com/0day-ci/linux/commits/Christian-Brauner/user-namespace-use-union-in-g-u-idmap-struct/20171019-022142
> >> config: x86_64-randconfig-a0-10190527 (attached as .config)
> >> compiler: gcc-4.4 (Debian 4.4.7-8) 4.4.7
> >> reproduce:
> >>         # save the attached .config to linux build tree
> >>         make ARCH=x86_64 
> >> 
> >> All error/warnings (new ones prefixed by >>):
> >> 
> >> >> kernel/user.c:29: error: unknown field 'extent' specified in initializer
> >> >> kernel/user.c:30: error: unknown field 'first' specified in initializer
> >> >> kernel/user.c:30: warning: missing braces around initializer
> >>    kernel/user.c:30: warning: (near initialization for 'init_user_ns.uid_map.<anonymous>.extent')
> >> >> kernel/user.c:31: error: unknown field 'lower_first' specified in initializer
> >> >> kernel/user.c:31: warning: excess elements in union initializer
> >>    kernel/user.c:31: warning: (near initialization for 'init_user_ns.uid_map.<anonymous>')
> >> >> kernel/user.c:32: error: unknown field 'count' specified in initializer
> >>    kernel/user.c:32: warning: excess elements in union initializer
> >>    kernel/user.c:32: warning: (near initialization for 'init_user_ns.uid_map.<anonymous>')
> >>    kernel/user.c:37: error: unknown field 'extent' specified in initializer
> >>    kernel/user.c:38: error: unknown field 'first' specified in initializer
> >>    kernel/user.c:39: error: unknown field 'lower_first' specified in initializer
> >>    kernel/user.c:39: warning: excess elements in union initializer
> >>    kernel/user.c:39: warning: (near initialization for 'init_user_ns.gid_map.<anonymous>')
> >>    kernel/user.c:40: error: unknown field 'count' specified in initializer
> >>    kernel/user.c:40: warning: excess elements in union initializer
> >>    kernel/user.c:40: warning: (near initialization for 'init_user_ns.gid_map.<anonymous>')
> >>    kernel/user.c:45: error: unknown field 'extent' specified in initializer
> >>    kernel/user.c:46: error: unknown field 'first' specified in initializer
> >>    kernel/user.c:47: error: unknown field 'lower_first' specified in initializer
> >>    kernel/user.c:47: warning: excess elements in union initializer
> >>    kernel/user.c:47: warning: (near initialization for 'init_user_ns.projid_map.<anonymous>')
> >>    kernel/user.c:48: error: unknown field 'count' specified in initializer
> >>    kernel/user.c:48: warning: excess elements in union initializer
> >>    kernel/user.c:48: warning: (near initialization for 'init_user_ns.projid_map.<anonymous>')
> >> 
> >> vim +/lower_first +31 kernel/user.c
> >> 
> >> ^1da177e4 Linus Torvalds    2005-04-16  21  
> >> 59607db36 Serge E. Hallyn   2011-03-23  22  /*
> >> 59607db36 Serge E. Hallyn   2011-03-23  23   * userns count is 1 for root user, 1 for init_uts_ns,
> >> 59607db36 Serge E. Hallyn   2011-03-23  24   * and 1 for... ?
> >> 59607db36 Serge E. Hallyn   2011-03-23  25   */
> >> aee16ce73 Pavel Emelyanov   2008-02-08  26  struct user_namespace init_user_ns = {
> >> 22d917d80 Eric W. Biederman 2011-11-17  27  	.uid_map = {
> >> 22d917d80 Eric W. Biederman 2011-11-17  28  		.nr_extents = 1,
> >> 22d917d80 Eric W. Biederman 2011-11-17 @29  		.extent[0] = {
> >> 22d917d80 Eric W. Biederman 2011-11-17 @30  			.first = 0,
> >> 22d917d80 Eric W. Biederman 2011-11-17 @31  			.lower_first = 0,
> >> 4b06a81f1 Eric W. Biederman 2012-05-19 @32  			.count = 4294967295U,
> >> 22d917d80 Eric W. Biederman 2011-11-17  33  		},
> >> 22d917d80 Eric W. Biederman 2011-11-17  34  	},
> >> 22d917d80 Eric W. Biederman 2011-11-17  35  	.gid_map = {
> >> 22d917d80 Eric W. Biederman 2011-11-17  36  		.nr_extents = 1,
> >> 22d917d80 Eric W. Biederman 2011-11-17  37  		.extent[0] = {
> >> 22d917d80 Eric W. Biederman 2011-11-17  38  			.first = 0,
> >> 22d917d80 Eric W. Biederman 2011-11-17  39  			.lower_first = 0,
> >> 4b06a81f1 Eric W. Biederman 2012-05-19  40  			.count = 4294967295U,
> >> 22d917d80 Eric W. Biederman 2011-11-17  41  		},
> >> 22d917d80 Eric W. Biederman 2011-11-17  42  	},
> >> f76d207a6 Eric W. Biederman 2012-08-30  43  	.projid_map = {
> >> f76d207a6 Eric W. Biederman 2012-08-30  44  		.nr_extents = 1,
> >> f76d207a6 Eric W. Biederman 2012-08-30  45  		.extent[0] = {
> >> f76d207a6 Eric W. Biederman 2012-08-30  46  			.first = 0,
> >> f76d207a6 Eric W. Biederman 2012-08-30  47  			.lower_first = 0,
> >> f76d207a6 Eric W. Biederman 2012-08-30  48  			.count = 4294967295U,
> >> f76d207a6 Eric W. Biederman 2012-08-30  49  		},
> >> f76d207a6 Eric W. Biederman 2012-08-30  50  	},
> >> c61a2810a Eric W. Biederman 2012-12-28  51  	.count = ATOMIC_INIT(3),
> >> 783291e69 Eric W. Biederman 2011-11-17  52  	.owner = GLOBAL_ROOT_UID,
> >> 783291e69 Eric W. Biederman 2011-11-17  53  	.group = GLOBAL_ROOT_GID,
> >> 435d5f4bb Al Viro           2014-10-31  54  	.ns.inum = PROC_USER_INIT_INO,
> >> 33c429405 Al Viro           2014-11-01  55  #ifdef CONFIG_USER_NS
> >> 33c429405 Al Viro           2014-11-01  56  	.ns.ops = &userns_operations,
> >> 33c429405 Al Viro           2014-11-01  57  #endif
> >> 9cc46516d Eric W. Biederman 2014-12-02  58  	.flags = USERNS_INIT_FLAGS,
> >> 6bd364d82 Xiao Guangrong    2013-12-13  59  #ifdef CONFIG_PERSISTENT_KEYRINGS
> >> 6bd364d82 Xiao Guangrong    2013-12-13  60  	.persistent_keyring_register_sem =
> >> 6bd364d82 Xiao Guangrong    2013-12-13  61  	__RWSEM_INITIALIZER(init_user_ns.persistent_keyring_register_sem),
> >> f36f8c75a David Howells     2013-09-24  62  #endif
> >> aee16ce73 Pavel Emelyanov   2008-02-08  63  };
> >> aee16ce73 Pavel Emelyanov   2008-02-08  64  EXPORT_SYMBOL_GPL(init_user_ns);
> >> aee16ce73 Pavel Emelyanov   2008-02-08  65  
> >> 
> >> :::::: The code at line 31 was first introduced by commit
> >> :::::: 22d917d80e842829d0ca0a561967d728eb1d6303 userns: Rework the user_namespace adding uid/gid mapping support
> >> 
> >> :::::: TO: Eric W. Biederman <ebiederm@...ssion.com>
> >> :::::: CC: Eric W. Biederman <ebiederm@...ssion.com>
> >> 
> >> ---
> >> 0-DAY kernel test infrastructure                Open Source Technology Center
> >> https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ