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:	Tue, 8 Dec 2009 19:37:58 +0100
From:	Oleg Nesterov <oleg@...hat.com>
To:	Peter Zijlstra <peterz@...radead.org>
Cc:	Alexey Dobriyan <adobriyan@...il.com>,
	Ananth Mavinakayanahalli <ananth@...ibm.com>,
	Christoph Hellwig <hch@...radead.org>,
	"Frank Ch. Eigler" <fche@...hat.com>, Ingo Molnar <mingo@...e.hu>,
	Roland McGrath <roland@...hat.com>,
	linux-kernel@...r.kernel.org, utrace-devel@...hat.com
Subject: Re: [RFC,PATCH 14/14] utrace core

On 12/08, Peter Zijlstra wrote:
>
> On Tue, 2009-12-08 at 17:31 +0100, Oleg Nesterov wrote:
>
> > > If you take a task ref you can write the much saner:
> > >
> > > utrace_control()
> > > {
> > >   ...
> > >   spin_lock(&utrace->lock);
> > >   ...
> > >   if (reset)
> > >     utrace_reset(utrace);
> > >
> > >   spin_unlock(&utrace->lock);
> > > }
> >
> > No, get_task_struct() in utrace_reset() can't help, we should move
> > it into utrace_control() then. And in this case it becomes even more
> > subtle: it is needed because ->utrace_flags may be cleared inside
> > utrace_reset() and after that utrace_control()->spin_unlock() becomes
> > unsafe.
>
> The task->utrace pointer is cleaned up on
> free_task()->tracehook_free_task()->utrace_free_task(), so by holding a
> ref on the task, we ensure ->utrace stays around, and we can do
> spin_unlock(), right?

Yes. That is why utrace_control() (which does unlock) should take the ref,
not utrace_reset().

> > Also. utrace_reset() drops utrace->lock to call put_detached_list()
> > lockless. If we want to avoid the assymetric locking, every caller
> > should pass "struct list_head *detached" to utrace_reset(), drop
> > utrace->lock, and call put_detached_list().
>
> All that seems to do is call ->release() and kmem_cache_free()s the
> utrace_engine thing, why can't that be done with utrace->lock held?

We can, but then ->release() will be called in atomic context. Utrace
tries hard to not "restrict" the module writers.

> But yeah, passing that list along does seem like a better solution.

Well, it has multiple callers, everyone will be complicated.

Oleg.

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