Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1764202AbcLVKd1 (ORCPT ); Thu, 22 Dec 2016 05:33:27 -0500 Received: from out03.mta.xmission.com ([166.70.13.233]:44971 "EHLO out03.mta.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751230AbcLVKdZ (ORCPT ); Thu, 22 Dec 2016 05:33:25 -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 , Andrei Vagin References: <0e229ec4-e3fc-dd46-c5b9-3afa0f14bfcd@gmail.com> <87bmw7pm31.fsf@xmission.com> <65dd9028-8aa8-123e-ddff-807c44079a50@gmail.com> <878trae4g6.fsf@xmission.com> <8737hi5e67.fsf@xmission.com> <24b5d73e-0071-6be4-fa5b-391eb8aa0f78@gmail.com> <87a8boq03m.fsf@xmission.com> <142285b7-225b-fd15-3c8e-9ae2d02e82b5@gmail.com> Date: Thu, 22 Dec 2016 23:28:39 +1300 In-Reply-To: <142285b7-225b-fd15-3c8e-9ae2d02e82b5@gmail.com> (Michael Kerrisk's message of "Thu, 22 Dec 2016 08:20:33 +0100") Message-ID: <87vauc9s14.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=1cK0fA-0003Yp-Dj;;;mid=<87vauc9s14.fsf@xmission.com>;;;hst=in02.mta.xmission.com;;;ip=101.100.131.98;;;frm=ebiederm@xmission.com;;;spf=neutral X-XM-AID: U2FsdGVkX18+gWCKKuErNqOPu0JoEDTGEMfuA/c/Y8Y= 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 * 1.5 XMNoVowels Alpha-numberic number with no vowels * 0.7 XMSubLong Long Subject * 0.0 T_TM2_M_HEADER_IN_MSG BODY: No description available. * -0.0 BAYES_20 BODY: Bayes spam probability is 5 to 20% * [score: 0.0709] * -0.0 DCC_CHECK_NEGATIVE Not listed in DCC * [sa07 1397; Body=1 Fuz1=1 Fuz2=1] * 0.0 T_TooManySym_02 5+ unique symbols in subject * 0.0 T_TooManySym_01 4+ unique symbols in subject X-Spam-DCC: XMission; sa07 1397; Body=1 Fuz1=1 Fuz2=1 X-Spam-Combo: *;"Michael Kerrisk \(man-pages\)" X-Spam-Relay-Country: X-Spam-Timing: total 262 ms - load_scoreonly_sql: 0.03 (0.0%), signal_user_changed: 3.8 (1.5%), b_tie_ro: 2.8 (1.1%), parse: 0.76 (0.3%), extract_message_metadata: 3.4 (1.3%), get_uri_detail_list: 1.87 (0.7%), tests_pri_-1000: 3.7 (1.4%), tests_pri_-950: 1.13 (0.4%), tests_pri_-900: 0.99 (0.4%), tests_pri_-400: 25 (9.4%), check_bayes: 24 (9.1%), b_tokenize: 8 (2.9%), b_tok_get_all: 9 (3.4%), b_comp_prob: 2.3 (0.9%), b_tok_touch_all: 2.9 (1.1%), b_finish: 0.65 (0.2%), tests_pri_0: 212 (80.8%), check_dkim_signature: 0.48 (0.2%), check_dkim_adsp: 2.9 (1.1%), tests_pri_500: 3.9 (1.5%), 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: 2846 Lines: 74 "Michael Kerrisk (man-pages)" writes: > Hi Eric, > > On 12/22/2016 01:27 AM, Eric W. Biederman wrote: >> "Michael Kerrisk (man-pages)" writes: >> >>> Hi Eric, >>> >>> On 12/21/2016 01:17 AM, Eric W. Biederman wrote: >>>> "Michael Kerrisk (man-pages)" writes: >>>> >>>>> Hi Eric, >>>>> >>>>> On 12/20/2016 09:22 PM, Eric W. Biederman wrote: >>>>>> "Michael Kerrisk (man-pages)" writes: >>>>>> >>>>>>> Hello Eric, >>>>>>> >>>>>>> On 12/19/2016 11:53 PM, Eric W. Biederman wrote: >>>>>>>> "Michael Kerrisk (man-pages)" writes: >>>>>>>> >> >>>> Now the question becomes who are the users of this? Because it just >>>> occurred to me that we now have an interesting complication. Userspace >>>> extending the meaning of the capability bits, and using to protect >>>> additional things. Ugh. That could be a maintenance problem of another >>>> flavor. Definitely not my favorite. >>> >>> I don't follow you here. Could you say some more about what you mean? >> >> I have seen user space userspace do thing such as extend CAP_SYS_REBOOT >> to things such as permission to invoke "shutdown -r now". Which >> depending on what a clean reboot entails could be greately increasing >> the scope of CAP_SYS_REBOOT. >> >> I am concerned for that and similar situations that userspace >> applications could lead us into situation that one wrong decision could >> wind up being an unfixable mistake because fixing the mistake would >> break userspsace. > > Okay. > >>>> So why are we asking the questions about what permissions a process has? >>> >>> My main interest here is monitoring/discovery/debugging on a running >>> system. NS_GET_PARENT, NS_GET_USERNS, NS_GET_CREATOR_UID, and >>> NS_GET_NSTYPE provide most of what I'd like to see. Being able to ask >>> "does this process have permissions in that namespace?" would be nice >>> to have in terms of understanding/debugging a system. >> >> If we are just looking at explanations then I seem to have been >> over-engineering things. So let's just aim at the two ioctls. >> Or at least the information in those ioctls. > > Okay. > >> With at least a comment on the ioctl returning the OWNER_UID that >> describes why it is not a problem to if the owners uid is something like >> ((uid_t)-3). Which overlaps with the space for error return codes. >> >> I don't know if we are fine or not, but that review comment definitely >> deserves some consideration. > > > See my reply just sent to Andrei. We should instead then just return > the UID via a buffer pointed to by the ioctl() argument: > > ioctl(fd, NS_GET_OWNER_UID, &uid); That will work without problem. Especially as unsigned int is the same on both 32bit and 64bit so we won't need a compat ioctl. Eric