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]
Date:	Thu, 8 Dec 2011 00:34:50 +0400
From:	Cyrill Gorcunov <gorcunov@...il.com>
To:	Oleg Nesterov <oleg@...hat.com>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Pavel Emelyanov <xemul@...allels.com>,
	Serge Hallyn <serge.hallyn@...onical.com>,
	KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com>,
	Tejun Heo <tj@...nel.org>,
	Vasiliy Kulikov <segoon@...nwall.com>,
	Andrew Vagin <avagin@...nvz.org>,
	LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] fs, proc: Introduce the /proc/<pid>/children entry v2

On Wed, Dec 07, 2011 at 11:19:16PM +0400, Cyrill Gorcunov wrote:
...
> > > 
> > > This looks "obviously wrong".
> > > 
> > > We can not trust ->children->next after rcu_read_unlock(). Another
> > > rcu_read_lock() can't help.
> > > 
> > > Once again, I can be easily wrong, need to read the patch first.
> > > 
> > 
> > Wait, Oleg, I might be wrong as well, but it's now as
> > 
> > children_seq_open
> >  get_proc_task (so ref to task increased)
> > 
> > the children_seq_start/children_seq_stop works
> > in iteration and every new iteration seq_list_next
> > walks over the whole children list from the list
> > head under rcu lock, so even if task is removed
> > or added the link should exsist until rcu is unlocked
> > and sync'ed no?
> > 
> 
> On the other hands some if (task) tests are redundant
> and might be dropped since we have a reference to a
> task until seq-file is not released. I'll update it
> and shrink a patch some more.
> 

So while adding new task to a list is not a problem (the reader
will simply not notice it) removing task from a list is a bit
tricky, but as far as I see switch_task_namespaces (from exit_notify)
uses synchronize_rcu as well as release_task calls for call_rcu
for put_task_struct) so I think we will not get any wrong dereference
in

static int children_seq_show(struct seq_file *seq, void *v)
{
	struct task_struct *task = container_of(v, struct task_struct, sibling);
	return seq_printf(seq, " %lu", (unsigned long)pid_vnr(task_pid(task)));
}

while we're in rcu reader section. I might be wrong of course, so
please verify this claim.

	Cyrill
--
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