[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190515154014.4jaxuw4fcgbusnbt@brauner.io>
Date: Wed, 15 May 2019 17:40:15 +0200
From: Christian Brauner <christian@...uner.io>
To: Oleg Nesterov <oleg@...hat.com>
Cc: jannh@...gle.com, viro@...iv.linux.org.uk,
torvalds@...ux-foundation.org, linux-kernel@...r.kernel.org,
arnd@...db.de, dhowells@...hat.com, akpm@...ux-foundation.org,
cyphar@...har.com, ebiederm@...ssion.com,
elena.reshetova@...el.com, keescook@...omium.org,
luto@...capital.net, luto@...nel.org, tglx@...utronix.de,
linux-alpha@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
linux-ia64@...r.kernel.org, linux-m68k@...ts.linux-m68k.org,
linux-mips@...r.kernel.org, linux-parisc@...r.kernel.org,
linuxppc-dev@...ts.ozlabs.org, linux-s390@...r.kernel.org,
linux-sh@...r.kernel.org, sparclinux@...r.kernel.org,
linux-xtensa@...ux-xtensa.org, linux-api@...r.kernel.org,
linux-arch@...r.kernel.org, linux-kselftest@...r.kernel.org
Subject: Re: [PATCH 1/2] pid: add pidfd_open()
On Wed, May 15, 2019 at 05:35:15PM +0200, Oleg Nesterov wrote:
> On 05/15, Oleg Nesterov wrote:
> >
> > On 05/15, Christian Brauner wrote:
> > >
> > > +SYSCALL_DEFINE2(pidfd_open, pid_t, pid, unsigned int, flags)
> > > +{
> > > + int fd, ret;
> > > + struct pid *p;
> > > + struct task_struct *tsk;
> > > +
> > > + if (flags)
> > > + return -EINVAL;
> > > +
> > > + if (pid <= 0)
> > > + return -EINVAL;
> > > +
> > > + p = find_get_pid(pid);
> > > + if (!p)
> > > + return -ESRCH;
> > > +
> > > + rcu_read_lock();
> > > + tsk = pid_task(p, PIDTYPE_PID);
> >
> > You do not need find_get_pid() before rcu_lock and put_pid() at the end.
> > You can just do find_vpid() under rcu_read_lock().
>
> Ah, sorry. Somehow I forgot you need to call pidfd_create(pid), you can't
> do this under rcu_read_lock().
>
> So I was wrong, you can't avoid get/put_pid.
Yeah, I haven't made any changes yet.
Christian
Powered by blists - more mailing lists