From patchwork Wed Apr 14 00:08:04 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nathan Chancellor X-Patchwork-Id: 12201613 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-22.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D0696C433ED for ; Wed, 14 Apr 2021 00:11:37 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4D1B661242 for ; Wed, 14 Apr 2021 00:11:37 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4D1B661242 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=zMcNFHMwNOEHlwEh1irYtq1lHD91SH8CdUAeWwQvvBI=; b=RJc8mHWhzaysBCSIDAaBLWKGuw /riMVy2mApsIuFvxhxCMOMvGomuoriBFqNETRk9zo8TT81Y+2N6aizFasIkyO1cTWsgBXnAJEJHeP PoE6oI5co70KVyLvcAKv9Y3JQR7WQuHVnafX2qdxO8mv1yRBx91+G/XTf00e/7zPVsukPg4kJLVBW P7t33mfcjYm8VxskXN0NHIOSsuly2OtCI8UoQpKT4blAiWlCyPIEbZTAHN5QJf4bSD+CFlSpOfTYr kyfMwRPf1CEiKZD9cHmTTaJ7YOvT+0sAOs5O6SnseQqcDJoZmIoysbEpgfI+NYVahaqPB6lDCfPj3 txLAM4og==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lWT5q-00Atpj-RL; Wed, 14 Apr 2021 00:09:19 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lWT5n-00AtpR-10 for linux-arm-kernel@desiato.infradead.org; Wed, 14 Apr 2021 00:09:15 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type: Content-ID:Content-Description:In-Reply-To:References; bh=Upb4341ZORb4RTJqTk9tC5tC/k82McZHffrXUXtGl4s=; b=YSZMHScCBtIwbRyngNbCc5oxF3 vhPs8qVARXO18q/o5bcvoqNSEtpKvniNRXLCCoIoi+ndi/df25zPfspIBUIw3UsMyn9ONd+AUuGHs xl2BVNNZXh5Pr+YuVFYphTyVDLeady2vfLUtr219JZ0xAcd5ZHvUJFQnh5bFw4ry3iXPDyr2y2V8x mS4CttUeXj5A+bVMzDQ/ty3QZvgrSPSzS4trjjesyTTbErfBHgApFqDh/Y9oBf1G200DjHbUt8J5V Xu6p20cVky8XtxYPU+p6MEGDdcvKOqwTg5yZGnaCTnkbg58qiqygzFgF0f2wYE+U3lrR86xzKksmx 9W7dtTXw==; Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lWT5k-007Ofj-An for linux-arm-kernel@lists.infradead.org; Wed, 14 Apr 2021 00:09:13 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id DBEFD61246; Wed, 14 Apr 2021 00:09:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1618358951; bh=SGCsWnJBFU+PxLaU3qadL12J+jaWNLTDyWNJnKddMuc=; h=From:To:Cc:Subject:Date:From; b=JQWxh+Jv8A+tHVoORVEKiKYEGfSjDj7APbD58NkbftuWe1MQqhlRmP/IbE0iccbQ1 lYUy7OS684VJX6qxq1LqiFiveFCZThNcNa88D/CcNphXPlAX3LovLn0xpQDDJp8V1c 7YQDeS50IkM3fxJfZ5vF8fJvu7fs86rL9A4rantLO4FLc/E83n4zD1feiKvxO5ozFv 6t2LIr8pPTOpefrbj/9aGIbOmbHt1SbIHgMJamS0/iPX4bfBfarrx5aZKoljGjPMQl +qTsO7LCvMqynuO+a3pRpMJzBtxLwsAlGvPJfzrAALPyHwad+xdct3aQtiR7Bsmyen IKI14eVl/DqSw== From: Nathan Chancellor To: Catalin Marinas , Will Deacon Cc: Nick Desaulniers , Sami Tolvanen , Jian Cai , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com, Nathan Chancellor , stable@vger.kernel.org Subject: [PATCH] arm64: alternatives: Move length validation in alternative_{insn, endif} Date: Tue, 13 Apr 2021 17:08:04 -0700 Message-Id: <20210414000803.662534-1-nathan@kernel.org> X-Mailer: git-send-email 2.31.1.272.g89b43f80a5 MIME-Version: 1.0 X-Patchwork-Bot: notify X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210413_170912_416405_ABB37B80 X-CRM114-Status: GOOD ( 11.65 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org After commit 2decad92f473 ("arm64: mte: Ensure TIF_MTE_ASYNC_FAULT is set atomically"), LLVM's integrated assembler fails to build entry.S: :5:7: error: expected assembly-time absolute expression .org . - (664b-663b) + (662b-661b) ^ :6:7: error: expected assembly-time absolute expression .org . - (662b-661b) + (664b-663b) ^ The root cause is LLVM's assembler has a one-pass design, meaning it cannot figure out these instruction lengths when the .org directive is outside of the subsection that they are in, which was changed by the .arch_extension directive added in the above commit. Apply the same fix from commit 966a0acce2fc ("arm64/alternatives: move length validation inside the subsection") to the alternative_endif macro, shuffling the .org directives so that the length validation happen will always happen in the same subsections. alternative_insn has not shown any issue yet but it appears that it could have the same issue in the future so just preemptively change it. Cc: stable@vger.kernel.org Fixes: f7b93d42945c ("arm64/alternatives: use subsections for replacement sequences") Link: https://github.com/ClangBuiltLinux/linux/issues/1347 Signed-off-by: Nathan Chancellor Reviewed-by: Sami Tolvanen Tested-by: Sami Tolvanen Reviewed-by: Nick Desaulniers Tested-by: Nick Desaulniers --- Apologies if my explanation or terminology is off, I am only now getting more familiar with assembly. arch/arm64/include/asm/alternative-macros.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) base-commit: 738fa58ee1328481d1d7889e7c430b3401c571b9 diff --git a/arch/arm64/include/asm/alternative-macros.h b/arch/arm64/include/asm/alternative-macros.h index 5df500dcc627..8a078fc662ac 100644 --- a/arch/arm64/include/asm/alternative-macros.h +++ b/arch/arm64/include/asm/alternative-macros.h @@ -97,9 +97,9 @@ .popsection .subsection 1 663: \insn2 -664: .previous - .org . - (664b-663b) + (662b-661b) +664: .org . - (664b-663b) + (662b-661b) .org . - (662b-661b) + (664b-663b) + .previous .endif .endm @@ -169,11 +169,11 @@ */ .macro alternative_endif 664: + .org . - (664b-663b) + (662b-661b) + .org . - (662b-661b) + (664b-663b) .if .Lasm_alt_mode==0 .previous .endif - .org . - (664b-663b) + (662b-661b) - .org . - (662b-661b) + (664b-663b) .endm /*