From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752246AbdKANbF (ORCPT ); Wed, 1 Nov 2017 09:31:05 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:39035 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751402AbdKANbE (ORCPT ); Wed, 1 Nov 2017 09:31:04 -0400 X-Google-Smtp-Source: ABhQp+SNeKYYH0YsySUmqY2Uj3tFJ/129Kav58OHgre1eNkJ8VugJwbvcS30LyWcWJQgvKj6JYsDUQ== Date: Wed, 1 Nov 2017 14:31:00 +0100 From: Christian Brauner To: "Eric W. Biederman" Cc: Christian Brauner , Linux Kernel Mailing List , Serge Hallyn , Tycho Andersen , Linux Containers Subject: Re: [PATCH 0/5] userns: bump idmap limits, fixes & tweaks Message-ID: <20171101133059.t7qgvylutsqhsc5f@gmail.com> References: <20171024220441.10235-1-christian.brauner@ubuntu.com> <20171024220441.10235-2-christian.brauner@ubuntu.com> <871sliubhj.fsf_-_@xmission.com> <87tvyemeqe.fsf@xmission.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <87tvyemeqe.fsf@xmission.com> User-Agent: NeoMutt/20170609 (1.8.3) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Nov 01, 2017 at 06:15:53AM -0500, Eric W. Biederman wrote: > Christian Brauner writes: > > > On Tue, Oct 31, 2017 at 06:46:32PM -0500, Eric W. Biederman wrote: > >> > >> Christian I have looked through your code and I have found one real > >> issue and of things I want to twak > > > > Cool, thanks for taking a close look Eric. > > > >> > >> The real issue is reading nr_extents multiple times when reading a map. > >> That can introduce races that will allow walking past the end of the > >> array, if the first read is 0 but the second read is > 5. > >> > >> I have also found a couple of tweaks that look like they are worth > >> implementing. > > > > Yeah, I saw that you unified some of the functions. I was thinking about this > > but wanted to keep the cases distinct even with some amount of code duplication. > > But it seems very much worth it from a maintenance perspective. Thanks! > > Yes. If we have a performance regression I am willing to remove the > unification of map_id_range_down and map_id_down. But I can't imagine > that will result in a measurable performance difference. If it does > make a measurable perforamnce difference we almost certainly need to split > the bsearch case as well. > > >> As all of these are very small and very straight forward I have > >> tested these and applied them all to my for-next branch > > > > Thanks for the fixes Eric. Really appreciated. If you're too swamped for stuff > > like that I'm obviously happy to do such trivial fixes myself. :) > > If you would test this some more in your setup I would appreciate it, > just in case I missed something. I've been running kernels with this patch for a few weeks now with nested unprivileged containers and all sorts of weird setups. So far I didn't observe any problems. Once we've settled the memory barrier discussion I'm going to recompile and run a few tests. > > Given where we are in the development cycle and the correctness concerns > I just applied these as without the fix for reading extents exactly once > the code is dangerously wrong. > > Eric > > > Christian > > > >> > >> > >> Eric W. Biederman (5): > >> userns: Don't special case a count of 0 > >> userns: Simplify the user and group mapping functions > >> userns: Don't read extents twice in m_start > >> userns: Make map_id_down a wrapper for map_id_range_down > >> userns: Simplify insert_extent > >> > >> kernel/user_namespace.c | 159 ++++++++++++++++-------------------------------- > >> 1 file changed, 51 insertions(+), 108 deletions(-) > >> > >> > >> > >>