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: <ZBrDeoCIs1wmNBeF@andrea>
Date:   Wed, 22 Mar 2023 09:59:38 +0100
From:   Andrea Parri <parri.andrea@...il.com>
To:     "Paul E. McKenney" <paulmck@...nel.org>
Cc:     linux-kernel@...r.kernel.org, linux-arch@...r.kernel.org,
        kernel-team@...a.com, mingo@...nel.org, stern@...land.harvard.edu,
        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
Subject: Re: [PATCH memory-model scripts 01/31] tools/memory-model:  Document
 locking corner cases

>  create mode 100644 Documentation/litmus-tests/locking/DCL-broken.litmus
>  create mode 100644 Documentation/litmus-tests/locking/DCL-fixed.litmus
>  create mode 100644 Documentation/litmus-tests/locking/RM-broken.litmus
>  create mode 100644 Documentation/litmus-tests/locking/RM-fixed.litmus

Unfortunately none of them were liked by klitmus7/gcc, the diff below
works for me but please double check.

  Andrea


diff --git a/Documentation/litmus-tests/locking/DCL-broken.litmus b/Documentation/litmus-tests/locking/DCL-broken.litmus
index cfaa25ff82b1e..bfb7ba4316d69 100644
--- a/Documentation/litmus-tests/locking/DCL-broken.litmus
+++ b/Documentation/litmus-tests/locking/DCL-broken.litmus
@@ -10,10 +10,9 @@ C DCL-broken
 {
 	int flag;
 	int data;
-	int lck;
 }
 
-P0(int *flag, int *data, int *lck)
+P0(int *flag, int *data, spinlock_t *lck)
 {
 	int r0;
 	int r1;
@@ -32,7 +31,7 @@ P0(int *flag, int *data, int *lck)
 	r2 = READ_ONCE(*data);
 }
 
-P1(int *flag, int *data, int *lck)
+P1(int *flag, int *data, spinlock_t *lck)
 {
 	int r0;
 	int r1;
@@ -51,5 +50,5 @@ P1(int *flag, int *data, int *lck)
 	r2 = READ_ONCE(*data);
 }
 
-locations [flag;data;lck;0:r0;0:r1;1:r0;1:r1]
+locations [flag;data;0:r0;0:r1;1:r0;1:r1]
 exists (0:r2=0 \/ 1:r2=0)
diff --git a/Documentation/litmus-tests/locking/DCL-fixed.litmus b/Documentation/litmus-tests/locking/DCL-fixed.litmus
index 579d6c246f167..d1b60bcb0c8f3 100644
--- a/Documentation/litmus-tests/locking/DCL-fixed.litmus
+++ b/Documentation/litmus-tests/locking/DCL-fixed.litmus
@@ -11,10 +11,9 @@ C DCL-fixed
 {
 	int flag;
 	int data;
-	int lck;
 }
 
-P0(int *flag, int *data, int *lck)
+P0(int *flag, int *data, spinlock_t *lck)
 {
 	int r0;
 	int r1;
@@ -33,7 +32,7 @@ P0(int *flag, int *data, int *lck)
 	r2 = READ_ONCE(*data);
 }
 
-P1(int *flag, int *data, int *lck)
+P1(int *flag, int *data, spinlock_t *lck)
 {
 	int r0;
 	int r1;
@@ -52,5 +51,5 @@ P1(int *flag, int *data, int *lck)
 	r2 = READ_ONCE(*data);
 }
 
-locations [flag;data;lck;0:r0;0:r1;1:r0;1:r1]
+locations [flag;data;0:r0;0:r1;1:r0;1:r1]
 exists (0:r2=0 \/ 1:r2=0)
diff --git a/Documentation/litmus-tests/locking/RM-broken.litmus b/Documentation/litmus-tests/locking/RM-broken.litmus
index c586ae4b547de..b7ef30cedfe51 100644
--- a/Documentation/litmus-tests/locking/RM-broken.litmus
+++ b/Documentation/litmus-tests/locking/RM-broken.litmus
@@ -9,12 +9,11 @@ C RM-broken
  *)
 
 {
-	int lck;
 	int x;
-	int y;
+	atomic_t y;
 }
 
-P0(int *x, int *y, int *lck)
+P0(int *x, atomic_t *y, spinlock_t *lck)
 {
 	int r2;
 
@@ -24,7 +23,7 @@ P0(int *x, int *y, int *lck)
 	spin_unlock(lck);
 }
 
-P1(int *x, int *y, int *lck)
+P1(int *x, atomic_t *y, spinlock_t *lck)
 {
 	int r0;
 	int r1;
@@ -37,6 +36,6 @@ P1(int *x, int *y, int *lck)
 	spin_unlock(lck);
 }
 
-locations [x;lck;0:r2;1:r0;1:r1;1:r2]
-filter (y=2 /\ 1:r0=0 /\ 1:r1=1)
+locations [x;0:r2;1:r0;1:r1;1:r2]
+filter (1:r0=0 /\ 1:r1=1)
 exists (1:r2=1)
diff --git a/Documentation/litmus-tests/locking/RM-fixed.litmus b/Documentation/litmus-tests/locking/RM-fixed.litmus
index 672856736b42e..b628175596160 100644
--- a/Documentation/litmus-tests/locking/RM-fixed.litmus
+++ b/Documentation/litmus-tests/locking/RM-fixed.litmus
@@ -9,12 +9,11 @@ C RM-fixed
  *)
 
 {
-	int lck;
 	int x;
-	int y;
+	atomic_t y;
 }
 
-P0(int *x, int *y, int *lck)
+P0(int *x, atomic_t *y, spinlock_t *lck)
 {
 	int r2;
 
@@ -24,7 +23,7 @@ P0(int *x, int *y, int *lck)
 	spin_unlock(lck);
 }
 
-P1(int *x, int *y, int *lck)
+P1(int *x, atomic_t *y, spinlock_t *lck)
 {
 	int r0;
 	int r1;
@@ -37,6 +36,6 @@ P1(int *x, int *y, int *lck)
 	spin_unlock(lck);
 }
 
-locations [x;lck;0:r2;1:r0;1:r1;1:r2]
-filter (y=2 /\ 1:r0=0 /\ 1:r1=1)
+locations [x;0:r2;1:r0;1:r1;1:r2]
+filter (1:r0=0 /\ 1:r1=1)
 exists (1:r2=1)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ