Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964926AbcLVH1O (ORCPT ); Thu, 22 Dec 2016 02:27:14 -0500 Received: from out02.mta.xmission.com ([166.70.13.232]:53069 "EHLO out02.mta.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755831AbcLVH1L (ORCPT ); Thu, 22 Dec 2016 02:27:11 -0500 From: ebiederm@xmission.com (Eric W. Biederman) To: Andrei Vagin Cc: "Michael Kerrisk \(man-pages\)" , "Serge E. Hallyn" , , , , Andrey Vagin , James Bottomley , "W. Trevor King" , Alexander Viro , Jonathan Corbet References: <46b85444-dc97-17a3-4445-439923936450@gmail.com> <20161221031315.GB20983@outlook.office365.com> Date: Thu, 22 Dec 2016 20:23:49 +1300 In-Reply-To: <20161221031315.GB20983@outlook.office365.com> (Andrei Vagin's message of "Tue, 20 Dec 2016 19:13:16 -0800") Message-ID: <87zijoh1fe.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=1cJxmI-0004wg-SP;;;mid=<87zijoh1fe.fsf@xmission.com>;;;hst=in01.mta.xmission.com;;;ip=101.100.131.98;;;frm=ebiederm@xmission.com;;;spf=neutral X-XM-AID: U2FsdGVkX1/kmKqnJHowrU1Sm81RfnYUjaLoopwRKa0= 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.8 BAYES_50 BODY: Bayes spam probability is 40 to 60% * [score: 0.4840] * -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: **;Andrei Vagin X-Spam-Relay-Country: X-Spam-Timing: total 5302 ms - load_scoreonly_sql: 0.03 (0.0%), signal_user_changed: 3.5 (0.1%), b_tie_ro: 2.5 (0.0%), parse: 0.98 (0.0%), extract_message_metadata: 12 (0.2%), get_uri_detail_list: 0.90 (0.0%), tests_pri_-1000: 4.5 (0.1%), tests_pri_-950: 1.12 (0.0%), tests_pri_-900: 0.97 (0.0%), tests_pri_-400: 19 (0.4%), check_bayes: 18 (0.3%), b_tokenize: 5 (0.1%), b_tok_get_all: 6 (0.1%), b_comp_prob: 1.61 (0.0%), b_tok_touch_all: 2.8 (0.1%), b_finish: 0.74 (0.0%), tests_pri_0: 127 (2.4%), check_dkim_signature: 0.45 (0.0%), check_dkim_adsp: 2.8 (0.1%), tests_pri_500: 5130 (96.8%), poll_dns_idle: 5123 (96.6%), rewrite_mail: 0.00 (0.0%) Subject: Re: [PATCH 2/2] nsfs: Add an ioctl() to return creator UID of a userns 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 in01.mta.xmission.com) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 962 Lines: 26 Andrei Vagin writes: > On Mon, Dec 19, 2016 at 03:38:35PM +0100, Michael Kerrisk (man-pages) wrote: >> @@ -174,6 +175,11 @@ static long ns_ioctl(struct file *filp, unsigned int ioctl, >> return open_related_ns(ns, ns->ops->get_parent); >> case NS_GET_NSTYPE: >> return ns->ops->type; >> + case NS_GET_CREATOR_UID: >> + if (ns->ops->type != CLONE_NEWUSER) >> + return -EINVAL; >> + user_ns = container_of(ns, struct user_namespace, ns); >> + return from_kuid_munged(current_user_ns(), user_ns->owner); > > uid_t is "unsigned int", ioctl() returns long, so it may be hard to > distinguish user id-s from errors on x32. Very good point. > off-topic: What is about user_ns->group? I can't find where it is > used... Over design. I put it in because I thought it might be useful. It turns out it never was used so we can clean things up and remove it. The group has never been exposed to userspace so no one will care. Eric