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: Wed, 29 May 2024 14:37:30 +0200
From: Jonas Oberhauser <jonas.oberhauser@...weicloud.com>
To: Boqun Feng <boqun.feng@...il.com>
Cc: Andrea Parri <parri.andrea@...il.com>,
 Hernan Ponce de Leon <hernan.poncedeleon@...weicloud.com>,
 stern@...land.harvard.edu, will@...nel.org, peterz@...radead.org,
 npiggin@...il.com, dhowells@...hat.com, j.alglave@....ac.uk,
 luc.maranget@...ia.fr, paulmck@...nel.org, akiyks@...il.com,
 dlustig@...dia.com, joel@...lfernandes.org, linux-kernel@...r.kernel.org,
 linux-arch@...r.kernel.org
Subject: Re: [PATCH] tools/memory-model: Document herd7 (internal)
 representation



Am 5/28/2024 um 7:58 PM schrieb Boqun Feng:
> On Mon, May 27, 2024 at 03:40:13PM +0200, Jonas Oberhauser wrote:
>>
>>
>> Am 5/27/2024 um 3:28 PM schrieb Andrea Parri:
>>>>> +    |                smp_store_mb | W[once] ->po F[mb]                        |
>>>>
>>>> I expect this one to be hard-coded in herd7 source code, but I cannot find
>>>> it. Can you give me a pointer?
>>>
>>> smp_store_mb() is currently mapped to { __store{once}(X,V); __fence{mb}; } in
>>> the .def file, so it's semantically equivalent to "WRITE_ONCE(); smp_mb();".
>>
>> By the way, I experimented a little with these kind of mappings to see if we
>> can just explicitly encode the mapping there. E.g., I had an idea to use
>>      { __fence{mb-successful-rmw}; __cmpxchg{once}...;
>> __fence{mb-successful-rmw}; }
>>
>> for defining (almost) the current mapping of cmpxchg explicitly.
>>
>> But none of the changes I made were accepted by herd7.
>>
>> Do you know how the syntax works?
>>
> 
> This may not be trivial. Note that cmpxchg() is an expression (it has a
> value), so in .def, we want to define it as an expression. However, the
> C-like multiple-statement expression is not supported by herd parser, in
> other words we want:
> 
> 	{
> 		__fence{mb-successful-rmw};
> 		int tmp = __cmpxchg{once}(...);
> 		__fence{mb-successful-rmw};
> 		tmp;
> 	}

Oh, you're right. Then probably the rule I was violating is that 
value-returning macros can not be defined with {} at all.

Given herd's other syntactic limitations, perhaps the best way would be 
to introduce these macros as

	x = cmpxchg(...) {
		__fence{mb-successful-rmw};
  		x = __cmpxchg{once}(...);
  		__fence{mb-successful-rmw};
	}

since I think x = M(...) is the only way we are allowed to use these 
macros anyways.


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ