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: <20201004231313.GO29330@paulmck-ThinkPad-P72>
Date:   Sun, 4 Oct 2020 16:13:13 -0700
From:   "Paul E. McKenney" <paulmck@...nel.org>
To:     joel@...lfernandes.org
Cc:     Alan Stern <stern@...land.harvard.edu>, 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,
        viro@...iv.linux.org.uk, linux-kernel@...r.kernel.org,
        linux-arch@...r.kernel.org
Subject: Re: Litmus test for question from Al Viro

On Sat, Oct 03, 2020 at 12:11:59PM -0400, joel@...lfernandes.org wrote:
> On Sat, Oct 03, 2020 at 12:08:46PM -0400, joel@...lfernandes.org wrote:
> [...] 
> > static void code0(struct v_struct* v,spinlock_t* l,int* out_0_r1) {
> > 
> >         struct v_struct *r1; /* to_free */
> > 
> >         r1 = NULL;
> >         spin_lock(l);
> >         if (!smp_load_acquire(&v->b))
> >                 r1 = v;
> >         v->a = 0;
> >         spin_unlock(l);
> > 
> >   *out_0_r1 = !!r1;
> > }
> > 
> > static void code1(struct v_struct* v,spinlock_t* l,int* out_1_r1) {
> > 
> >         struct v_struct *r1; /* to_free */
> > 
> >         r1 = v;
> >         if (READ_ONCE(v->a)) {
> >                 spin_lock(l);
> >                 if (v->a)
> >                         r1 = NULL;
> >                 smp_store_release(&v->b, 0);
> >                 spin_unlock(l);
> >         }
> > 
> >   *out_1_r1 = !!r1;
> > }
> > 
> > Results on both arm64 and x86:
> > 
> >     Histogram (2 states)
> >     19080852:>0:r1=1; 1:r1=0;
> >     20919148:>0:r1=0; 1:r1=1;
> >     No
> >     
> >     Witnesses
> >     Positive: 0, Negative: 40000000
> >     Condition exists (0:r1=1 /\ 1:r1=1) is NOT validated
> >     Hash=4a8c15603ffb5ab464195ea39ccd6382
> >     Observation AL+test Never 0 40000000
> >     Time AL+test 6.24
> > 
> > I guess I could do an alloc and free of v_struct. However, I just checked for
> > whether the to_free in Al's example could ever be NULL for both threads.
> 
> Sorry, here I meant "ever be non-NULL".
> 
> So basically I was trying to experimentally confirm that to_free could never
> be non-NULL in both code0 and code1 threads.

Thank you for running these!  In conjunction with Alan's analysis,
this seems quite convincing.  ;-)

							Thanx, Paul

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ