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:   Tue, 31 Jan 2017 15:26:37 +0100
From:   Peter Zijlstra <peterz@...radead.org>
To:     Waiman Long <longman@...hat.com>
Cc:     Jens Axboe <axboe@...com>, "J. R. Okajima" <hooanon05g@...il.com>,
        linux-kernel@...r.kernel.org, darrick.wong@...cle.com,
        david@...morbit.com, dave@...olabs.net
Subject: Re: Q: lockdep_assert_held_read() after downgrade_write()

On Tue, Jan 31, 2017 at 09:23:08AM -0500, Waiman Long wrote:
> On 01/31/2017 06:25 AM, Peter Zijlstra wrote:
> > @@ -40,8 +40,10 @@ static inline void rwsem_set_reader_owned(struct rw_semaphore *sem)
> >  	 * do a write to the rwsem cacheline when it is really necessary
> >  	 * to minimize cacheline contention.
> >  	 */
> > -	if (sem->owner != RWSEM_READER_OWNED)
> > +	if (sem->owner != RWSEM_READER_OWNED) {
> > +		WARN_ON_ONCE(sem->owner != current);
> >  		WRITE_ONCE(sem->owner, RWSEM_READER_OWNED);
> > +	}
> >  }
> >  
> >  static inline bool rwsem_owner_is_writer(struct task_struct *owner)
> 
> I don't think you can do a WARN_ON_ONCE() check for sem->owner !=
> current here. If the rwsem starts from an unlock state, sem->owner will
> be NULL and an incorrect warning message will be printed.

Argh, I only looked at the downgrade_write() user and forgot to look if
it was used elsewhere.

Powered by blists - more mailing lists