Thread (6 messages) 6 messages, 4 authors, 2017-07-03

Re: [PATCH 1/1] futex: remove duplicated code and fix UB

From: Darren Hart <dvhart@infradead.org>
Date: 2017-06-22 03:54:04
Also in: linux-alpha, linux-arch, linux-arm-kernel, linux-mips, linux-s390, linux-sh, lkml, sparclinux

On Wed, Jun 21, 2017 at 01:53:18PM +0200, Jiri Slaby wrote:
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.

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).
This required a minor manual merge for ARM on the tip of Linus' tree today. The
reduced duplication is a welcome improvement.

Reviewed-by: Darren Hart (VMware) <dvhart@infradead.org>

-- 
Darren Hart
VMware Open Source Technology Center
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help