Received: by 2002:a05:6a10:a841:0:0:0:0 with SMTP id d1csp3411184pxy; Mon, 26 Apr 2021 00:45:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwSWRedmIB7KV1rfDplJ/Vzu2zIAlTZhPOPFe1YlaXy9VDuctTgsVaqotCu+kaN2ZnPloVE X-Received: by 2002:a17:90a:e50a:: with SMTP id t10mr21660257pjy.32.1619423134659; Mon, 26 Apr 2021 00:45:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619423134; cv=none; d=google.com; s=arc-20160816; b=evQxDVCNTnr9dOYtv5x83a+1QJJGRHr/roQtfPM3RLX4S2WhK/7aF/ka6ib9/UqoEq d+55UPowV/WzdBkXrYQsEGqYMg6a80zKT2aEALHiaalSWR45TGcY0eSbLn7lMGn4tfpo g6V6w0R0ddS+/fY3kHS05HOeyAkfdTbNwT+vA4L2lzQtuJDSiw9jL8X6FqiT3GUW490c 2EeVPbvT6WYLkTAAhzlVgLaB1y1zfIXH7x3CMpLYq2dxdWt8ck/KmK6c8tX74EiZwzwi 1pojE7phd71zyZ1sOg8ZIhi6Vx7/IkiWbOugegQb6Li2201QrcOCxxmMafyyK8ZvbKqK O/xA== 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=8jHcdz2L6N8BSVNtc5/XoL8UKNnAhe0YfpUxKO9DjIc=; b=SdillLH0qI3agFVaDCjFbsJ9p1gqAx2texQoHSnGd/yFeqD91gbOp486IHfQu1gsGy 8qaEblAwgJdvJ6taI8F2UH+v3vi/cSQNO49CsdXm80WPJ6qYQbHWcUCfOR8gRkZUF2mc gh5esNf07myY8QcrGWVY35cQGmJzWfxjqMEZZZXBNAfY4Bl2I/H7cQTEVyw8VDPUW8W+ 5f9RYvSli2L4cxl2qC1ZasdMRL3bLR3AdSEQF9hmYV9W7WByD5U6KIPT8Ft7tyL75GD5 L8xMiOEXxeND6gER05Y9bHYdMlViY0yHwb17iEcm0xU7b1MP5R2KOBMn0GQ46gOREO33 guOg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ZjScUmDJ; 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 o12si16809757pgj.23.2021.04.26.00.45.22; Mon, 26 Apr 2021 00:45:34 -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=ZjScUmDJ; 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 S233274AbhDZHnd (ORCPT + 99 others); Mon, 26 Apr 2021 03:43:33 -0400 Received: from mail.kernel.org ([198.145.29.99]:50384 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232411AbhDZHhm (ORCPT ); Mon, 26 Apr 2021 03:37:42 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id C70EC613F1; Mon, 26 Apr 2021 07:35:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1619422547; bh=gBR1+DPpBGuIw+kUtmqj1EMCH9aDNO5QTwwOUiwajX4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZjScUmDJxTUbKQfOW3DwHeEx3YlGS0TzohLdrLP2EEAmx18B68qw+WL8LhT2ho51M cCSPNw4xVEyJcEPQ10l9/rzdM7hHCmfH1Lijs4ahJio0R9/j9nXY1+nDIwCVSjn7GI Eb2zScxxQR8L0MFP5LMvMcQAWwN+ie8n7UDih6Og= 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 4.14 24/49] arm64: alternatives: Move length validation in alternative_{insn, endif} Date: Mon, 26 Apr 2021 09:29:20 +0200 Message-Id: <20210426072820.550184467@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210426072819.721586742@linuxfoundation.org> References: <20210426072819.721586742@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 @@ -114,9 +114,9 @@ void apply_alternatives(void *start, siz .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 @@ -186,11 +186,11 @@ void apply_alternatives(void *start, siz */ .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 /*