]> Git Repo - linux.git/commit
futex: Remove duplicated code and fix undefined behaviour
authorJiri Slaby <[email protected]>
Thu, 24 Aug 2017 07:31:05 +0000 (09:31 +0200)
committerThomas Gleixner <[email protected]>
Fri, 25 Aug 2017 20:49:59 +0000 (22:49 +0200)
commit30d6e0a4190d37740e9447e4e4815f06992dd8c3
treeee09f230f291d519765211ba247f16b1634b52f5
parentca110694c6950dfd7bc864138c80fe39ea43da5b
futex: Remove duplicated code and fix undefined behaviour

There is code duplicated over all architecture's headers for
futex_atomic_op_inuser. Namely op decoding, access_ok check for uaddr,
and comparison of the result.

Remove this duplication and leave up to the arches only the needed
assembly which is now in arch_futex_atomic_op_inuser.

This effectively distributes the Will Deacon's arm64 fix for undefined
behaviour reported by UBSAN to all architectures. The fix was done in
commit 5f16a046f8e1 (arm64: futex: Fix undefined behaviour with
FUTEX_OP_OPARG_SHIFT usage). Look there for an example dump.

And as suggested by Thomas, check for negative oparg too, because it was
also reported to cause undefined behaviour report.

Note that s390 removed access_ok check in d12a29703 ("s390/uaccess:
remove pointless access_ok() checks") as access_ok there returns true.
We introduce it back to the helper for the sake of simplicity (it gets
optimized away anyway).

Signed-off-by: Jiri Slaby <[email protected]>
Signed-off-by: Thomas Gleixner <[email protected]>
Acked-by: Russell King <[email protected]>
Acked-by: Michael Ellerman <[email protected]> (powerpc)
Acked-by: Heiko Carstens <[email protected]> [s390]
Acked-by: Chris Metcalf <[email protected]> [for tile]
Reviewed-by: Darren Hart (VMware) <[email protected]>
Reviewed-by: Will Deacon <[email protected]> [core/arm64]
Cc: [email protected]
Cc: Rich Felker <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: Benjamin Herrenschmidt <[email protected]>
Cc: Max Filippov <[email protected]>
Cc: Paul Mackerras <[email protected]>
Cc: [email protected]
Cc: Jonas Bonn <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: Yoshinori Sato <[email protected]>
Cc: [email protected]
Cc: Helge Deller <[email protected]>
Cc: "James E.J. Bottomley" <[email protected]>
Cc: Catalin Marinas <[email protected]>
Cc: Matt Turner <[email protected]>
Cc: [email protected]
Cc: Fenghua Yu <[email protected]>
Cc: Arnd Bergmann <[email protected]>
Cc: [email protected]
Cc: Stefan Kristiansson <[email protected]>
Cc: [email protected]
Cc: Ivan Kokshaysky <[email protected]>
Cc: Stafford Horne <[email protected]>
Cc: [email protected]
Cc: Richard Henderson <[email protected]>
Cc: Chris Zankel <[email protected]>
Cc: Michal Simek <[email protected]>
Cc: Tony Luck <[email protected]>
Cc: [email protected]
Cc: Vineet Gupta <[email protected]>
Cc: Ralf Baechle <[email protected]>
Cc: Richard Kuo <[email protected]>
Cc: [email protected]
Cc: Martin Schwidefsky <[email protected]>
Cc: [email protected]
Cc: "David S. Miller" <[email protected]>
Link: http://lkml.kernel.org/r/[email protected]
21 files changed:
arch/alpha/include/asm/futex.h
arch/arc/include/asm/futex.h
arch/arm/include/asm/futex.h
arch/arm64/include/asm/futex.h
arch/frv/include/asm/futex.h
arch/frv/kernel/futex.c
arch/hexagon/include/asm/futex.h
arch/ia64/include/asm/futex.h
arch/microblaze/include/asm/futex.h
arch/mips/include/asm/futex.h
arch/openrisc/include/asm/futex.h
arch/parisc/include/asm/futex.h
arch/powerpc/include/asm/futex.h
arch/s390/include/asm/futex.h
arch/sh/include/asm/futex.h
arch/sparc/include/asm/futex_64.h
arch/tile/include/asm/futex.h
arch/x86/include/asm/futex.h
arch/xtensa/include/asm/futex.h
include/asm-generic/futex.h
kernel/futex.c
This page took 0.084309 seconds and 4 git commands to generate.