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  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 15 Apr 2019 13:42:06 +0200
From:   Christian Brauner <christian@...uner.io>
To:     Oleg Nesterov <oleg@...hat.com>
Cc:     torvalds@...ux-foundation.org, viro@...iv.linux.org.uk,
        jannh@...gle.com, dhowells@...hat.com, linux-api@...r.kernel.org,
        linux-kernel@...r.kernel.org, serge@...lyn.com, luto@...nel.org,
        arnd@...db.de, ebiederm@...ssion.com, keescook@...omium.org,
        tglx@...utronix.de, mtk.manpages@...il.com,
        akpm@...ux-foundation.org, cyphar@...har.com,
        joel@...lfernandes.org, dancol@...gle.com
Subject: Re: [PATCH 2/4] clone: add CLONE_PIDFD

On Mon, Apr 15, 2019 at 12:52:09PM +0200, Oleg Nesterov wrote:
> On 04/14, Christian Brauner wrote:
> >
> > @@ -2260,6 +2363,10 @@ long _do_fork(unsigned long clone_flags,
> >  	}
> >
> >  	put_pid(pid);
> > +
> > +	if (clone_flags & CLONE_PIDFD)
> > +		nr = pidfd;
> > +
> 
> Well, this doesn't look nice ...
> 
> CLONE_PARENT_SETTID doesn't look very usefule, so what if we add
> 
> 	if ((clone_flags & (CLONE_PIDFD|CLONE_PARENT_SETTID)) ==
> 	                   (CLONE_PIDFD|CLONE_PARENT_SETTID))
> 		return ERR_PTR(-EINVAL);
> 
> at the start of copy_process() ?
> 
> Then it can do
> 
> 	if (clone_flags & CLONE_PIDFD) {
> 		retval = pidfd_create(pid, &pidfdf);
> 		if (retval < 0)
> 			goto bad_fork_free_pid;
> 		retval = put_user(retval, parent_tidptr)
> 		if (retval < 0)
> 			goto bad_fork_free_pid;
> 	}

Uhhh Oleg, that is nifty. I have to say I like that a lot. This would
let us return the pid and the pidfd in one go and we can also start
pidfd numbering at 0.

Powered by blists - more mailing lists