[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190329235521.wrtuyoualsvcgz5k@brauner.io>
Date: Sat, 30 Mar 2019 00:55:22 +0100
From: Christian Brauner <christian@...uner.io>
To: Jann Horn <jannh@...gle.com>
Cc: Andy Lutomirski <luto@...nel.org>,
David Howells <dhowells@...hat.com>,
"Serge E. Hallyn" <serge@...lyn.com>,
Linux API <linux-api@...r.kernel.org>,
kernel list <linux-kernel@...r.kernel.org>,
Arnd Bergmann <arnd@...db.de>,
"Eric W. Biederman" <ebiederm@...ssion.com>,
Konstantin Khlebnikov <khlebnikov@...dex-team.ru>,
Kees Cook <keescook@...omium.org>,
Alexey Dobriyan <adobriyan@...il.com>,
Thomas Gleixner <tglx@...utronix.de>,
Michael Kerrisk-manpages <mtk.manpages@...il.com>,
Jonathan Kowalski <bl0pbl33p@...il.com>,
"Dmitry V. Levin" <ldv@...linux.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Oleg Nesterov <oleg@...hat.com>,
Nagarathnam Muthusamy <nagarathnam.muthusamy@...cle.com>,
Aleksa Sarai <cyphar@...har.com>,
Al Viro <viro@...iv.linux.org.uk>,
"Joel Fernandes (Google)" <joel@...lfernandes.org>,
Daniel Colascione <dancol@...gle.com>
Subject: Re: [PATCH v2 2/5] pid: add pidfd_open()
On Sat, Mar 30, 2019 at 12:45:46AM +0100, Jann Horn wrote:
> On Fri, Mar 29, 2019 at 4:54 PM Christian Brauner <christian@...uner.io> wrote:
> > /* Introduction */
> > This adds the pidfd_open() syscall.
> > pidfd_open() allows to retrieve file descriptors for a given pid. This
> > includes both file descriptors for processes and file descriptors for
> > threads.
>
> Looks good to me, overall. Apart from a few nits below:
> Reviewed-by: Jann Horn <jannh@...gle.com>
Thanks! Will fixup the nits and add your Reviewed-by!
>
> [...]
> > diff --git a/kernel/pid.c b/kernel/pid.c
> > index 20881598bdfa..8c9e15e0e463 100644
> > --- a/kernel/pid.c
> > +++ b/kernel/pid.c
> [...]
> > +static struct file *pidfd_open_proc_pid(const struct file *procf, pid_t pid,
> > + const struct pid *pidfd_pid)
> > +{
> > + char name[12]; /* int to strlen + \0 but with */
>
> nit: comment suddenly ends at "but with"?
Will fix.
>
> [...]
> > +}
> > +
> > +static inline int pidfd_to_procfd(int procfd, struct file *pidfd_file)
> > +{
> > + long fd;
>
> nit: This should probably be an int?
Yes.
>
> [...]
> > + return fd;
> > +}
> [...]
> > +static long pidfd_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
> > +{
> > + int procfd = arg;
>
> nit: I think it'd be semantically cleaner to move this assignment into
> the switch case, but I don't feel about it strongly.
Agreed.
>
> > + switch (cmd) {
> > + case PIDFD_GET_PROCFD:
> > + return pidfd_to_procfd(procfd, file);
> > + default:
> > + return -ENOTTY;
> > + }
> > +}
Powered by blists - more mailing lists