Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp5430137imb; Thu, 7 Mar 2019 15:51:13 -0800 (PST) X-Google-Smtp-Source: APXvYqzzHV633zcq8GQMQ64FfGvge7VKxLvPOs35octwacGki7NVW30Ca78+ZdWshLRqKGBpq4sy X-Received: by 2002:aa7:854d:: with SMTP id y13mr15336286pfn.175.1552002673630; Thu, 07 Mar 2019 15:51:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1552002673; cv=none; d=google.com; s=arc-20160816; b=vN71bzYpCCdg09Jy3m3NBex68DzLBBnN7kXIokBOhkoAJ9G1Ko0O6qqdL/2xdesuw1 Cv6aqSAIexViD5KC3oCqRH28M/tXC+W++iDmcWvSYoy3rT8qqVdW5BRifUrBZqY3NoPy UK2PP8QtBVCr+M/J8jsgZEEi5JsnaC02tP04mjcYWmUPQtDKYnPerh87jnyMLk3417Bj gaIrNJRsBbBS5kPTmhEMPAfddlccPt1uNQ3W50k3jHVgOnTrPVk4WxOz6XpjJT+z6Dtm i0scYMpOhXduxlUZ0E2DyTRakyjjOiuhaYHNX0Zl1Vh5RShhceJbsbPsN7BhvVgxWug1 jyvA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=fNN6eajNaTJ8SgJrVM+PEBr9uc/iJQPWs0J51MBsxeQ=; b=GmrNsdKXPJYVA5cjFszjURrT9EKbqDfVo+kRYwUoldW1Eq6IPXKNcYDByerjAgFZr3 Q3o28HE9AyR9+pafJS9cS4XPvqsVkZSPLzwAYnyNMTQ4OVF0noldVgyUcxL105J5fuRd Hp58rKeE5s71Md66Gpk7LYHXwzG0Q6KaFY6qO9G/7saDyB+kZ/gQSs0+T5zlviuBqOK6 xLF57RiY7LBcoKlzX1uUmQOh5SQCQe7P84YbaBwoBBP3ZN7P7BY6edCIiqJwevv5l23m nxr9YxqTQ8HIen3uc9EEHk/8Z09rtKxTyWFoE79tE0639TIMWCFciJaOVBmrKPa4TnuB 6a6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=zZnOTmnt; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 61si4978870plb.162.2019.03.07.15.50.57; Thu, 07 Mar 2019 15:51:13 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=zZnOTmnt; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726340AbfCGXtT (ORCPT + 99 others); Thu, 7 Mar 2019 18:49:19 -0500 Received: from pandora.armlinux.org.uk ([78.32.30.218]:55154 "EHLO pandora.armlinux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726313AbfCGXtS (ORCPT ); Thu, 7 Mar 2019 18:49:18 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date: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=fNN6eajNaTJ8SgJrVM+PEBr9uc/iJQPWs0J51MBsxeQ=; b=zZnOTmnt8jCCtjK0oroO2JFZr L2Hv8eLwSi2K+nfg+xSTnV7hmtoy867ijmIhE5/zOnWtc3iINHroM6qek69Eu8yOi1ud6ejLNcCuy ho81ETKFworqh+3YpdspGNyfiVl65InYkWr8rFDQSjaw0kZAQ+eDxJ9M5d63gHNxFdF0cSFEWROIW 0yAbIR51rzaAsaHKvWBYtDVS623wvYt3uiKR6A5QNtEmmnSmTB3d2b9qZcvRAYXNj+7l/M2gb35Qa hwi7BG+dIXClTWQxq76ZC+nV8rJFbq9C+FU7gdVV2YPvv6wAKkuJhfxnwGgDcRz8R7DP070Id9x6V 92BKPfTaA==; Received: from shell.armlinux.org.uk ([2001:4d48:ad52:3201:5054:ff:fe00:4ec]:55006) by pandora.armlinux.org.uk with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) (envelope-from ) id 1h22l3-0000RU-2X; Thu, 07 Mar 2019 23:49:01 +0000 Received: from linux by shell.armlinux.org.uk with local (Exim 4.89) (envelope-from ) id 1h22ks-0005Hh-Ty; Thu, 07 Mar 2019 23:48:50 +0000 Date: Thu, 7 Mar 2019 23:48:50 +0000 From: Russell King - ARM Linux admin To: Nick Desaulniers Cc: Arnd Bergmann , Thomas Gleixner , Ingo Molnar , Peter Zijlstra , Darren Hart , Mikael Pettersson , Mikael Pettersson , Dave Martin , Linux ARM , LKML Subject: Re: [PATCH 2/2] ARM: futex: make futex_detect_cmpxchg more reliable Message-ID: <20190307234850.nsbpkfcit3lnmytu@shell.armlinux.org.uk> References: <20190307091514.2489338-1-arnd@arndb.de> <20190307091514.2489338-2-arnd@arndb.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Mar 07, 2019 at 11:39:08AM -0800, Nick Desaulniers wrote: > On Thu, Mar 7, 2019 at 1:15 AM Arnd Bergmann wrote: > > > > Passing registers containing zero as both the address (NULL pointer) > > and data into cmpxchg_futex_value_locked() leads clang to assign > > the same register for both inputs on ARM, which triggers a warning > > explaining that this instruction has unpredictable behavior on ARMv5. > > > > /tmp/futex-7e740e.s: Assembler messages: > > /tmp/futex-7e740e.s:12713: Warning: source register same as write-back base > > > > This patch was suggested by Mikael Pettersson back in 2011 (!) with gcc-4.4, > > as Mikael wrote: > > "One way of fixing this is to make uaddr an input/output register, since > > "that prevents it from overlapping any other input or output." > > > > but then withdrawn as the warning was determined to be harmless, and it > > apparently never showed up again with later gcc versions. > > > > Now the same problem is back when compiling with clang, and we are trying > > to get clang to build the kernel without warnings, as gcc normally does. > > > > Cc: Mikael Pettersson > > Cc: Mikael Pettersson > > Cc: Dave Martin > > Link: https://lore.kernel.org/linux-arm-kernel/20009.45690.158286.161591@pilspetsen.it.uu.se/ > > Signed-off-by: Arnd Bergmann > > --- > > arch/arm/include/asm/futex.h | 10 +++++----- > > 1 file changed, 5 insertions(+), 5 deletions(-) > > > > diff --git a/arch/arm/include/asm/futex.h b/arch/arm/include/asm/futex.h > > index 0a46676b4245..79790912974e 100644 > > --- a/arch/arm/include/asm/futex.h > > +++ b/arch/arm/include/asm/futex.h > > @@ -110,13 +110,13 @@ futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr, > > preempt_disable(); > > __ua_flags = uaccess_save_and_enable(); > > __asm__ __volatile__("@futex_atomic_cmpxchg_inatomic\n" > > - "1: " TUSER(ldr) " %1, [%4]\n" > > - " teq %1, %2\n" > > + "1: " TUSER(ldr) " %1, [%2]\n" > > + " teq %1, %3\n" > > " it eq @ explicit IT needed for the 2b label\n" > > - "2: " TUSER(streq) " %3, [%4]\n" > > + "2: " TUSER(streq) " %4, [%2]\n" > > __futex_atomic_ex_table("%5") > > - : "+r" (ret), "=&r" (val) > > - : "r" (oldval), "r" (newval), "r" (uaddr), "Ir" (-EFAULT) > > + : "+&r" (ret), "=&r" (val), "+&r" (uaddr) > > + : "r" (oldval), "r" (newval), "Ir" (-EFAULT) > > : "cc", "memory"); > > uaccess_restore(__ua_flags); > > Underspecification of constraints to extended inline assembly is a > common issue exposed by other compilers (and possibly but in-effect > infrequently compiler upgrades). > So the reordering of the constraints means the in the assembly (notes > for other reviewers): > %2 -> %3 > %3 -> %4 > %4 -> %2 > Yep, looks good to me, thanks for finding this old patch and resending, Arnd! I don't see what is "underspecified" in the original constraints. Please explain. -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTC broadband for 0.8mile line in suburbia: sync at 12.1Mbps down 622kbps up According to speedtest.net: 11.9Mbps down 500kbps up