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] [day] [month] [year] [list]
Message-ID: <Pine.LNX.4.64.0703191633030.3733@alien.or.mcafeemobile.com>
Date:	Mon, 19 Mar 2007 16:34:18 -0700 (PDT)
From:	Davide Libenzi <davidel@...ilserver.org>
To:	Oleg Nesterov <oleg@...sign.ru>
cc:	"Eric W. Biederman" <ebiederm@...ssion.com>,
	Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Linus Torvalds <torvalds@...ux-foundation.org>
Subject: Re: [patch 2/13] signal/timer/event fds v6 - signalfd core ...

On Tue, 20 Mar 2007, Oleg Nesterov wrote:

> On 03/20, Oleg Nesterov wrote:
> >
> > On 03/19, Davide Libenzi wrote:
> > >
> > > I'd need a get_task_struct in any case in order to safely call 
> > > unlock_task_sighand(). At that point I'd prefer to just pass through the 
> > > struct pid*. I'll be posting the new version for review as soon as I 
> > > complete a few tests ...
> > 
> > If signalfd_get_sighand()->lock_task_sighand() succeeds, it is safe to
> > dereference ctx->tsk. The task can't be freed and ctx->tsk can't be cleared
> > while we are holding siglock.
> > 
> > However, I was wrong, we still need a re-check after lock_task_sighand().
> > We should check ctx->tsk != NULL.
> 
> IOW, we can (afaics) do
> 
> 	static struct sighand_struct *signalfd_get_sighand(struct signalfd_ctx *ctx,
> 							   unsigned long *flags)
> 	{
> 		struct sighand_struct *sighand = NULL;
> 		struct tsak_struct *tsk;
> 
> 		rcu_read_lock();
> 		tsk = rcu_dereference(ctx->tsk);  // not needed, just a documentation
> 		if (tsk != NULL)
> 			sighand = lock_task_sighand(tsk, flags);
> 		rcu_read_unlock();
> 
> 		if (sighand && !ctx->tsk)) {
> 			unlock_task_sighand(tsk, flags);
> 			sighand = NULL;
> 		}
> 
> 		return sighand;
> 	}
> 
> If signalfd_get_sighand() succeeds, ctx->tsk is pinned.

I did a similar thing, but I renamed the locking functions and its 
parameters. After looking at what the pid thing was doing, I realized that 
it was not really needed.



- Davide


-
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