From: ebiederm@xmission.com (Eric W. Biederman)
To: Christian Brauner <christian.brauner@canonical.com>
Cc: Christian Brauner <christian.brauner@ubuntu.com>,
linux-kernel@vger.kernel.org, stgraber@ubuntu.com,
tycho@tycho.ws, serge@hallyn.com
Subject: Re: [PATCH 1/2 v3] user namespace: use union in {g,u}idmap struct
Date: Thu, 19 Oct 2017 11:38:26 -0500 [thread overview]
Message-ID: <87h8uvgkjh.fsf@xmission.com> (raw)
In-Reply-To: <20171019161518.b6r3ql5xk4wwr5wu@gmail.com> (Christian Brauner's message of "Thu, 19 Oct 2017 18:15:19 +0200")
Christian Brauner <christian.brauner@canonical.com> writes:
> On Wed, Oct 18, 2017 at 07:48:14PM -0500, Eric W. Biederman wrote:
>> Christian Brauner <christian.brauner@canonical.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.
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
prev parent reply other threads:[~2017-10-19 16:39 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-16 15:34 [PATCH 1/2 v3] user namespace: use union in {g,u}idmap struct Christian Brauner
2017-10-16 15:34 ` [PATCH 2/2 v3] user namespaces: bump idmap limits to 340 Christian Brauner
2017-10-18 22:51 ` [PATCH 1/2 v3] user namespace: use union in {g,u}idmap struct kbuild test robot
2017-10-18 23:42 ` Christian Brauner
2017-10-19 0:48 ` Eric W. Biederman
2017-10-19 16:15 ` Christian Brauner
2017-10-19 16:38 ` Eric W. Biederman [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87h8uvgkjh.fsf@xmission.com \
--to=ebiederm@xmission.com \
--cc=christian.brauner@canonical.com \
--cc=christian.brauner@ubuntu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=serge@hallyn.com \
--cc=stgraber@ubuntu.com \
--cc=tycho@tycho.ws \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.