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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <dc361d8a262b4872acf750f7c8935a28@AcuMS.aculab.com>
Date:   Fri, 20 Jan 2023 16:58:20 +0000
From:   David Laight <David.Laight@...LAB.COM>
To:     'Peter Zijlstra' <peterz@...radead.org>,
        Hernan Ponce de Leon <hernan.poncedeleon@...weicloud.com>
CC:     "mingo@...hat.com" <mingo@...hat.com>,
        "will@...nel.org" <will@...nel.org>,
        "longman@...hat.com" <longman@...hat.com>,
        "boqun.feng@...il.com" <boqun.feng@...il.com>,
        "akpm@...l.org" <akpm@...l.org>,
        "arjan@...ux.intel.com" <arjan@...ux.intel.com>,
        "tglx@...utronix.de" <tglx@...utronix.de>,
        "joel@...lfernandes.org" <joel@...lfernandes.org>,
        "paulmck@...nel.org" <paulmck@...nel.org>,
        "stern@...land.harvard.edu" <stern@...land.harvard.edu>,
        "diogo.behrens@...wei.com" <diogo.behrens@...wei.com>,
        "jonas.oberhauser@...wei.com" <jonas.oberhauser@...wei.com>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "Hernan Ponce de Leon" <hernanl.leon@...wei.com>,
        "stable@...r.kernel.org" <stable@...r.kernel.org>
Subject: RE: [PATCH] Fix data race in mark_rt_mutex_waiters

From: Peter Zijlstra
> Sent: 20 January 2023 16:23
...
> >  	do {
> > -		owner = *p;
> > +		owner = READ_ONCE(*p);
> >  	} while (cmpxchg_relaxed(p, owner,
> >  				 owner | RT_MUTEX_HAS_WAITERS) != owner);
> >
> 
> Can't we replace the whole of that function with:
> 
> 	set_bit(0, (unsigned long *)&lock->owner);
> 
> ?

If you need the cast then probably not...

There really ought to be a compile-time test (somehow)
that set_bit() is only used on large bit arrays.

OTOH atomic_or32/64() and atomic_and32/64() might use
usable in many places.

On x86 I doubt it makes much difference whether you use
'bis' or 'lock or'.

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ