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: <20100329212932.GO2569@linux.vnet.ibm.com>
Date:	Mon, 29 Mar 2010 14:29:32 -0700
From:	"Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>
To:	Peter Zijlstra <peterz@...radead.org>
Cc:	linux-kernel@...r.kernel.org, mingo@...e.hu, laijs@...fujitsu.com,
	dipankar@...ibm.com, akpm@...ux-foundation.org,
	mathieu.desnoyers@...ymtl.ca, josh@...htriplett.org,
	dvhltc@...ibm.com, niv@...ibm.com, tglx@...utronix.de,
	rostedt@...dmis.org, Valdis.Kletnieks@...edu, dhowells@...hat.com,
	eric.dumazet@...il.com, abogani@...ware.it
Subject: Re: [PATCH tip/core/urgent] rcu: protect fork-time cgroup access

On Mon, Mar 29, 2010 at 11:19:23PM +0200, Peter Zijlstra wrote:
> On Mon, 2010-03-29 at 14:15 -0700, Paul E. McKenney wrote:
> > Add an rcu_read_lock() / rcu_read_unlock() pair to protect a fork-time
> > cgroup access.  This seems likely to be a false positive.
> > 
> > Located by: Alessio Igor Bogani <abogani@...ware.it>
> > Signed-off-by: Paul E. McKenney <paulmck@...ux.vnet.ibm.com>
> > ---
> > 
> >  sched.c |    2 ++
> >  1 file changed, 2 insertions(+)
> > 
> > diff --git a/kernel/sched.c b/kernel/sched.c
> > index 9ab3cd7..d4bb5e0 100644
> > --- a/kernel/sched.c
> > +++ b/kernel/sched.c
> > @@ -2621,7 +2621,9 @@ void sched_fork(struct task_struct *p, int clone_flags)
> >  	if (p->sched_class->task_fork)
> >  		p->sched_class->task_fork(p);
> >  
> > +	rcu_read_lock();
> >  	set_task_cpu(p, cpu);
> > +	rcu_read_unlock();
> >  
> >  #if defined(CONFIG_SCHEDSTATS) || defined(CONFIG_TASK_DELAY_ACCT)
> >  	if (likely(sched_info_on()))
> 
> What got accessed? This patch just looks wrong.

It might well be wrong.  The lockdep RCU splat triggered in
task_subsys_state():

static inline struct cgroup_subsys_state *task_subsys_state(
	struct task_struct *task, int subsys_id)
{
	return rcu_dereference_check(task->cgroups->subsys[subsys_id],
				     rcu_read_lock_held() ||
				     cgroup_lock_is_held());
}

My thought was that this access was safe due to the fact that we were
in the middle of creating a task, so that no other CPU could access it.
But I am not certain of this, given the fact that this is digging through
cgroup state.

The lockdep splat is here: http://pastebin.ubuntu.com/406131/

Suggestions?

							Thanx, Paul
--
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