From mboxrd@z Thu Jan 1 00:00:00 1970 From: ebiederm@xmission.com (Eric W. Biederman) Subject: Re: [PATCH v4 0/2] Add further ioctl() operations for namespace discovery Date: Wed, 25 Jan 2017 15:26:38 +1300 Message-ID: <877f5jlvs1.fsf@xmission.com> References: <93e5c7f9-9dc1-6c93-ad20-0ba053d8bfef@gmail.com> <963f76f9-3ae5-b316-e688-00d3e59cad30@gmail.com> <87d1fblx2s.fsf@xmission.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: In-Reply-To: (Michael Kerrisk's message of "Wed, 25 Jan 2017 15:24:35 +1300") Sender: linux-fsdevel-owner@vger.kernel.org To: "Michael Kerrisk (man-pages)" Cc: "Serge E. Hallyn" , Linux API , lkml , "linux-fsdevel@vger.kernel.org" , Andrey Vagin , James Bottomley , "W. Trevor King" , Alexander Viro List-Id: linux-api@vger.kernel.org "Michael Kerrisk (man-pages)" writes: > Hi Eric, > > On 25 January 2017 at 14:58, Eric W. Biederman wrote: >> "Michael Kerrisk (man-pages)" writes: >> >>> I would like to write code that discovers the namespace setup on a live >>> system. The NS_GET_PARENT and NS_GET_USERNS ioctl() operations added in >>> Linux 4.9 provide much of what I want, but there are still a couple of >>> small pieces missing. Those pieces are added with this patch series. >> >> So it looks like the -EOVERFLOW change broke your example program. >> Causing it to abort if -EOVERFLOW is hit. Do we really want to return >> -EOVERFLOW? Or do you want to fix your program? > > Bother! Yes, I should have kept the example program in sync. (I > overlooked that it was not any more in sync.) > > So, I want to make sure I understand correctly, before I aswer your > question. Suppose we have > > 1. Outer namespace owned by UID 0 > 2. Inner namespace owned by UID 1000 > 3. A UID mapping in the inner namespace that maps '0 1000 1' > 4. A processs, X, in the outer namespace with UID 0 (and all caps). > > That's the case you're meaning, right? I think so I just noticed you did not handle -EOVERFLOW in the one NS_GET_OWNER_UID call. > So, UID 0 doesn't have a > mapping into the inner namespace, but does have all capabilities in > that inner namespace, right? That is correct. Eric From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from out02.mta.xmission.com ([166.70.13.232]:44437 "EHLO out02.mta.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751154AbdAYCbA (ORCPT ); Tue, 24 Jan 2017 21:31:00 -0500 From: ebiederm@xmission.com (Eric W. Biederman) To: "Michael Kerrisk \(man-pages\)" Cc: "Serge E. Hallyn" , Linux API , lkml , "linux-fsdevel\@vger.kernel.org" , Andrey Vagin , James Bottomley , "W. Trevor King" , Alexander Viro References: <93e5c7f9-9dc1-6c93-ad20-0ba053d8bfef@gmail.com> <963f76f9-3ae5-b316-e688-00d3e59cad30@gmail.com> <87d1fblx2s.fsf@xmission.com> Date: Wed, 25 Jan 2017 15:26:38 +1300 In-Reply-To: (Michael Kerrisk's message of "Wed, 25 Jan 2017 15:24:35 +1300") Message-ID: <877f5jlvs1.fsf@xmission.com> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [PATCH v4 0/2] Add further ioctl() operations for namespace discovery Sender: linux-fsdevel-owner@vger.kernel.org List-ID: "Michael Kerrisk (man-pages)" writes: > Hi Eric, > > On 25 January 2017 at 14:58, Eric W. Biederman wrote: >> "Michael Kerrisk (man-pages)" writes: >> >>> I would like to write code that discovers the namespace setup on a live >>> system. The NS_GET_PARENT and NS_GET_USERNS ioctl() operations added in >>> Linux 4.9 provide much of what I want, but there are still a couple of >>> small pieces missing. Those pieces are added with this patch series. >> >> So it looks like the -EOVERFLOW change broke your example program. >> Causing it to abort if -EOVERFLOW is hit. Do we really want to return >> -EOVERFLOW? Or do you want to fix your program? > > Bother! Yes, I should have kept the example program in sync. (I > overlooked that it was not any more in sync.) > > So, I want to make sure I understand correctly, before I aswer your > question. Suppose we have > > 1. Outer namespace owned by UID 0 > 2. Inner namespace owned by UID 1000 > 3. A UID mapping in the inner namespace that maps '0 1000 1' > 4. A processs, X, in the outer namespace with UID 0 (and all caps). > > That's the case you're meaning, right? I think so I just noticed you did not handle -EOVERFLOW in the one NS_GET_OWNER_UID call. > So, UID 0 doesn't have a > mapping into the inner namespace, but does have all capabilities in > that inner namespace, right? That is correct. Eric