• T
    futex: Deobfuscate handle_futex_death() · 6e0aa9f8
    Thomas Gleixner 提交于
    handle_futex_death() uses futex_atomic_cmpxchg_inatomic() without
    disabling page faults. That's ok, but totally non obvious.
    
    We don't hold locks so we actually can and want to fault here, because
    the get_user() before futex_atomic_cmpxchg_inatomic() does not
    guarantee a R/W mapping.
    
    We could just add a big fat comment to explain this, but actually
    changing the code so that the functionality is entirely clear is
    better.
    
    Use the helper function which disables page faults around the
    futex_atomic_cmpxchg_inatomic() and handle a fault with a call to
    fault_in_user_writeable() as all other places in the futex code do as
    well.
    Pointed-out-by: NLinus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
    Acked-by: NDarren Hart <darren@dvhart.com>
    Cc: Michel Lespinasse <walken@google.com>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Matt Turner <mattst88@gmail.com>
    Cc: Russell King <linux@arm.linux.org.uk>
    Cc: David Howells <dhowells@redhat.com>
    Cc: Tony Luck <tony.luck@intel.com>
    Cc: Michal Simek <monstr@monstr.eu>
    Cc: Ralf Baechle <ralf@linux-mips.org>
    Cc: "James E.J. Bottomley" <jejb@parisc-linux.org>
    Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
    Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
    Cc: Paul Mundt <lethal@linux-sh.org>
    Cc: "David S. Miller" <davem@davemloft.net>
    Cc: Chris Metcalf <cmetcalf@tilera.com>
    LKML-Reference: <alpine.LFD.2.00.1103141126590.2787@localhost6.localdomain6>
    Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
    6e0aa9f8
futex.c 69.3 KB