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:   Mon, 23 Jan 2023 21:18:14 -0500
From:   Alan Stern <stern@...land.harvard.edu>
To:     "Paul E. McKenney" <paulmck@...nel.org>
Cc:     Andrea Parri <parri.andrea@...il.com>,
        Jonas Oberhauser <jonas.oberhauser@...wei.com>,
        Peter Zijlstra <peterz@...radead.org>, will <will@...nel.org>,
        "boqun.feng" <boqun.feng@...il.com>, npiggin <npiggin@...il.com>,
        dhowells <dhowells@...hat.com>,
        "j.alglave" <j.alglave@....ac.uk>,
        "luc.maranget" <luc.maranget@...ia.fr>, akiyks <akiyks@...il.com>,
        dlustig <dlustig@...dia.com>, joel <joel@...lfernandes.org>,
        urezki <urezki@...il.com>,
        quic_neeraju <quic_neeraju@...cinc.com>,
        frederic <frederic@...nel.org>,
        Kernel development list <linux-kernel@...r.kernel.org>
Subject: Re: Internal vs. external barriers (was: Re: Interesting LKMM litmus
 test)

On Mon, Jan 23, 2023 at 12:16:59PM -0800, Paul E. McKenney wrote:
> One twist is that the design of both SRCU and RCU are stronger than LKMM
> requires, as illustrated by the litmus test at the end of this email.
> 
> I believe that your proof outline above also covers this case, but I
> figure that I should ask.

This test is full of typos, and I guess that one of them seriously 
affects the meaning, because as far as I can tell the corrected test is 
allowed.

> C C-srcu-observed-2
> 
> (*
>  * Result: Sometimes
>  *
>  * But please note that the Linux-kernel SRCU implementation is designed
>  * to provide Never.
>  *)
> 
> {}
> 
> P0(int *x, int *y, int *z, struct srcu_struct *s)
> {
> 	int r1;
> 	int r2;

r2 is never used.

> 
> 	r1 = srcu_read_lock(s);
> 	WRITE_ONCE(*y, 1);
> 	WRITE_ONCE(*x, 1);
> 	srcu_read_unlock(s, r3);

There is no r3; this should be r1.

> }
> 
> P1(int *x, int *y, int *z, struct srcu_struct *s)
> {
> 	int r1;
> 	int r2;

r2 is never used.

> 
> 	r1 = READ_ONCE(*y);
> 	synchronize_srcu(s);
> 	WRITE_ONCE(*z, 1);
> }
> 
> P2(int *x, int *y, int *z, struct srcu_struct *s)
> {
> 	int r1;

r1 is never used; it should be r2.

> 
> 	WRITE_ONCE(*z, 2);
> 	smp_mb();
> 	r2 = READ_ONCE(*x);
> }
> 
> exists (1:r1=1 /\ 1:r2=0 /\ z=1)

1:r2 is never used.  Apparently this should 2:r2.

Given those changes, the test can run as follows: P2 runs to completion, 
writing z=2 and reading x=0.  Then P0 runs to completion, writing y=1 
and x=1.  Then P1 runs to completion, reading y=1 and overwriting z=1.

Alan

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ