Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp2672512pxb; Mon, 19 Apr 2021 10:55:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJywUFx5gYl1cLmU4DUkX0Vwur/Tdrn3VE3pKKbLjnss/8wC1AqF7a+wiMHYXoP3q4WnITaT X-Received: by 2002:a17:902:f254:b029:eb:6a57:9d11 with SMTP id j20-20020a170902f254b02900eb6a579d11mr24291965plc.81.1618854930790; Mon, 19 Apr 2021 10:55:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618854930; cv=none; d=google.com; s=arc-20160816; b=SRyPuDf+kmzxG4Gg6y1Pl+HTWAUflHpkHTJdmBinZoh4d/LSXX5HEaLhh0i+fJ3l7q IswKy/fjVJkJM1AQ8/+88jFiXUShiE32nfbqN8qEIULTL80Vd+vR9h8pctyXNLaluzmE g5iRoeY7U2MjKNP+G5S0JThxaU0YucYA5eK3xKuhV3T+HdXK+Wf0L5y/jimHdgFoVw2S 51DW4UPulxFjEWWeH53X+AXTMTOx6z39aegdSsiXtQUiT3dpgJviuXzTF7CDYkWquDTt Z8vL5FAMmyUdpDbUYgR/3cMwiZ+ymrDPFwjYT5dMM8S96Bf1D2w061aYEzB1YmO4i0Pc 1utw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=i9Bq7tDCjScgDdIhM/gCstlOF7TFZfzCfFdPSn0vFrE=; b=yMxikLJkqz+T4ylJctUNf7prn94vAbnzasgKzVhGe1xlj1BqxKBC7yuh5A3brEZZhh 2soZMyCEDQq2PvZPkYm14B6MPMLREoO7zyxzMqgHcXnpsaN5xLuUSRqOsjcMR7aBarn4 XL6bzy0kFWftXR6EivjF/B2QfWj2Tl5qdlRApCIOpUwPrM2pl8kUXST3npaDiZWwkaid QNtgPdj0LCzXevEHcvCEVni5nZJbRiPdsNEvlkIOWseHX+4jqZY17IAbHovwTiLkuAXS BW434H+lkZsGOJzYbU6VztN9p0kmDaOab45VrUe9ejOJAicgESrrOqDKLvUvCOIrX7Dp +zMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=mDpOe4aG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 3si16443333pfh.268.2021.04.19.10.55.18; Mon, 19 Apr 2021 10:55:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=mDpOe4aG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242334AbhDSN1b (ORCPT + 99 others); Mon, 19 Apr 2021 09:27:31 -0400 Received: from mail.kernel.org ([198.145.29.99]:56334 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241019AbhDSNTq (ORCPT ); Mon, 19 Apr 2021 09:19:46 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 02B85613E9; Mon, 19 Apr 2021 13:15:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1618838124; bh=46JedHWo30ypvYrPVxpZd3sFM7/UwPdy0xbk1KlwYCo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mDpOe4aG+IsftMpWcIHYngKLbvVwh4w8rquv0lzrOq4s5StnnUcC4mqeIhl4SJNMv 6ojMDRwqF+MdCfRcRI5wwcMLsXFYxk65ML4qaLbX1wCIeylGo4Nmi6S65ZFfbZggjl PxJ5/gvdr865GZ69ZdAZXTjgQk8+Sm7gJriNeJq0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Peter Collingbourne , Will Deacon Subject: [PATCH 5.10 052/103] arm64: fix inline asm in load_unaligned_zeropad() Date: Mon, 19 Apr 2021 15:06:03 +0200 Message-Id: <20210419130529.602217419@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210419130527.791982064@linuxfoundation.org> References: <20210419130527.791982064@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Peter Collingbourne commit 185f2e5f51c2029efd9dd26cceb968a44fe053c6 upstream. The inline asm's addr operand is marked as input-only, however in the case where an exception is taken it may be modified by the BIC instruction on the exception path. Fix the problem by using a temporary register as the destination register for the BIC instruction. Signed-off-by: Peter Collingbourne Cc: stable@vger.kernel.org Link: https://linux-review.googlesource.com/id/I84538c8a2307d567b4f45bb20b715451005f9617 Link: https://lore.kernel.org/r/20210401165110.3952103-1-pcc@google.com Signed-off-by: Will Deacon Signed-off-by: Greg Kroah-Hartman --- arch/arm64/include/asm/word-at-a-time.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) --- a/arch/arm64/include/asm/word-at-a-time.h +++ b/arch/arm64/include/asm/word-at-a-time.h @@ -53,7 +53,7 @@ static inline unsigned long find_zero(un */ static inline unsigned long load_unaligned_zeropad(const void *addr) { - unsigned long ret, offset; + unsigned long ret, tmp; /* Load word from unaligned pointer addr */ asm( @@ -61,9 +61,9 @@ static inline unsigned long load_unalign "2:\n" " .pushsection .fixup,\"ax\"\n" " .align 2\n" - "3: and %1, %2, #0x7\n" - " bic %2, %2, #0x7\n" - " ldr %0, [%2]\n" + "3: bic %1, %2, #0x7\n" + " ldr %0, [%1]\n" + " and %1, %2, #0x7\n" " lsl %1, %1, #0x3\n" #ifndef __AARCH64EB__ " lsr %0, %0, %1\n" @@ -73,7 +73,7 @@ static inline unsigned long load_unalign " b 2b\n" " .popsection\n" _ASM_EXTABLE(1b, 3b) - : "=&r" (ret), "=&r" (offset) + : "=&r" (ret), "=&r" (tmp) : "r" (addr), "Q" (*(unsigned long *)addr)); return ret;