Re: [PATCH] Re: today's futex changes

Stephen Hemminger
2003-09-08T17:05:34Z

On Sat, 6 Sep 2003 17:28:44 +0100 (BST)
Hugh Dickins <hugh@veritas.com> wrote:

> On Fri, 5 Sep 2003, Ulrich Drepper wrote:
> > ... broke NPTL. Tests which worked with previous kernels fail now. One
> > test eventually succeeded, but the process somehow got stuck for about
> > 30-40 seconds. Then it finished. Running strace showed a call to
> > clone() as the last operation but there were other threads running at
> > that time.
> >....
> > What I can offer are statically linked versions of the tests.
> > One is here: http://people.redhat.com/drepper/tst-cond2.bz2
>
> Very helpful, thank you: it showed two bugs, one new and one old.
> Does the patch below work for you, Ulrich?
>
> The new bug is that "offset" has been declared as an alternative in
> the union, instead of as an element in the structures comprising it,
> effectively eliminating it from the key: keys match which should not.
>
> The old bug is that if futex_requeue were called with identical
> key1 and key2 (sensible? tended to happen given the first bug),
> it was liable to loop for a long time holding futex_lock: guard
> against that, still respecting the semantics of futex_requeue.
>
> While here, please let's also fix the get_futex_key VM_NONLINEAR
> case, which was returning the 1 from get_user_pages, taken as an
> error by its callers. And save a few bytes and improve debuggability
> by uninlining the top-level futex_wake, futex_requeue, futex_wait.
>
> Hugh

Everything is working fine for me now.