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  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Thu, 26 Oct 2017 22:54:47 +0300
From:   Mike Rapoport <rppt@...ux.vnet.ibm.com>
To:     Oleg Nesterov <oleg@...hat.com>
Cc:     Andrew Morton <akpm@...ux-foundation.org>,
        Ingo Molnar <mingo@...hat.com>,
        Peter Zijlstra <peterz@...radead.org>,
        Thomas Gleixner <tglx@...utronix.de>,
        Darren Hart <dvhart@...radead.org>,
        Balbir Singh <bsingharora@...il.com>,
        linux-mm <linux-mm@...ck.org>,
        lkml <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] pids: introduce find_get_task_by_vpid helper

On Thu, Oct 26, 2017 at 03:58:25PM +0200, Oleg Nesterov wrote:
> On 10/26, Mike Rapoport wrote:
> >
> > There are several functions that do find_task_by_vpid() followed by
> > get_task_struct(). We can use a helper function instead.
> 
> Yes, agreed, I was going to do this many times.
> 
> > --- a/kernel/futex.c
> > +++ b/kernel/futex.c
> > @@ -870,12 +870,7 @@ static struct task_struct *futex_find_get_task(pid_t pid)
> >  {
> >  	struct task_struct *p;
> >  
> > -	rcu_read_lock();
> > -	p = find_task_by_vpid(pid);
> > -	if (p)
> > -		get_task_struct(p);
> > -
> > -	rcu_read_unlock();
> > +	p = find_get_task_by_vpid(pid);
> >  
> >  	return p;
> 
> OK, but then I think you should remove futex_find_get_task() and convert
> it callers to use the new helper.

Agree. My cocci script was too simple :)
 
> > @@ -1103,11 +1103,7 @@ static struct task_struct *ptrace_get_task_struct(pid_t pid)
> >  {
> >  	struct task_struct *child;
> >  
> > -	rcu_read_lock();
> > -	child = find_task_by_vpid(pid);
> > -	if (child)
> > -		get_task_struct(child);
> > -	rcu_read_unlock();
> > +	child = find_get_task_by_vpid(pid);
> >  
> >  	if (!child)
> >  		return ERR_PTR(-ESRCH);
> 
> The same. ptrace_get_task_struct() should die imo.

Yeah, we could just return -ESRCH in ptrace_get_task_struct users instead
of all the ERR_PTR and PTR_ERR conversions...

> Oleg.
> 

-- 
Sincerely yours,
Mike.

Powered by blists - more mailing lists