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:	Thu, 26 Feb 2015 20:29:29 +0100
From:	Oleg Nesterov <oleg@...hat.com>
To:	Manfred Spraul <manfred@...orfullife.com>
Cc:	"Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>,
	LKML <linux-kernel@...r.kernel.org>, 1vier1@....de,
	Peter Zijlstra <peterz@...radead.org>,
	Kirill Tkhai <ktkhai@...allels.com>,
	Ingo Molnar <mingo@...hat.com>,
	Josh Poimboeuf <jpoimboe@...hat.com>
Subject: Re: [RFC PATCH] ipc/sem.c: Add one more memory barrier to
	sem_lock().

Sorry Manfred, I initiated this discussion and then disappeared. Currently
I am buried in the ancient 2.16.18 bugs ;)

On 02/25, Manfred Spraul wrote:
> Hi,
>
> What do you think about the following patch for sem_lock()?
>
> Other options:
>
> 1) I don't like
>
> 	#define smp_mb__after_unlock_wait()	smp_rmb()
>
> 	I think it is too specific: the last block in sem_lock uses
>
> 		if (sma->complex_count == 0) {
> 			smp_rmb();
> 			return;
> 		}

See below.

>
> 2) What about
>
> 	#define smp_aquire__after_control_barrier()	smp_rmb()


I agree with any naming. The only point of the new helper is that we can
factor out the comment, otherwise we would need to repeat it again and again.


> @@ -341,7 +359,13 @@ static inline int sem_lock(struct sem_array *sma, struct sembuf *sops,
>  			 * Thus: if is now 0, then it will stay 0.
>  			 */
>  			if (sma->complex_count == 0) {
> -				/* fast path successful! */
> +				/*
> +				 * Fast path successful!
> +				 * We only need a final memory barrier.
> +				 * (see sem_wait_array() for details).
> +				 */
> +				smp_rmb();
> +

I'll try to read this again tomorrow, but so far I am confused.

Most probably I missed something, but this looks unneeded at first glance.

We already have another smp_rmb() above this check. And it should act as
a "final" barrier, or we can not trust this ->complex_count check ?

And (if I am right) this means that the comment above that rmb() should
be updated. And that is why I think the helper makes sense, the comment
should be almost the same as in sem_wait_array().

If not, could you please spell to explain why do we need another rmb() ?

Oleg.

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