From mboxrd@z Thu Jan 1 00:00:00 1970 Received: with ECARTIS (v1.0.0; list linux-mips); Thu, 22 Jun 2017 05:54:17 +0200 (CEST) Received: from bombadil.infradead.org ([65.50.211.133]:60832 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by eddie.linux-mips.org with ESMTP id S23991111AbdFVDyIc6dP0 (ORCPT ); Thu, 22 Jun 2017 05:54:08 +0200 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=b05FC68tubOZn95RCJNLkD2h2DMt0SqBIzgdXq6zJ60=; b=TakSec7YKcm35aTQWkjREqxwu YoK+JVYXCVeVCNgYo1Y4jr/mwaz5a2zFgBggLnrRlC6hqUOZEFNGzzCiVbtRugsJfT+R2n/o+ahQL bOlsBtHmJm3L5wP3kkI2NQiYxfss983jWnTMOqyTq0pyXoUog+l+aOMRrryaYmX9VhnLBFjM00iyk DAUXo42Rtgy6xWdR6cf81o1iSJRiSZkgzgwqrL2fvuyn1jguqblpYFjaIg+mWWtTNCOASxK+JDBuD k/1aSMtznUMj5ZacMEPC8U1vecoA8hnbISYh/Z6ZI7cwkShq4b1kQMDIY5TwgYA08xAKVAOk2/HOx uZLyDQ1/Q==; Received: from dvhart by bombadil.infradead.org with local (Exim 4.87 #1 (Red Hat Linux)) id 1dNtBb-0006Dy-65; Thu, 22 Jun 2017 03:53:39 +0000 Date: Wed, 21 Jun 2017 20:53:37 -0700 From: Darren Hart To: Jiri Slaby Cc: tglx@linutronix.de, mingo@redhat.com, peterz@infradead.org, linux-kernel@vger.kernel.org, Richard Henderson , Ivan Kokshaysky , Matt Turner , Vineet Gupta , Catalin Marinas , Will Deacon , Richard Kuo , Tony Luck , Fenghua Yu , Michal Simek , Ralf Baechle , Jonas Bonn , Stefan Kristiansson , Stafford Horne , "James E.J. Bottomley" , Helge Deller , Benjamin Herrenschmidt , Paul Mackerras , Martin Schwidefsky , Yoshinori Sato , Rich Felker , "David S. Miller" , "H. Peter Anvin" , Chris Zankel , Max Filippov , Arnd Bergmann , x86@kernel.org, linux-alpha@vger.kernel.org, linux-snps-arc@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-hexagon@vger.kernel.org, linux-ia64@vger.kernel.org, linux-mips@linux-mips.org, openrisc@lists.librecores.org, linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-xtensa@linux-xtensa.org, linux-arch@vger.kernel.org Subject: Re: [PATCH 1/1] futex: remove duplicated code and fix UB Message-ID: <20170622035337.GF25900@fury> References: <20170621115318.2781-1-jslaby@suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170621115318.2781-1-jslaby@suse.cz> User-Agent: Mutt/1.8.0 (2017-02-23) Return-Path: X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0) X-Orcpt: rfc822;linux-mips@linux-mips.org Original-Recipient: rfc822;linux-mips@linux-mips.org X-archive-position: 58739 X-ecartis-version: Ecartis v1.0.0 Sender: linux-mips-bounce@linux-mips.org Errors-to: linux-mips-bounce@linux-mips.org X-original-sender: dvhart@infradead.org Precedence: bulk List-help: List-unsubscribe: List-software: Ecartis version 1.0.0 List-Id: linux-mips X-List-ID: linux-mips List-subscribe: List-owner: List-post: List-archive: X-list: linux-mips 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