From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752919AbdJSQjC (ORCPT ); Thu, 19 Oct 2017 12:39:02 -0400 Received: from out01.mta.xmission.com ([166.70.13.231]:55070 "EHLO out01.mta.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752069AbdJSQi7 (ORCPT ); Thu, 19 Oct 2017 12:38:59 -0400 From: ebiederm@xmission.com (Eric W. Biederman) To: Christian Brauner Cc: Christian Brauner , 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> <87r2u0hsj5.fsf@xmission.com> <20171019161518.b6r3ql5xk4wwr5wu@gmail.com> Date: Thu, 19 Oct 2017 11:38:26 -0500 In-Reply-To: <20171019161518.b6r3ql5xk4wwr5wu@gmail.com> (Christian Brauner's message of "Thu, 19 Oct 2017 18:15:19 +0200") Message-ID: <87h8uvgkjh.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=1e5DqO-0002PG-0s;;;mid=<87h8uvgkjh.fsf@xmission.com>;;;hst=in02.mta.xmission.com;;;ip=67.3.233.18;;;frm=ebiederm@xmission.com;;;spf=neutral X-XM-AID: U2FsdGVkX1+5g/a000rYM0OmwksRcj8YOm5bp3eVWZM= 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.4889] * -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 5300 ms - load_scoreonly_sql: 0.04 (0.0%), signal_user_changed: 2.4 (0.0%), b_tie_ro: 1.70 (0.0%), parse: 0.72 (0.0%), extract_message_metadata: 11 (0.2%), get_uri_detail_list: 1.43 (0.0%), tests_pri_-1000: 3.3 (0.1%), tests_pri_-950: 1.08 (0.0%), tests_pri_-900: 0.92 (0.0%), tests_pri_-400: 21 (0.4%), check_bayes: 20 (0.4%), b_tokenize: 6 (0.1%), b_tok_get_all: 7 (0.1%), b_comp_prob: 2.2 (0.0%), b_tok_touch_all: 3.2 (0.1%), b_finish: 0.55 (0.0%), tests_pri_0: 265 (5.0%), check_dkim_signature: 0.46 (0.0%), check_dkim_adsp: 3.2 (0.1%), tests_pri_500: 4992 (94.2%), poll_dns_idle: 4987 (94.1%), 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 in02.mta.xmission.com) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Christian Brauner writes: > On Wed, Oct 18, 2017 at 07:48:14PM -0500, Eric W. Biederman wrote: >> 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. > > 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. Please do. The only solid feedback I have at this point is that you don't need to take userns_state_mutex on free. As there are no references at that point a lock isn't going to make a difference. I think I may have seen a few extra smp_rmb() in there. But I have not looked closely enough to confirm that. But all of those are the code works, there is just a little room for improvement kind of things. There is nothing in there (except the kernel/user.c initialization) that I have seen so far that says it could not be merged now. Eric