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: <42f31a6a-2f99-46fa-9fac-c3ad5174399a@rowland.harvard.edu>
Date: Mon, 27 May 2024 12:04:10 -0400
From: Alan Stern <stern@...land.harvard.edu>
To: Jonas Oberhauser <jonas.oberhauser@...weicloud.com>
Cc: paulmck@...nel.org, parri.andrea@...il.com, will@...nel.org,
  peterz@...radead.org, boqun.feng@...il.com, npiggin@...il.com,
  dhowells@...hat.com, j.alglave@....ac.uk, luc.maranget@...ia.fr,
  akiyks@...il.com, dlustig@...dia.com, joel@...lfernandes.org,
  urezki@...il.com, quic_neeraju@...cinc.com, frederic@...nel.org,
  linux-kernel@...r.kernel.org, Viktor Vafeiadis <viktor@...-sws.org>
Subject: Re: [RFC][PATCH 3/4] tools/memory-model: Define effect of Mb tags on
 RMWs in tools/...

On Mon, May 27, 2024 at 05:22:52PM +0200, Jonas Oberhauser wrote:
> Herd7 transforms successful RMW with Mb tags by inserting smp_mb() fences
> around them. We emulate this by considering imaginary po-edges before the
> RMW read and before the RMW write, and extending the smp_mb() ordering
> rule, which currently only applies to real po edges that would be found
> around a really inserted smp_mb(), also to cases of the only imagined po
> edges.
> 
> Reported-by: Viktor Vafeiadis <viktor@...-sws.org>
> Suggested-by: Alan Stern <stern@...land.harvard.edu>
> Signed-off-by: Jonas Oberhauser <jonas.oberhauser@...weicloud.com>
> ---
>  tools/memory-model/linux-kernel.cat | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/tools/memory-model/linux-kernel.cat b/tools/memory-model/linux-kernel.cat
> index adf3c4f41229..3a6e9677abe4 100644
> --- a/tools/memory-model/linux-kernel.cat
> +++ b/tools/memory-model/linux-kernel.cat
> @@ -34,6 +34,15 @@ let R4rmb = R \ Noreturn	(* Reads for which rmb works *)
>  let rmb = [R4rmb] ; fencerel(Rmb) ; [R4rmb]
>  let wmb = [W] ; fencerel(Wmb) ; [W]
>  let mb = ([M] ; fencerel(Mb) ; [M]) |
> +	(* full-barrier RMWs (successful cmpxchg(), xchg(), etc.) act as
> +	 * though there were enclosed by smp_mb().
> +	 * The effect of these virtual smp_mb() is formalized by adding
> +	 * Mb tags to the read and write of the operation, and providing
> +	 * the same ordering as though there were additional po edges
> +	 * between the Mb tag and the read resp. write.
> +	 *)

This file's style calls for multiline comments to start with "(*" on a 
line by themselves.

> +	([M] ; po ; [Mb] ; (* po ; *) [R]) |
> +	([W] ; (* po ; *) [Mb] ; po ; [M]) |

Can't these be written as:

	([M] ; po ; [Mb & R]) |
	([Mb & W] ; po ; [M]) |

?  I think this would be easier to understand, even though it doesn't 
correspond as directly to the comment.

Alan

>  	([M] ; fencerel(Before-atomic) ; [RMW] ; po? ; [M]) |
>  	([M] ; po? ; [RMW] ; fencerel(After-atomic) ; [M]) |
>  	([M] ; po? ; [LKW] ; fencerel(After-spinlock) ; [M]) |
> -- 
> 2.34.1
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ