Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp1211064pxb; Wed, 6 Apr 2022 11:25:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxpdyhsTtYu43BZEMYwN5SrXj5+SIDi3L1Ssb6fki5AlXoNkjJ5ONRJwzGoT6R2BzW5u7re X-Received: by 2002:a63:9dc6:0:b0:398:6e02:c105 with SMTP id i189-20020a639dc6000000b003986e02c105mr8299951pgd.495.1649269533076; Wed, 06 Apr 2022 11:25:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649269533; cv=none; d=google.com; s=arc-20160816; b=tvtAqkm/EAgvkXMYkZVX5tkrAAWGPi9QjyR8gD3n+/DEBaruOGTguKPKV7bVmRppOn KUGfQQQMOUz7nkjRNzUXXRECKDvl2NvnpJ83GNRaUK6AYQ4KqiD4rp7Kxf5NI5gja3Ok IA65lHymEL+pj5MJsZLx/FFBG3VU4cSEj5tUldnqjplkwiQZZyPfYcM8ZYbxipcn1uov ME7aKWuHQ2/S/K5G5ArAhUeHD1VNCvdaI9+cTTbfo9t6WlAQZGGlWjjgftIJWpM7sor2 dpm98KrOmMy2caNccw2SskQuir5Pqkr/ssOX5tIkwzc1UmBzmNwAuoSd8sCiFsltHdwF 6ZLw== 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=ATyXK/us+W+pNB5pSsBArP9Hu5qYdGq3mB0tN9qkjpc=; b=CZDOOcs+J1lviOtZP4xgHHMqx+VCEN5UpftAO14H7AFdKvuQLe95qFIIaBKHIQr3PB sSLUwBZnN50ZHIT0EsOS4ODpe2q2QzsPVX27GA1V56s+YmnsGr2OLBiuP84Rq5uwWtPx 9o7Vi8oRmoXkuh/mHJoHjTw29lxljIWijsmJ3xk3lEyKqBixk/BMwWmNX1XRCJtO4lhD 1qoz8xZ1sWj3rl8qm5ZXHwtEzZs6vLuK6OiT7yv7p+xhp2nLJZ1TKgaNZoiwKeHjm3Ry YtzLXPVeYRFtq9mwEgBdJlPNbXr/Y59aTRuw9LiAy4c6iehZLE/LhDlV8gP0CqhdkX1z coqg== 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:18 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id f9-20020a635549000000b003816043ef50si16739388pgm.325.2022.04.06.11.25.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Apr 2022 11:25:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id A20FF2296E9; Wed, 6 Apr 2022 11:08:45 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240293AbiDFSKY (ORCPT + 99 others); Wed, 6 Apr 2022 14:10:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33180 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240545AbiDFSII (ORCPT ); Wed, 6 Apr 2022 14:08:08 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 2D80119533E; Wed, 6 Apr 2022 09:46:28 -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 143BB12FC; Wed, 6 Apr 2022 09:46:28 -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 66D233F73B; Wed, 6 Apr 2022 09:46:27 -0700 (PDT) From: James Morse To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: James Morse , Catalin Marinas Subject: [stable:PATCH v4.9.309 29/43] arm64: entry: Allow tramp_alias to access symbols after the 4K boundary Date: Wed, 6 Apr 2022 17:45:32 +0100 Message-Id: <20220406164546.1888528-29-james.morse@arm.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220406164546.1888528-1-james.morse@arm.com> References: <0220406164217.1888053-1-james.morse@arm.com> <20220406164546.1888528-1-james.morse@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 d665714cdca6..4c4f7df5f0f3 100644 --- a/arch/arm64/kernel/entry.S +++ b/arch/arm64/kernel/entry.S @@ -97,9 +97,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 @@ -254,10 +257,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