Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp2671471pxb; Mon, 19 Apr 2021 10:53:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwYdDEvNd2E3OxihalZknsjAEdxu+4om2zMqHu3YdmLptTDFbH8PA2MdNSRM5Lh/3F27PNQ X-Received: by 2002:a17:906:cd17:: with SMTP id oz23mr15628177ejb.375.1618854821950; Mon, 19 Apr 2021 10:53:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618854821; cv=none; d=google.com; s=arc-20160816; b=Bi3mLknBsH8K+sMN0xvHuRxe8Vx5BrcZfQImcEoHMBTfBoKlZvUDlzCJ1CcSW0Bdv7 UkoNV0ouRbrDb/ghHgfc5rcbowS7SR03XGHzc4vbht60EwVOjXbY5I3dqeYfUVyMHPJf Olo5arhKvdSIUT46xJ5ooai0QKv6NdsFiz9N5B2n4ARYgwikYU5hwRwiIhAff68mvC7g b9b5e7Yneha8J639nmucF2cNazXm0/MZpyjhC40CZxJN+pTwLXscLO4IjYJdG3dqLVnu ajld9rR3yX0xjkmFxtgN9g7Ap/ZyMw9jfJjCrkKvc6RQ/pqxExHuwDScoOaIWy8SkJEK kDkA== 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=S+W7sttmvLaGitkzwBu18jj5ulCJIk+yxzf82h/JNDM=; b=JJh3PJbmo+/US/VMFxN5iOhWgFVkWbtuANjCAMhu3D38XAByEHznSM1nd8rTyW45ke yR6/A23r0Yx93Mwbo1a8skrWIF9tgteiOxqdhQbGEnxQLdbCbfGRVDy6Vx2mdsxHDaQn YsOSyr88L7ieYIs2WfyKzUDN6FL9MLOCzcAJaJ8cJNkCca/gQAbuhK57EzPN9YqzrczK 9/2lf21iCnmC4EBJ+hLY76DyKJ0mr+yduk6fK3vgb1u9qXyRbCrafIu8BeJnQHdB9ugj awwxPk6jDupq0ZcVVfxc/HiglYy3uBfboerM9oVkvBCBbsCdCwlcJ8QBYSxTPVSTDR07 cDmg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=cvLMr+Tm; 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 d21si12547967ejm.343.2021.04.19.10.53.16; Mon, 19 Apr 2021 10:53:41 -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=cvLMr+Tm; 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 S241134AbhDSNZp (ORCPT + 99 others); Mon, 19 Apr 2021 09:25:45 -0400 Received: from mail.kernel.org ([198.145.29.99]:56792 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241093AbhDSNTw (ORCPT ); Mon, 19 Apr 2021 09:19:52 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id EFA54613C6; Mon, 19 Apr 2021 13:15:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1618838127; bh=tGk4CSXuQa2/ZRK8TSBTf+Hnqgwk9HV17o8vQ4NhOh8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cvLMr+TmQM4PczjAoekxkLdVhB4/cKy5Hr6UXNiOMt+JbKIRK+S+zdNoCViQ1L34L GFUTBI8Hao3hwQ53Ntcx99wTHOf4YzS8d4TFsnNkKFJhjcbT1bAiQB8U0EbqskWPjI zci3BQ64JjXelzrCHgLX9G4qoNEjcOHbSjVjrSGI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nathan Chancellor , Sami Tolvanen , Nick Desaulniers , Catalin Marinas Subject: [PATCH 5.10 053/103] arm64: alternatives: Move length validation in alternative_{insn, endif} Date: Mon, 19 Apr 2021 15:06:04 +0200 Message-Id: <20210419130529.631566883@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: Nathan Chancellor commit 22315a2296f4c251fa92aec45fbbae37e9301b6c upstream. 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. Fixes: f7b93d42945c ("arm64/alternatives: use subsections for replacement sequences") Cc: # 5.8.x 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 Link: https://lore.kernel.org/r/20210414000803.662534-1-nathan@kernel.org Signed-off-by: Catalin Marinas Signed-off-by: Greg Kroah-Hartman --- arch/arm64/include/asm/alternative.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) --- a/arch/arm64/include/asm/alternative.h +++ b/arch/arm64/include/asm/alternative.h @@ -119,9 +119,9 @@ static inline void apply_alternatives_mo .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 @@ -191,11 +191,11 @@ static inline void apply_alternatives_mo */ .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 /*