Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp1467860pxb; Fri, 1 Apr 2022 14:32:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxA4/+sv1uBRz4xPhecX5lYVSTgEhMKazbRKRZeBAmF6f5HpMFSy96PKz0UjZ0d03O+gNsQ X-Received: by 2002:a17:906:314b:b0:6d6:da31:e545 with SMTP id e11-20020a170906314b00b006d6da31e545mr1574989eje.125.1648848748345; Fri, 01 Apr 2022 14:32:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648848748; cv=none; d=google.com; s=arc-20160816; b=r39H365YYa4eUATFtVULrpfkrCZt4QzAa1E5mGsDVHGW+EzGis20f16kMnrRpTF6Jc K48ya63c2F0/7os3vMy+cIysEsprWLDjnvqMNqPTv8Z7LhZePuy3B95kn3XMFqVbUpRs EM60/UWDJdSuigDmAk7EtJVYd0Ypi0dc+mLA1Vc8+pw6PxFj0tL69lM0qr8GN7OYL/1k OvnjuOrlM2Db+x6VrG8CjwzTmNZqvEwMypvBxBsIAoi8kmb9VlgRo3m8/qReaXQLkcvW HawopPLOPsP4g9Ot84ZWR6n79XCeZ/M/+MUSbR2vrljLGYr9vvt7GNVOgS8aefZiOtrn GTBQ== 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=laHuubqVQabyHgRKxWUqWcLcy4QVhn+H0A9AOI+KG3U=; b=KOB9hmvLT7Ozwh62xnYYoVlDqQX6pVNTRuM6uyAZ/4LTqXjK6RnfhXg9N+D1MJ3/76 en1wGRF8HKV/2Ke8JLveOay6MKkwIZANb18QeF3fyGj2SO1h05VRbrTSX0u/bZyUINhD vrI6iDcoxCbJJ47sfXafNI2Y9wwJc9yV2Oxykmw3d/VtwhJCrLMSjaNdmE8ykYrNhFHX LiSIDwV609p5Q1jp8Q923szYOZ/GX+U7eLuAKfqIct9XFJlV4wVjm4dRj1x14D6NUkd+ 5l8encAgqux501yBY5VCUSafBGKoWx6FNKZFhQYX17PXLaIH3UGq5EDQ69u0pkSEJ3if p79w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=i79SRVtf; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y3-20020a056402358300b00418c2b5bd24si2630238edc.6.2022.04.01.14.32.03; Fri, 01 Apr 2022 14:32:28 -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; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=i79SRVtf; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343507AbiDAGlt (ORCPT + 99 others); Fri, 1 Apr 2022 02:41:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48710 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343531AbiDAGkq (ORCPT ); Fri, 1 Apr 2022 02:40:46 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 590C3267585; Thu, 31 Mar 2022 23:37:54 -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 dfw.source.kernel.org (Postfix) with ESMTPS id E361961256; Fri, 1 Apr 2022 06:37:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EBE19C340EE; Fri, 1 Apr 2022 06:37:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1648795073; bh=eRSVxQR13bCp0op1+GKAL8rPyFC9gse31CV31I1XawQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=i79SRVtfolIRJt68wjyQ7rgEqcH9lyOtqhfP/FYOklYgOXgaifEAIlDk4hTVOT9do L6pUZGniuf9HveW6plNObRAlcbALQobcMkF/H0maZUW1omEa4rHLVUai+VJGY25JH3 ck8vm2UIPqWXkYheQPl+PAK9q1UA/ryQyPFehlGE= 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 Subject: [PATCH 4.14 13/27] arm64: entry: Allow tramp_alias to access symbols after the 4K boundary Date: Fri, 1 Apr 2022 08:36:23 +0200 Message-Id: <20220401063624.609077700@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220401063624.232282121@linuxfoundation.org> References: <20220401063624.232282121@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=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,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 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 [ Removed SDEI for backport ] Signed-off-by: James Morse Signed-off-by: Greg Kroah-Hartman --- arch/arm64/kernel/entry.S | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) --- 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