On Thu, Mar 28, 2019 at 1:47 PM Linus Torvalds
<torva...@linux-foundation.org> wrote:
>
> On Thu, Mar 28, 2019 at 11:12 AM Waiman Long <long...@redhat.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

Reply via email to