Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp680314pxb; Thu, 31 Mar 2022 14:50:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw+jFfVCF7moJGjicXugktDoJpF6Ke1NCwEGQ01wf0jAAmZZFu5PxbncJoxZBOD/lmBoWZb X-Received: by 2002:a17:907:7202:b0:6df:83a9:67d2 with SMTP id dr2-20020a170907720200b006df83a967d2mr6665749ejc.327.1648763432351; Thu, 31 Mar 2022 14:50:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648763432; cv=none; d=google.com; s=arc-20160816; b=wEjY75R5dkymhX1wdDcHQNFTlAZGjurjZwpgzA1pyYITUvMVMtRyKulabBpsuJq2pS n5INhZLomAU74CuDXtcaKMpMqJMfK11fEu7rcSXsLIK4RwCDt9kH4Q439BpPEr3mUw/X qh4USrIZLrpVavk88IOPWOv7Cb0vW/4Vh44v293hQ10llvVSqakN+uNqm55mtjpC/aZh 1HwbBFvBLp8m4Q2Z+4EI63uVLQzb66LoDDN569opywuZPdtu8vg2wjyxmEd9yd7tcKoA A71I2qWIcmVOO3AafbmnM5zLqRhpfOaBrfbsH0oB74YLH6ftKufPCRC96mP1k8AvrYZy SUmg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=S1kANJsqXRq3TbU11rCnjTR5Y0xXYznQzXDIihNrd1E=; b=Y4y3kcXxW6RjrglqnfApWW/vCoYmxXdf5Awb2NinCqmtCKSmaei98dPOOwkU6ulx4H hN2eaF2uCWsH3cSViE38a/SveAaoGqGJUPT0MsWcfERapHg8SxD6uqozvSZ4MIYo5w3R bE//cHsGqrF9uNNwQ2rToM9fOt7tuXa4fBrZRXVp3dYMdruENpgO9Z1rStP3LkcW6mD7 xIRTNSjBO72IqTw8McayJXU+h36WhlDh/HR8fzJo8C8IBDg0zi/WNVGkBAffI7O2FoZ/ mzdKNYBIiY+3aQgjOTtfXcqArawT1ET3B6j2Na7aaM719cJPKBFxphDFi4BivSwRy0Cp zHuA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cx28-20020a05640222bc00b004190767a702si411140edb.496.2022.03.31.14.50.06; Thu, 31 Mar 2022 14:50:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238379AbiCaSh6 (ORCPT + 99 others); Thu, 31 Mar 2022 14:37:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52760 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235153AbiCaSga (ORCPT ); Thu, 31 Mar 2022 14:36:30 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id CE0A520A960; Thu, 31 Mar 2022 11:34:40 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id AA54713D5; Thu, 31 Mar 2022 11:34:40 -0700 (PDT) Received: from eglon.cambridge.arm.com (eglon.cambridge.arm.com [10.1.196.218]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 0CDAC3F718; Thu, 31 Mar 2022 11:34:39 -0700 (PDT) From: James Morse To: stable@vger.kernel.org, linux-kernel@vger.kernel.org Cc: james.morse@arm.com, catalin.marinas@arm.com Subject: [stable:PATCH v4.14.274 13/27] arm64: entry: Allow tramp_alias to access symbols after the 4K boundary Date: Thu, 31 Mar 2022 19:33:46 +0100 Message-Id: <20220331183400.73183-14-james.morse@arm.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220331183400.73183-1-james.morse@arm.com> References: <20220331183400.73183-1-james.morse@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org commit 6c5bf79b69f911560fbf82214c0971af6e58e682 upstream. Systems using kpti enter and exit the kernel through a trampoline mapping that is always mapped, even when the kernel is not. tramp_valias is a macro to find the address of a symbol in the trampoline mapping. Adding extra sets of vectors will expand the size of the entry.tramp.text section to beyond 4K. tramp_valias will be unable to generate addresses for symbols beyond 4K as it uses the 12 bit immediate of the add instruction. As there are now two registers available when tramp_alias is called, use the extra register to avoid the 4K limit of the 12 bit immediate. Reviewed-by: Russell King (Oracle) Reviewed-by: Catalin Marinas [ Removed SDEI for backport ] Signed-off-by: James Morse --- arch/arm64/kernel/entry.S | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/arch/arm64/kernel/entry.S b/arch/arm64/kernel/entry.S index 0669d05bd63c..f455557eaaaa 100644 --- a/arch/arm64/kernel/entry.S +++ b/arch/arm64/kernel/entry.S @@ -139,9 +139,12 @@ .org .Lventry_start\@ + 128 // Did we overflow the ventry slot? .endm - .macro tramp_alias, dst, sym + .macro tramp_alias, dst, sym, tmp mov_q \dst, TRAMP_VALIAS - add \dst, \dst, #(\sym - .entry.tramp.text) + adr_l \tmp, \sym + add \dst, \dst, \tmp + adr_l \tmp, .entry.tramp.text + sub \dst, \dst, \tmp .endm // This macro corrupts x0-x3. It is the caller's duty @@ -366,10 +369,10 @@ alternative_else_nop_endif #ifdef CONFIG_UNMAP_KERNEL_AT_EL0 bne 4f msr far_el1, x29 - tramp_alias x30, tramp_exit_native + tramp_alias x30, tramp_exit_native, x29 br x30 4: - tramp_alias x30, tramp_exit_compat + tramp_alias x30, tramp_exit_compat, x29 br x30 #endif .else -- 2.30.2