Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp2677684pxb; Mon, 19 Apr 2021 11:02:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyCqzT2a53gwTny6LhtNm2rBdXMykHW3ZQCWnCpk+IpVFXkfb1cOnPE7qTS/iimpU683bkJ X-Received: by 2002:a17:907:770d:: with SMTP id kw13mr22767312ejc.339.1618855364179; Mon, 19 Apr 2021 11:02:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618855364; cv=none; d=google.com; s=arc-20160816; b=mmLRYucLJ7DvAE77eJsP30ZIom3580mnvSmaDf6T5wdV2DJitUxbdMeVogTAR2gdYN 83DeSwyVaZrwWQCB599rQHmzT1gTndbLIUY80IZoh2VG8wCnOWRnHKsom75r8DZJc79x 7k26RhPde/fU+NKh3cCf/OrYwiFJ4t/91ThFuL3eE+mr1iK1xYIZqQ2QB2yGxRmcWq0y pLRQE7JUXXKl7XlDXUhv/c6Q8uuR3hx0c4Ul51bwT5auzftUZLYAghD1iofL3+/2Vvzr pes7Rpx1tQXuzF3eGeHJNesD5+NSTqqGj0l3xFhJebqvZKHoXYVdGjOiCmY4+eWzEMyU JJpA== 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=QfackK/KEhJk+2JcB3KhMgpsL2irSU5+T9G4xcHm19iCIADUA30Aixokxx7SpTbBCZ 6bLiksYS5baw0jDM27t6OUAcKI7p2JB/4+vpUTB5TG6sR1Rx/7dezehwfPMwY0E/+RI9 aM5CrUbHSW9Gu0XozfbfWhNCrdpyS2uv7O/OcjkJ2P9I3+z6UM6avMffRLORzTFL2+vU QRV6oLFtHm0yh77RrPpO2icTeZ1NDP8dBckCXCNpwSqsfefPbXDUyLiCJji17+SpATjb /XAPIi/dYCtXytzGeR/tvb59kXzuhZFGHbzfgGbesEA81PCWxt3FcVief0l+1RjQuD4Q ALJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=mRIXlKUo; 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 hc43si147405ejc.21.2021.04.19.11.02.13; Mon, 19 Apr 2021 11:02:44 -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=mRIXlKUo; 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 S241810AbhDSNgu (ORCPT + 99 others); Mon, 19 Apr 2021 09:36:50 -0400 Received: from mail.kernel.org ([198.145.29.99]:34744 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242000AbhDSNZJ (ORCPT ); Mon, 19 Apr 2021 09:25:09 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id A4D1161370; Mon, 19 Apr 2021 13:19:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1618838400; bh=tGk4CSXuQa2/ZRK8TSBTf+Hnqgwk9HV17o8vQ4NhOh8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mRIXlKUoglkv7RKwBZ1IDWkbhbuz/ZYDRICnfav1P3E5KDJw7oqpXFvl7HOBMbyQI 9YTIRQnR7V54AXtG//KZDynETRGLpsN/jRWx8daBCZ0rCaM6FgW+o6XTQZmksLLUjR EsQV1yTx1EYOr3jm6gKRaemWlI6FSQucL4I2Ew9A= 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.4 46/73] arm64: alternatives: Move length validation in alternative_{insn, endif} Date: Mon, 19 Apr 2021 15:06:37 +0200 Message-Id: <20210419130525.320683439@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210419130523.802169214@linuxfoundation.org> References: <20210419130523.802169214@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 /*