From mboxrd@z Thu Jan 1 00:00:00 1970 From: Darren Hart Date: Thu, 22 Jun 2017 03:53:37 +0000 Subject: Re: [PATCH 1/1] futex: remove duplicated code and fix UB Message-Id: <20170622035337.GF25900@fury> List-Id: References: <20170621115318.2781-1-jslaby@suse.cz> In-Reply-To: <20170621115318.2781-1-jslaby@suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Jiri Slaby Cc: linux-mips@linux-mips.org, Rich Felker , linux-ia64@vger.kernel.org, linux-sh@vger.kernel.org, peterz@infradead.org, Benjamin Herrenschmidt , Will Deacon , Max Filippov , Paul Mackerras , "H. Peter Anvin" , sparclinux@vger.kernel.org, tglx@linutronix.de, Jonas Bonn , linux-s390@vger.kernel.org, linux-arch@vger.kernel.org, Yoshinori Sato , linux-hexagon@vger.kernel.org, Helge Deller , x86@kernel.org, "James E.J. Bottomley" , mingo@redhat.com, Catalin Marinas , Matt Turner , linux-snps-arc@lists.infradead.org, Fenghua Yu , Arnd Bergmann , linux-xtensa@linux-xtensa.org, Stefan Kristiansson 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) -- Darren Hart VMware Open Source Technology Center