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: <alpine.DEB.2.10.1406101948490.5170@nanos>
Date:	Tue, 10 Jun 2014 19:51:11 +0200 (CEST)
From:	Thomas Gleixner <tglx@...utronix.de>
To:	Oleg Nesterov <oleg@...hat.com>
cc:	Steven Rostedt <rostedt@...dmis.org>,
	Linus Torvalds <torvalds@...ux-foundation.org>,
	"Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>,
	LKML <linux-kernel@...r.kernel.org>,
	Peter Zijlstra <peterz@...radead.org>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Ingo Molnar <mingo@...nel.org>,
	Clark Williams <williams@...hat.com>
Subject: Re: safety of *mutex_unlock() (Was: [BUG] signal: sighand unprotected
 when accessed by /proc)

On Tue, 10 Jun 2014, Oleg Nesterov wrote:

> On 06/10, Thomas Gleixner wrote:
> >
> > +static inline bool unlock_rt_mutex_safe(struct rt_mutex *lock)
> > +	__releases(lock->wait_lock)
> > +{
> > +	unsigned long owner, *p = (unsigned long *) &lock->owner;
> > +
> > +	owner = (unsigned long) rt_mutex_owner(lock);
> > +	clear_rt_mutex_waiters(lock);
> > +	raw_spin_unlock(&lock->wait_lock);
> > +	/*
> > +	 * If a new waiter comes in between the unlock and the cmpxchg
> > +	 * we have two situations:
> > +	 *
> > +	 * unlock(wait_lock);
> > +	 *					lock(wait_lock);
> > +	 * cmpxchg(p, owner, 0) == owner
> > +	 *					mark_rt_mutex_waiters(lock);
> > +	 *					acquire(lock);
> > +	 * or:
> > +	 *
> > +	 * unlock(wait_lock);
> > +	 *					lock(wait_lock);
> > +	 *					mark_rt_mutex_waiters(lock);
> > +	 *
> > +	 * cmpxchg(p, owner, 0) != owner
> > +	 *					enqueue_waiter();
> > +	 *					unlock(wait_lock);
> > +	 * lock(wait_lock);
> > +	 * wake waiter();
> > +	 * unlock(wait_lock);
> > +	 *					lock(wait_lock);
> > +	 *					acquire(lock);
> > +	 */
> > +	return rt_mutex_cmpxchg(p, owner, 0);
> 
> Wait, but this looks like a typo. rt_mutex_cmpxchg() needs "struct rt_mutex *",
> not "long *". It seems that you should simply kill "*p" above.

Uurgh. I had cmpxchg there first and then changed it. You're right, I
can kill the p magic. Bah, thats what you get sending out stuff just
before jumping into a car.



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