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: <CA+55aFySqSVh+WsAbpYQcE4r87z7BXm1wuZpobYxVjVWsWULsQ@mail.gmail.com>
Date:   Tue, 22 May 2018 14:31:42 -0700
From:   Linus Torvalds <torvalds@...ux-foundation.org>
To:     Peter Zijlstra <peterz@...radead.org>
Cc:     psodagud@...eaurora.org, Kees Cook <keescook@...omium.org>,
        Andy Lutomirski <luto@...capital.net>,
        Will Drewry <wad@...omium.org>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Rik van Riel <riel@...hat.com>,
        Thomas Gleixner <tglx@...utronix.de>,
        Ingo Molnar <mingo@...nel.org>,
        Eric Biggers <ebiggers@...gle.com>,
        Frederic Weisbecker <fweisbec@...il.com>, sherryy@...roid.com,
        Vegard Nossum <vegard.nossum@...cle.com>,
        Christoph Lameter <cl@...ux.com>,
        Andrea Arcangeli <aarcange@...hat.com>,
        Sasha Levin <alexander.levin@...izon.com>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: write_lock_irq(&tasklist_lock)

On Tue, May 22, 2018 at 2:17 PM Peter Zijlstra <peterz@...radead.org> wrote:

> qrwlock is a fair lock and should not exhibit writer starvation.

We actually have a special rule to make it *not* be fair, in that
interrupts are allowed to take the read lock if there are readers - even if
there are waiting writers.

I'm not sure how much of an fairness effect this has, but it's required
because of our rule that you can take it for reading without disabling
interrupts.

See

      void queued_read_lock_slowpath(struct qrwlock *lock)

in kernel/locking/qrwlock.c.

> You basically want to spin-wait with interrupts enabled, right?

That was the intent of my (untested) pseudo-code. It should work fine. Note
that I used write_trylock() only, so there is no queueing (which also
implies no fairness).

I'm not saying it's a _good_ idea.  I'm saying it might work if all you
worry about is the irq-disabled part.

                 Linus

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ