Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp2274130pxp; Mon, 21 Mar 2022 15:35:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxXhqeQSYFRNFJiwpJkBwhGU0HWW2NzV4rjgYCD2/zh2gNIUaDrJeDpU68OZxImgyZXbTzZ X-Received: by 2002:a17:90a:4809:b0:1bf:72b5:af9c with SMTP id a9-20020a17090a480900b001bf72b5af9cmr1464806pjh.190.1647902107056; Mon, 21 Mar 2022 15:35:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647902107; cv=none; d=google.com; s=arc-20160816; b=wYx+3b/CdLW4rm+/ZSHHnpduIzp2HdtqvNFgB0nDgcTx/G54gzBai4DPd0bfz+ha0q h8ieNKWFX7x/l8k+yY5iqPLWor1LjcJV4ST0nakYpSVStPSG/1Y6l64on3fGs5qO+wtW gUmjCE8j1AEDyFR56k2pZdZKXeTkXlCM6j0JcQ3+IhBzhDf3e7JzFqb38IWvZDw0ae00 nX6UhtU2GyWCLXTldgLAHSyCBKuyc09KbaRcj9/n4X71HoxDlX7xFPWatGx2826ZsUT5 5hHGYIgqPo/djxh1Hat00mLI8wszvXn7NKUs+5NRe9unEgPNWy4L0xfwP6BBlrRYskl1 eWwA== 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=fVJdK54cz7ugRVqR/3Nb9UnQnCEEOdp6iSfyQPFlQPc=; b=evaaj5YUkB3u3TaiNJmS2VkS8ewd7eFtEbO/Tr27inAoCNm/q/Y9cvlK7lCbM95W1k JbQfE0MARmHM8DgQvYkZWNfmqil/S9ech/Tuk0k18AOo2I9aSIpV62GQo9SnzfdNzU8q NGuei70P9TBotE/wsu0QOazYAkHwPGehDHDGR6agE7klypI7fx6DWoZS8kCMK7Pi7Ani lFgUHliezJpHYveYEI26HWN3+QvBsV7kDZP4Iy6I2D6PyMIIpY1whYVd6xkjQJ7cVEYS EiyVSL5RTJWm7stBH8bCEO9Ik29XMtAGcyvN4c/TnZ+ZBpS2mAzwH9pWZ8tgM9vV98jo 55qw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=A7D+rVnW; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id z2-20020a170902ccc200b00153b2d1642esi12403865ple.54.2022.03.21.15.35.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Mar 2022 15:35:07 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=A7D+rVnW; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id D359A3B1373; Mon, 21 Mar 2022 14:47:57 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348606AbiCUOBo (ORCPT + 99 others); Mon, 21 Mar 2022 10:01:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46142 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348778AbiCUN6R (ORCPT ); Mon, 21 Mar 2022 09:58:17 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B5FE317A594; Mon, 21 Mar 2022 06:56:30 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 811A7B816DD; Mon, 21 Mar 2022 13:56:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C5995C340ED; Mon, 21 Mar 2022 13:55:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1647870960; bh=vACVCzk77C9AxEkQB5NVVBVP/DprcViXPn2JpwnA3Uk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=A7D+rVnWAfYjNi3EWSqzx2rPgtnxnzo9GXlYH+S29YMowDUunwqYaeVrdE6J2bvMD Vqsr/Rc7ILLI5pv23+P2u/YgE9xzpg9FiYojqm8wfNSPgEQN/RXc1PVUBKEzwL6vJ0 3qaJIjLrxJe7p2ymtgxMCq6/WlVxAZqGpylo7ywE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Greg Kroah-Hartman , "Russell King (Oracle)" , Catalin Marinas , James Morse Subject: [PATCH 4.19 30/57] arm64: entry: Allow tramp_alias to access symbols after the 4K boundary Date: Mon, 21 Mar 2022 14:52:11 +0100 Message-Id: <20220321133222.866193712@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220321133221.984120927@linuxfoundation.org> References: <20220321133221.984120927@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 From: James Morse 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 Signed-off-by: James Morse Signed-off-by: Greg Kroah-Hartman --- arch/arm64/kernel/entry.S | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) --- a/arch/arm64/kernel/entry.S +++ b/arch/arm64/kernel/entry.S @@ -135,9 +135,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 @@ -362,10 +365,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 @@ -1265,7 +1268,7 @@ alternative_if_not ARM64_UNMAP_KERNEL_AT alternative_else_nop_endif #ifdef CONFIG_UNMAP_KERNEL_AT_EL0 - tramp_alias dst=x5, sym=__sdei_asm_exit_trampoline + tramp_alias dst=x5, sym=__sdei_asm_exit_trampoline, tmp=x3 br x5 #endif ENDPROC(__sdei_asm_handler)