• Hugh Dickins's avatar
    [PATCH] Fix futex hashing bugs · f5ecfe8f
    Hugh Dickins authored
    This fixes two buts that the glibc NPTL verification tests found, one
    new and one old.
    
    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.
    f5ecfe8f
futex.c 13.6 KB