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: <20140603084735.GO11096@twins.programming.kicks-ass.net>
Date:	Tue, 3 Jun 2014 10:47:35 +0200
From:	Peter Zijlstra <peterz@...radead.org>
To:	Steven Rostedt <rostedt@...dmis.org>
Cc:	Sasha Levin <sasha.levin@...cle.com>, Jan Kara <jack@...e.cz>,
	"linux-mm@...ck.org" <linux-mm@...ck.org>,
	Andrew Morton <akpm@...ux-foundation.org>,
	LKML <linux-kernel@...r.kernel.org>,
	Dave Jones <davej@...hat.com>, Ingo Molnar <mingo@...nel.org>
Subject: Re: mm,console: circular dependency between console_sem and zone lock

On Mon, Jun 02, 2014 at 09:55:29PM -0400, Steven Rostedt wrote:
> Hmm, it failed on a try lock, but on the spinlock within the trylock. I
> wonder if we should add this.
> 
> Peter?
> 
> -- Steve
> 
> diff --git a/kernel/locking/semaphore.c b/kernel/locking/semaphore.c
> index 6815171..6579f84 100644
> --- a/kernel/locking/semaphore.c
> +++ b/kernel/locking/semaphore.c
> @@ -132,7 +132,9 @@ int down_trylock(struct semaphore *sem)
>  	unsigned long flags;
>  	int count;
>  
> -	raw_spin_lock_irqsave(&sem->lock, flags);
> +	if (!raw_spin_trylock_irqsave(&sem->lock, flags))
> +		return 1;
> +
>  	count = sem->count - 1;
>  	if (likely(count >= 0))
>  		sem->count = count;

I prefer not to, there is no reason the down_trylock() will fail if that
spinlock is contended. We might have just hit the release in progress.

But let me stare at the original problem..

Content of type "application/pgp-signature" skipped

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ