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]
Message-Id: <201010302214.DDF98906.MSFJOFtFHOLQVO@I-love.SAKURA.ne.jp>
Date:	Sat, 30 Oct 2010 22:14:23 +0900
From:	Tetsuo Handa <penguin-kernel@...ove.SAKURA.ne.jp>
To:	paulmck@...ux.vnet.ibm.com, sergey.senozhatsky@...il.com
Cc:	viro@...iv.linux.org.uk, linux-fsdevel@...r.kernel.org,
	linux-kernel@...r.kernel.org, akpm@...ux-foundation.org,
	mingo@...e.hu
Subject: Re: [PATCH] rcu_read_lock/unlock protect find_task_by_vpid call

Sergey Senozhatsky wrote:
> On (10/29/10 13:16), Paul E. McKenney wrote:
> > Interesting...
> > 
> > The task-list lock is read-held at this point, which should mean that
> > the PID mapping cannot change.  The lockdep_tasklist_lock_is_held()
> > function does lockdep_is_held(&tasklist_lock), which must therefore
> > only be checking for write-holding the lock.  The fix would be to
> > make lockdep_tasklist_lock_is_held() check for either read-holding or
> > write-holding tasklist lock.
> > 
> > Or is there some subtle reason that read-holding the tasklist lock is
> > not sufficient?

This was discussed in the thread at http://kerneltrap.org/mailarchive/linux-kernel/2009/12/10/4517520 .
Quoting from one of posts in that thead http://kerneltrap.org/mailarchive/linux-kernel/2010/2/8/4536388

| Usually tasklist gives enough protection, but if copy_process() fails
| it calls free_pid() lockless and does call_rcu(delayed_put_pid().
| This means, without rcu lock find_pid_ns() can't scan the hash table
| safely.

And now the patch that adds

	rcu_lockdep_assert(rcu_read_lock_held());

was merged in accordance with that comment.
Therefore, I thing below change is not good.

> Should it be changed to (let's say)
> 
> struct task_struct *find_task_by_pid_ns(pid_t nr, struct pid_namespace *ns)
> {
> -	rcu_lockdep_assert(rcu_read_lock_held());
> +	rcu_lockdep_assert(rcu_read_lock_held() || lockdep_tasklist_lock_is_held());
> 	return pid_task(find_pid_ns(nr, ns), PIDTYPE_PID);
> }

Regards.
--
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