Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1546207

Re: [PATCH 2/2] nsfs: Add an ioctl() to return creator UID of a userns

From ebiederm@xmission.com (Eric W. Biederman)
Newsgroups linux.kernel
Subject Re: [PATCH 2/2] nsfs: Add an ioctl() to return creator UID of a userns
Date 2016-12-22 08:30 +0100
Message-ID <sR5Z8-6ip-15@gated-at.bofh.it> (permalink)
References <sQ7gC-Ek-11@gated-at.bofh.it> <sQ7gC-Ek-27@gated-at.bofh.it> <sR5Ps-6eS-9@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Andrei Vagin <avagin@virtuozzo.com> 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

Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

[PATCH 2/2] nsfs: Add an ioctl() to return creator UID of a userns "Michael Kerrisk (man-pages)" <mtk.manpages@gmail.com> - 2016-12-19 15:40 +0100
  Re: [PATCH 2/2] nsfs: Add an ioctl() to return creator UID of a  userns "Michael Kerrisk (man-pages)" <mtk.manpages@gmail.com> - 2016-12-22 08:20 +0100
  Re: [PATCH 2/2] nsfs: Add an ioctl() to return creator UID of a userns ebiederm@xmission.com (Eric W. Biederman) - 2016-12-22 08:30 +0100

csiph-web