lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 27 Mar 2012 17:25:34 +0200
From:	Oleg Nesterov <oleg@...hat.com>
To:	Cyrill Gorcunov <gorcunov@...nvz.org>
Cc:	LKML <linux-kernel@...r.kernel.org>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Pavel Emelyanov <xemul@...allels.com>,
	"Serge E. Hallyn" <serge.hallyn@...onical.com>
Subject: Re: [rfc] fcntl: Add F_GETOWNER_UIDS option

On 03/26, Cyrill Gorcunov wrote:
>
> On Mon, Mar 26, 2012 at 06:43:47PM +0200, Oleg Nesterov wrote:
> > On 03/26, Cyrill Gorcunov wrote:
> > >
> > > +#ifdef CONFIG_CHECKPOINT_RESTORE
> > > +static int f_getowner_uids(struct file *filp, unsigned long arg)
> > > +{
> > > +	struct user_namespace *user_ns = current_user_ns();
> > > +	const struct cred *cred = current_cred();
> > > +	uid_t * __user dst = (void * __user)arg;
> > > +	uid_t src[2];
> > > +	int err;
> > > +
> > > +	read_lock(&filp->f_owner.lock);
> > > +	src[0] = filp->f_owner.uid;
> > > +	src[1] = filp->f_owner.euid;
> > > +	read_unlock(&filp->f_owner.lock);
> > > +
> > > +	src[0] = user_ns_map_uid(user_ns, cred, src[0]);
> > > +	src[1] = user_ns_map_uid(user_ns, cred, src[1]);
> >
> > Why?
> >
> > In this case user_ns_map_uid() is "nop", it should always return
> > the last arg, no?
>
> Yes, but I wanted to be on safe side, and if one day user_ns_map_uid
> get changed this function won't be security hole.

Can't understand.

user_ns_map_uid() should translate uid_t from one namespace to another,
in this case the namespace is the same.

user_ns_map_uid(cred->user_ns, cred) must be the identical mapping,
no matter how we change the implementation.

What I think you need is
user_ns_map_uid(current_user_ns(), filp->f_owner.cred), the only
problem is that f_owner.cred doesn't exist.

> Or I miss something
> in general?

Or me. Add Serge, may be I missed something.

Oleg.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ