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: <e597a6c6-49de-302c-b09d-9a9085ebb394@redhat.com>
Date:   Thu, 28 Mar 2019 17:03:30 -0400
From:   Waiman Long <longman@...hat.com>
To:     Linus Torvalds <torvalds@...ux-foundation.org>
Cc:     Peter Zijlstra <peterz@...radead.org>,
        Ingo Molnar <mingo@...hat.com>,
        Will Deacon <will.deacon@....com>,
        Thomas Gleixner <tglx@...utronix.de>,
        Linux List Kernel Mailing <linux-kernel@...r.kernel.org>,
        the arch/x86 maintainers <x86@...nel.org>,
        Davidlohr Bueso <dave@...olabs.net>,
        Tim Chen <tim.c.chen@...ux.intel.com>
Subject: Re: [PATCH 12/12] locking/rwsem: Make MSbit of count as guard bit to
 fail readlock

On 03/28/2019 04:56 PM, Linus Torvalds wrote:
> On Thu, Mar 28, 2019 at 1:47 PM Linus Torvalds
> <torvalds@...ux-foundation.org> wrote:
>> On Thu, Mar 28, 2019 at 11:12 AM Waiman Long <longman@...hat.com> wrote:
>>> With the merging of owner into count for x86-64, there is only 16 bits
>>> left for reader count. It is theoretically possible for an application to
>>> cause more than 64k readers to acquire a rwsem leading to count overflow.
>> Ahh, and here's the thing that makes 16 bits work for readers.
> Hmm. Does it?
>
> Isn't there a race here? We're adding the READ bias, and then noticing
> that it his the guard bit, and then the down_read_failed will make it
> all good again.
>
> But this isn't actually done with preemption disabled, so things
> *could* get preempted in between, and if we have a huge run of bad
> luck, it can still overflow.
>
> Ok, so you need to have a 32k series run of bad luck (and hit
> *exactly* the right small preemption point window every time), and I'm
> certainly willing to say "yeah, not an issue", but maybe it's still
> worth at least documenting?
>
>                   Linus

I think it is theoretically possible that this can happen, but I doubt
we will ever see that. Will document that possibility in the comment.

Thanks,
Longman

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ