From mboxrd@z Thu Jan 1 00:00:00 1970 From: Darren Hart Subject: Re: [PATCH 1/1] futex: remove duplicated code and fix UB Date: Wed, 21 Jun 2017 20:53:37 -0700 Message-ID: <20170622035337.GF25900@fury> References: <20170621115318.2781-1-jslaby@suse.cz> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ypKb0x41ANWfrfCRuR+/20TNk9hZPKlr8geJdc2pE0E=; b=jWRp537qzlZNvI 7qegdw9q4dAoJrnwgPYBta8GwWBCV1a648ByG7Sf3QKmzKvjs6Rp2HvucyfaBbMkRBIbYHK3+UFkW VSBWAVPYf43j+lGzLGI1cOf9DxHtqghsiKlZuiNIwyxkUoYYdZY7qUYBIQTiO9rMrutHK9zAuRIno 5aCBOZaX7xaWY0mIUM+pe3DmkWSsT/J3/6Wb1QdyyUBhnl2TesXV6HK5IuyNeqGvFgWB8OpYMbKZb oWpvIBXy8mIaXwcoiuSgWTNT8YAdOxV3aRvY6a36lN2ITOJMruSIDQK7ZJ205Y+3ZhqHFdHmukrGP L+f36C6qjEBI2oG7uPJQ==; Content-Disposition: inline In-Reply-To: <20170621115318.2781-1-jslaby@suse.cz> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-snps-arc" Errors-To: linux-snps-arc-bounces+gla-linux-snps-arc=m.gmane.org@lists.infradead.org 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