Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp1630780pxp; Thu, 17 Mar 2022 13:07:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJww5Ijr5/wm5+mYJ83tXhtTwfNhSDp/QSWPYKb9/iAqJI+HLnKXAMI/GozQT98fNFN7IuFF X-Received: by 2002:a17:902:e845:b0:153:aa16:d74f with SMTP id t5-20020a170902e84500b00153aa16d74fmr7027608plg.18.1647547678502; Thu, 17 Mar 2022 13:07:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647547678; cv=none; d=google.com; s=arc-20160816; b=oxKAeC3d3KhEl2fL45NhD/c5zJMeFSrLid73J+ZkU+38w/SaxgITHWw3z40TvmDrmG Cj0feOBMH02CwhLYoXrmP4s+G/lO7Wx/xPtCbRhpwCQUVaBKCq0kQGD6CQQriaz6BDLV ZZYGaQQ51xpJS0waChz91hVpXOGFp4LHtZuyFggKMIorlW8oEX1wKj2XT+5DnY2iB6BW bI4vIs/XI/8Tx293Cy+QAj/VWrtauYAeFSmXg8MpLJveD4gQr6dN9kxj18Q/8MUkZFWr O4XzFCx+ey6r66czvt0jKNtOEbRKXjpR3VFoUGajNdgspIHW9sza0i3nPCUIe4iVbL7Z fRuw== 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=8EA0VNbyc1WA89urHueTkuSEIS9GFEW4FiJvbuR0/+A=; b=HLYp1i0KKCTpRdxP2vLTfTk5ZLrwemLVx7pITE2RvO3VCtJol8scEYOh7GF2qbyhUt PVMlZRt9tRlrTC2jqzv+HBQEDXviovoeFrP0hEnbPp+DcqPUXznVykeaG4lvG2hwDDf4 7OWBplYdb75ZIjCBUmF25doC6AE7sDNJgfkeHWlKprJYzQznnv3vUiZm//7MGOIGANvh 2xD8vESGhT8h3gDTNBW6OtmgkDFKkfKchFhMmXi0eTetipWYgE1bqosbNJ2VTuImB3pk ezb+EcV2Sr14l1MDAmiK7TAT3ZEfq9+l35vEwr8R3nspSJd7GCl6uPj565GGP5hl+NWE EZyA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=V1fui0Yy; 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 m4-20020a637d44000000b003816043f0c3si3036143pgn.696.2022.03.17.13.07.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Mar 2022 13:07:58 -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=V1fui0Yy; 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 6DE0B28F817; Thu, 17 Mar 2022 12:55:43 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233714AbiCQMsF (ORCPT + 99 others); Thu, 17 Mar 2022 08:48:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35650 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233694AbiCQMsA (ORCPT ); Thu, 17 Mar 2022 08:48:00 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2E2DE1EC62C; Thu, 17 Mar 2022 05:46:44 -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 D9E6BB81EA1; Thu, 17 Mar 2022 12:46:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 32670C36AE3; Thu, 17 Mar 2022 12:46:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1647521201; bh=mgQjJqvjoRxeyXsdAzpc6BvFfM62HhYZK7AzeM0f4kc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=V1fui0YyFEuSO3uCdf3myevL1kVAqF8xxcUtdJ5z5RoeYb1uMi4i/vXNNUYLDjymA EkeCssMjurpA62wZbTQ3nhD+rk6mMSryI7DdEaWXtMrcl2CaWQc9EKFZgbgZxSBOVU u5A/5heQiD0XprsnJfwSHrfYDBp1Dx9i0m5Yy2fk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Russell King (Oracle)" , Catalin Marinas , James Morse , Sasha Levin Subject: [PATCH 5.4 11/43] arm64: entry: Allow tramp_alias to access symbols after the 4K boundary Date: Thu, 17 Mar 2022 13:45:22 +0100 Message-Id: <20220317124527.990552682@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220317124527.672236844@linuxfoundation.org> References: <20220317124527.672236844@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.5 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: Sasha Levin --- arch/arm64/kernel/entry.S | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/arch/arm64/kernel/entry.S b/arch/arm64/kernel/entry.S index 7822ecc0e165..3489edd57c51 100644 --- a/arch/arm64/kernel/entry.S +++ b/arch/arm64/kernel/entry.S @@ -124,9 +124,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 @@ -377,10 +380,10 @@ alternative_else_nop_endif #ifdef CONFIG_UNMAP_KERNEL_AT_EL0 bne 5f msr far_el1, x29 - tramp_alias x30, tramp_exit_native + tramp_alias x30, tramp_exit_native, x29 br x30 5: - tramp_alias x30, tramp_exit_compat + tramp_alias x30, tramp_exit_compat, x29 br x30 #endif .else @@ -1362,7 +1365,7 @@ alternative_if_not ARM64_UNMAP_KERNEL_AT_EL0 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) -- 2.34.1