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] [day] [month] [year] [list]
Message-ID: <20190514120404.GQ2589@hirez.programming.kicks-ass.net>
Date:   Tue, 14 May 2019 14:04:04 +0200
From:   Peter Zijlstra <peterz@...radead.org>
To:     Yuyang Du <duyuyang@...il.com>
Cc:     will.deacon@....com, Ingo Molnar <mingo@...nel.org>,
        Bart Van Assche <bvanassche@....org>, ming.lei@...hat.com,
        Frederic Weisbecker <frederic@...nel.org>, tglx@...utronix.de,
        Boqun Feng <boqun.feng@...il.com>,
        LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 01/17] locking/lockdep: Add lock type enum to explicitly
 specify read or write locks

On Tue, May 14, 2019 at 09:31:48AM +0800, Yuyang Du wrote:
> Thanks for review.
> 
> On Mon, 13 May 2019 at 19:45, Peter Zijlstra <peterz@...radead.org> wrote:
> >
> > On Mon, May 13, 2019 at 05:11:47PM +0800, Yuyang Du wrote:
> > > + * Note that we have an assumption that a lock class cannot ever be both
> > > + * read and recursive-read.
> >
> > We have such locks in the kernel... see:
> >
> >   kernel/qrwlock.c:queued_read_lock_slowpath()
> >
> > And yes, that is somewhat unfortunate, but hard to get rid of due to
> > hysterical raisins.
> 
> That is ok, then LOCK_TYPE_RECURSIVE has to be 3 such that
> LOCK_TYPE_RECURSIVE & LOCK_TYPE_READ != 0. I thought to do this in the
> first place without assuming. Anyway, it is better to know.
> 
> And I guess in a task:
> 
> (1) read(X);
>     recursive_read(x);      /* this is ok ? */

Correct, that is the use-case for that 'funny' construct.

> (2) recursive_read(x);
>     read(x)      /* not ok ? */

Indeed, read can block due to a pending writer, while recurise_read will
not suffer like that.

> Either way, very small change may need to be made.

OK, excellent.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ