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:	Wed, 29 Nov 2006 17:10:38 +0100
From:	Sébastien Dugué <sebastien.dugue@...l.net>
To:	Christoph Hellwig <hch@...radead.org>
Cc:	linux-kernel <linux-kernel@...r.kernel.org>,
	linux-aio <linux-aio@...ck.org>, Andrew Morton <akpm@...l.org>,
	Suparna Bhattacharya <suparna@...ibm.com>,
	Christoph Hellwig <hch@...radead.org>,
	Zach Brown <zach.brown@...cle.com>,
	Badari Pulavarty <pbadari@...ibm.com>,
	Ulrich Drepper <drepper@...hat.com>,
	Jean Pierre Dion <jean-pierre.dion@...l.net>
Subject: Re: [PATCH -mm 3/5][AIO] - export good_sigevent()

On Wed, 29 Nov 2006 14:54:25 +0000, Christoph Hellwig <hch@...radead.org> wrote:

> > +/***
> > + * good_sigevent - check and get target task from a sigevent.
> > + * @event: the sigevent to be checked
> > + *
> > + * This function must be called with tasklist_lock held for reading.
> > + */
> > +struct task_struct * good_sigevent(sigevent_t * event)
> > +{
> > +	struct task_struct *rtn = current->group_leader;
> > +
> > +	if ((event->sigev_notify & SIGEV_THREAD_ID ) &&
> > +		(!(rtn = find_task_by_pid(event->sigev_notify_thread_id)) ||
> > +		 rtn->tgid != current->tgid ||
> > +		 (event->sigev_notify & ~SIGEV_THREAD_ID) != SIGEV_SIGNAL))
> > +		return NULL;
> > +
> > +	if (((event->sigev_notify & ~SIGEV_THREAD_ID) != SIGEV_NONE) &&
> > +	    ((event->sigev_signo <= 0) || (event->sigev_signo > SIGRTMAX)))
> > +		return NULL;
> > +
> > +	return rtn;
> > +}
> 
> And while we're at it we should badly beat up the person that wrote this
> mess in the first time.

  Agreed.

>  To be somewhat readable it should look like:
> 
> static struct task_struct *good_sigevent(sigevent_t *event)
> {
> 	struct task_struct *task = current->group_leader;
> 
> 	if ((event->sigev_notify & ~SIGEV_THREAD_ID) != SIGEV_NONE) {
> 		if (event->sigev_signo <= 0 || event->sigev_signo > SIGRTMAX)
> 			return NULL;
> 	}
> 
> 	if (event->sigev_notify & SIGEV_THREAD_ID) {
> 		if ((event->sigev_notify & ~SIGEV_THREAD_ID) != SIGEV_SIGNAL)
> 			return NULL;
> 		task = find_task_by_pid(event->sigev_notify_thread_id);
> 		if (!task || task->tgid != current->tgid)
> 			return NULL;
> 	}
> 
> 	return task;
> }

  Yes, will incorporate this.

> 
> And btw, looking at its currentl caller I see why we need the PF_EXITING
> flag I recommended to remove easiler on, it even has a big comment that
> we should copy & paste to aio.c aswell.

  Well, I do not take the siglock anymore, so I don't think the comment
really applies here.

>  Still no idea why it's doing
> the selectiv reference grabbing, though.
-
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