From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751571AbdJSAsu (ORCPT ); Wed, 18 Oct 2017 20:48:50 -0400 Received: from out03.mta.xmission.com ([166.70.13.233]:47890 "EHLO out03.mta.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751346AbdJSAss (ORCPT ); Wed, 18 Oct 2017 20:48:48 -0400 From: ebiederm@xmission.com (Eric W. Biederman) To: Christian Brauner Cc: kbuild test robot , Christian Brauner , kbuild-all@01.org, linux-kernel@vger.kernel.org, stgraber@ubuntu.com, tycho@tycho.ws, serge@hallyn.com References: <20171016153428.25973-1-christian.brauner@ubuntu.com> <201710190651.ZPvHydXh%fengguang.wu@intel.com> <20171018234226.wgfpp3cybuaxzvgu@gmail.com> Date: Wed, 18 Oct 2017 19:48:14 -0500 In-Reply-To: <20171018234226.wgfpp3cybuaxzvgu@gmail.com> (Christian Brauner's message of "Thu, 19 Oct 2017 01:42:27 +0200") Message-ID: <87r2u0hsj5.fsf@xmission.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-XM-SPF: eid=1e4z0q-0002zY-3Q;;;mid=<87r2u0hsj5.fsf@xmission.com>;;;hst=in01.mta.xmission.com;;;ip=67.3.233.18;;;frm=ebiederm@xmission.com;;;spf=neutral X-XM-AID: U2FsdGVkX18BijHLa2XyDotxYdNkqnHTtB8bmZMkxRA= X-SA-Exim-Connect-IP: 67.3.233.18 X-SA-Exim-Mail-From: ebiederm@xmission.com X-Spam-Report: * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP * 1.5 XMNoVowels Alpha-numberic number with no vowels * 0.7 XMSubLong Long Subject * 0.0 TVD_RCVD_IP Message was received from an IP address * 0.0 T_TM2_M_HEADER_IN_MSG BODY: No description available. * 0.8 BAYES_50 BODY: Bayes spam probability is 40 to 60% * [score: 0.5000] * -0.0 DCC_CHECK_NEGATIVE Not listed in DCC * [sa06 1397; Body=1 Fuz1=1 Fuz2=1] * 0.0 T_TooManySym_03 6+ unique symbols in subject * 1.0 T_XMDrugObfuBody_00 obfuscated drug references * 0.0 T_TooManySym_02 5+ unique symbols in subject * 0.0 T_TooManySym_01 4+ unique symbols in subject X-Spam-DCC: XMission; sa06 1397; Body=1 Fuz1=1 Fuz2=1 X-Spam-Combo: ***;Christian Brauner X-Spam-Relay-Country: X-Spam-Timing: total 5696 ms - load_scoreonly_sql: 0.07 (0.0%), signal_user_changed: 3.3 (0.1%), b_tie_ro: 2.2 (0.0%), parse: 1.30 (0.0%), extract_message_metadata: 26 (0.5%), get_uri_detail_list: 5 (0.1%), tests_pri_-1000: 10 (0.2%), tests_pri_-950: 1.19 (0.0%), tests_pri_-900: 1.04 (0.0%), tests_pri_-400: 35 (0.6%), check_bayes: 34 (0.6%), b_tokenize: 14 (0.3%), b_tok_get_all: 10 (0.2%), b_comp_prob: 3.3 (0.1%), b_tok_touch_all: 4.3 (0.1%), b_finish: 0.65 (0.0%), tests_pri_0: 479 (8.4%), check_dkim_signature: 0.64 (0.0%), check_dkim_adsp: 7 (0.1%), tests_pri_500: 5135 (90.2%), poll_dns_idle: 5127 (90.0%), rewrite_mail: 0.00 (0.0%) Subject: Re: [PATCH 1/2 v3] user namespace: use union in {g,u}idmap struct X-Spam-Flag: No X-SA-Exim-Version: 4.2.1 (built Thu, 05 May 2016 13:38:54 -0600) X-SA-Exim-Scanned: Yes (on in01.mta.xmission.com) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Christian Brauner 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. I think there are some nits that can be picked but nothing yet that indicates the code is working incorrectly. 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..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.') >> >> 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.') >> 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.') >> 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.') >> 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.') >> 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.') >> >> 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 >> :::::: CC: Eric W. Biederman >> >> --- >> 0-DAY kernel test infrastructure Open Source Technology Center >> https://lists.01.org/pipermail/kbuild-all Intel Corporation