Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934117AbcLTUZh (ORCPT ); Tue, 20 Dec 2016 15:25:37 -0500 Received: from out02.mta.xmission.com ([166.70.13.232]:37686 "EHLO out02.mta.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1765845AbcLTUZd (ORCPT ); Tue, 20 Dec 2016 15:25:33 -0500 From: ebiederm@xmission.com (Eric W. Biederman) To: "Michael Kerrisk \(man-pages\)" Cc: "Serge E. Hallyn" , linux-api@vger.kernel.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, Andrey Vagin , James Bottomley , "W. Trevor King" , Alexander Viro , Jonathan Corbet References: <0e229ec4-e3fc-dd46-c5b9-3afa0f14bfcd@gmail.com> <87bmw7pm31.fsf@xmission.com> <65dd9028-8aa8-123e-ddff-807c44079a50@gmail.com> Date: Wed, 21 Dec 2016 09:22:17 +1300 In-Reply-To: <65dd9028-8aa8-123e-ddff-807c44079a50@gmail.com> (Michael Kerrisk's message of "Tue, 20 Dec 2016 16:35:28 +0100") Message-ID: <878trae4g6.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=1cJQyW-0002cc-0W;;;mid=<878trae4g6.fsf@xmission.com>;;;hst=in02.mta.xmission.com;;;ip=101.100.131.98;;;frm=ebiederm@xmission.com;;;spf=neutral X-XM-AID: U2FsdGVkX18N59/Ia3U9oGWEzkXJTfJWQ85pzIWejlA= X-SA-Exim-Connect-IP: 101.100.131.98 X-SA-Exim-Mail-From: ebiederm@xmission.com X-Spam-Report: * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP * 0.7 XMSubLong Long Subject * 1.5 XMNoVowels Alpha-numberic number with no vowels * 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.4994] * -0.0 DCC_CHECK_NEGATIVE Not listed in DCC * [sa04 1397; Body=1 Fuz1=1 Fuz2=1] * 0.0 T_TooManySym_01 4+ unique symbols in subject * 0.0 T_TooManySym_02 5+ unique symbols in subject X-Spam-DCC: XMission; sa04 1397; Body=1 Fuz1=1 Fuz2=1 X-Spam-Combo: **;"Michael Kerrisk \(man-pages\)" X-Spam-Relay-Country: X-Spam-Timing: total 357 ms - load_scoreonly_sql: 0.03 (0.0%), signal_user_changed: 3.5 (1.0%), b_tie_ro: 2.4 (0.7%), parse: 0.82 (0.2%), extract_message_metadata: 4.2 (1.2%), get_uri_detail_list: 2.6 (0.7%), tests_pri_-1000: 3.7 (1.0%), tests_pri_-950: 1.09 (0.3%), tests_pri_-900: 0.91 (0.3%), tests_pri_-400: 29 (8.2%), check_bayes: 28 (7.9%), b_tokenize: 9 (2.5%), b_tok_get_all: 11 (3.1%), b_comp_prob: 3.1 (0.9%), b_tok_touch_all: 2.9 (0.8%), b_finish: 0.66 (0.2%), tests_pri_0: 302 (84.7%), check_dkim_signature: 0.52 (0.1%), check_dkim_adsp: 3.0 (0.9%), tests_pri_500: 3.9 (1.1%), rewrite_mail: 0.00 (0.0%) Subject: Re: [PATCH 0/2] Add further ioctl() operations for namespace discovery 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 Content-Length: 4226 Lines: 89 "Michael Kerrisk (man-pages)" writes: > Hello Eric, > > On 12/19/2016 11:53 PM, Eric W. Biederman wrote: >> "Michael Kerrisk (man-pages)" writes: >> >>> Eric, >>> >>> The code proposed in this patch series is pretty small. Is there any >>> chance we could make the 4.10 merge window, if the changes seem >>> acceptable to you? >> >> I see why you are asking but I am not comfortable with aiming for >> the merge window that is on-going and could close at any moment. >> I have seen recenly too many patches that should work fine have >> some odd minor issue. Like an extra _ in a label used in an ifdef >> that resulted in memory stomps. Linus might be more brave but i would >> rather wait until the next merge window, so I don't need to worry about >> spoiling anyone's holidays with a typo someone over looked. > > I'll just gently ask if you'll reconsider and take another look at the > patches. They patches are very small, and don't change any existing > behavior. And if we see a problem in the next weeks they could be pulled. > In the meantime, I'd be aiming to publicize this API somewhat, so that we > might get some eyeballs to spot design bugs. But, I do understand your > position, if the answer is still "not for this merge window". My position is still not this merge window. I am more than happy to queue up the changes for the next one. Even on the best of days there is a reasonable chance Linus would not be happy to receive code development done in the merge window. I think there is also just a little bit of discussion that needs to happen with these new userspace APIs (below). And I have seen way too many times user space APIs added too quickly and having to be repaired afterwards. >> At first glance these patches seem reasonable. I don't see any problem >> with the ioctls you have added. >> >> That said I have a question. Should we provide a more direct way to >> find the answer to your question? Something like the access system >> call? >> >> I think a more direct answer would be more maintainable in the long run >> as it does not bind tools to specific implementation details in the >> future. Which could allow us to account for LSM policies and the like. > > My thoughts: > > 1. Regarding NS_GET_NSTYPE... It always struck me as a little odd > that you could ask setns() to check if the supplied FD referred > to a certain type of NS (and thus, in a round about way, setns() > gives us the same information as NS_GET_NSTYPE), but you can't > directly ask what the NS type is. The fact that setns() has this > facility suggests that there could be other uses for the operation > "tell me what type of NS this FD refers to". Yes. I have no problem with that one. > 2. Regarding NS_GET_CREATOR_UID... There are defined rules about what > this UID means with respect to capabilities in a namespace. It's > not an implementation detail, as I understand it. Also in terms of > introspecting to try to understand the structure of namespaces on > a running system, knowing this UID is useful in and of itself. I am not quite sold on the name NS_GET_CREATOR_UID. NS_GET_OWNER_UID seems to match the code better. The owner is the creator but the important part seems to be the ownership not the act of creation. > 3. NS_GET_NSTYPE and NS_GET_CREATOR_UID solve my problem, but > obviously your idea would make life simpler for user space. > Am I correct to understand that you mean an API that takes > three pieces of info: a PID, a capability, and an fd referring > to a /proc/PID/ns/xxx, and tells us whether PID has the specified > capability for operations in the specified namespace? Something like that. But yes something we can wire up to ns_capable_noaudit and be told the result. That will let the LSMs and any future kerel changes have their say, without any extra maintenance burden in the kernel. What I really don't want is for userspace to start depending on the current formula being the only factors that say if it has a capabliltiy in a certain situation because in practice that just isn't true. Permission checks just keep evoloving in the kernel. Eric