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:   Fri, 15 Jul 2022 14:27:28 +0200
From:   Paul Heidekrüger <Paul.Heidekrueger@...tum.de>
To:     Alan Stern <stern@...land.harvard.edu>
Cc:     clang-built-linux <llvm@...ts.linux.dev>,
        linux-toolchains@...r.kernel.org,
        Andrea Parri <parri.andrea@...il.com>,
        Will Deacon <will@...nel.org>,
        Peter Zijlstra <peterz@...radead.org>,
        Boqun Feng <boqun.feng@...il.com>,
        Nicholas Piggin <npiggin@...il.com>,
        David Howells <dhowells@...hat.com>,
        Jade Alglave <j.alglave@....ac.uk>,
        Luc Maranget <luc.maranget@...ia.fr>,
        "Paul E. McKenney" <paulmck@...nel.org>,
        Akira Yokosawa <akiyks@...il.com>,
        Daniel Lustig <dlustig@...dia.com>,
        Joel Fernandes <joel@...lfernandes.org>,
        Nathan Chancellor <nathan@...nel.org>,
        Nick Desaulniers <ndesaulniers@...gle.com>,
        Tom Rix <trix@...hat.com>, Palmer Dabbelt <palmer@...belt.com>,
        LKML <linux-kernel@...r.kernel.org>,
        linux-arch <linux-arch@...r.kernel.org>,
        Marco Elver <elver@...gle.com>,
        Charalampos Mainas <charalampos.mainas@...il.com>,
        Pramod Bhatotia <pramod.bhatotia@...tum.de>,
        Soham Chakraborty <s.s.chakraborty@...elft.nl>,
        Martin Fink <martin.fink@...tum.de>
Subject: Re: [PATCH RFC] tools/memory-model: Adjust ctrl dependency definition

Alan Stern <stern@...land.harvard.edu> wrote:

> On Mon, Jun 27, 2022 at 11:47:43AM +0200, Paul Heidekrüger wrote:
>>> On 21. Jun 2022, at 16:24, Alan Stern <stern@...land.harvard.edu> wrote:
>>> 
>>> On Tue, Jun 21, 2022 at 01:59:27PM +0200, Paul Heidekrüger wrote:
>>>> OK. So, LKMM limits the scope of control dependencies to its arm(s), hence
>>>> there is a control dependency from the last READ_ONCE() before the loop
>>>> exists to the WRITE_ONCE().
>>>> 
>>>> But then what about the following:
>>>> 
>>>>> int *x, *y;
>>>>> 
>>>>> int foo()
>>>>> {
>>>>> 	/* More code */
>>>>> 
>>>>> 	if(READ_ONCE(x))
>>>>> 		return 42;
>>>>> 
>>>>> 	/* More code */
>>>>> 
>>>>> 	WRITE_ONCE(y, 42);
>>>>> 
>>>>> 	/* More code */
>>>>> 
>>>>> 	return 0;
>>>>> }
>>>> 
>>>> The READ_ONCE() determines whether the WRITE_ONCE() will be executed at all,
>>>> but the WRITE_ONCE() doesn't lie in the if condition's arm.
>>> 
>>> So in this case the LKMM would not recognize that there's a control 
>>> dependency, even though it clearly exists.
>> 
>> Oh, that's unfortunate.
>> 
>> Then I would still argue that the "at all" definition is misleading. This
> 
> I agree, and I would welcome a patch improving the definition. Perhaps 
> something along the lines of what I wrote earlier in this email thread.

I have just been thinking about how to word this patch; am I correct in
assuming that the LKMM does not deal with loop conditions? Or in other
words, there is no way for a loop condition to impose a ctrl dependency on
any WRITE_ONCE's in the loop body? It are only if and switch statements the
LKMM is concerned with in the case of ctrl dependencies?

Many thanks,
Paul

>> time in the other direction as I had initially proposed though, as the above
>> example is a case where "at all" holds true, but LKMM doesn't cover it. Or
>> do you think that caveating this in litmus-tests.txt, e.g. via the patch we
>> had recently worked out [1], is enough?
> 
> No, the explanation should be improved.
> 
> Alan


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ