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.02.1405141448210.6261@ionos.tec.linutronix.de>
Date:	Wed, 14 May 2014 14:59:12 +0200 (CEST)
From:	Thomas Gleixner <tglx@...utronix.de>
To:	Lai Jiangshan <laijs@...fujitsu.com>
cc:	LKML <linux-kernel@...r.kernel.org>, Dave Jones <davej@...hat.com>,
	Linus Torvalds <torvalds@...ux-foundation.org>,
	Peter Zijlstra <peterz@...radead.org>,
	Darren Hart <darren@...art.com>,
	Davidlohr Bueso <davidlohr@...com>,
	Ingo Molnar <mingo@...nel.org>,
	Steven Rostedt <rostedt@...dmis.org>,
	Clark Williams <williams@...hat.com>,
	Paul McKenney <paulmck@...ux.vnet.ibm.com>,
	Roland McGrath <roland@...k.frob.com>,
	Carlos ODonell <carlos@...hat.com>,
	Jakub Jelinek <jakub@...hat.com>,
	Michael Kerrisk <mtk.manpages@...il.com>,
	Sebastian Andrzej Siewior <bigeasy@...utronix.de>
Subject: Re: [patch 1/3] rtmutex: Add missing deadlock check

On Tue, 13 May 2014, Lai Jiangshan wrote:

> Hi, Thomas,
> 
> I think this patch is just a workaround, it is not the proper fix.
> you need a updated deadlock-check mechanism:
> 
> - (old) skip the check when top_waiter != task_top_pi_waiter(task)
> + (new) skip the check when top_waiter->prio > task->prio

I don't think that helps. 
 
> >  	/*
> > +	 * Deadlock check for the following scenario:
> > +	 *
> > +	 * T holds lock L and has waiters
> > +	 * T locks L again, but does not end up as it's own top waiter
> 
> ABBA problem (TA TB TC TD are of the same priority)
> 
> TA holds lock LA, and try to lock LB which TC already has waited on
> TB holds lock LB, and try to lock LA which TD already has waited on
> 
> I think this check can't detect it IIUC.

Right it doesn't.
 
> 	/*
> 	 * Drop out, when the task has no waiters. Note,
> 	 * top_waiter can be NULL, when we are in the deboosting
> 	 * mode!
> 	 */
> 	if (top_waiter && (!task_has_pi_waiters(task) ||
> 			   top_waiter != task_top_pi_waiter(task)))
> 		goto out_unlock_pi;

So the issue here is, that we break out of the chain walk even if
deadlock detection is enabled.

The break out is correct for the boost case w/o deadlock detection, so
we won't do any pointless work.

For the deadlock detection case, we need to continue. But we should
store, that we are not the top_waiter so we can avoid the requeue
business when walking the chain.

Thanks,

	tglx




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