Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp1211275pxb; Wed, 6 Apr 2022 11:25:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx2ECqkMgTsBcpPWCSdntj88U1wCdEXukuPN/UYt28pHNFBfXyS5a5idgTyl05J4sduPMdP X-Received: by 2002:a17:902:e552:b0:156:9cdc:e6cf with SMTP id n18-20020a170902e55200b001569cdce6cfmr9934664plf.78.1649269547948; Wed, 06 Apr 2022 11:25:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649269547; cv=none; d=google.com; s=arc-20160816; b=UCMMqWnBZiVAIrOB9PEgoyD0J4OEy+0gDrfkVxzjY79xJE73fXmzJCLyQHusfmWS3N 7kIB5GqUEXDPHYHiFkC/judxnNCygL+DIH4v5d8juT580i4T6Ld4lzNoq7Bw/VBRGrDW D6l6SuJvR2SIfgld6FG/e4K01ylevfRBiBoDKkla9JgHhRqtLHCROGYWGA6jRVFAvIUs mA3AL1MUdDiP183t1RXvtuoVMeV5U+5+GvpeaP/w3pBKrWeABOkRt65KYkLmkxuESP0c /pkFkWHvJypQgyzSDC/r1OIumYa03K6xcTMBlJ0yeDwq+XlztGJ4/1OaZtxcwUeuqCX8 YFIw== 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=Ovz1zxJux2v/w944s+PJ8AwORebCYMg7GohB+RsyrLc=; b=kdWCULYwAoZuKy1aGAho5EXFFJxE/YKyjK6zGIq2IPT+YD9Yt4bzII9zbBxSNPbRvg ph4vUfWbZcZpw7spC3UIChcpMWXiA1XOkuEbZA+4objYa5OOcQXCcMFlnceMbKNSBXBW xoJ7AaVjBFl8UsJO4DIXdNY7NjNOcJjEhibLyCaWGtIekML9FjiCbvHpmjW1G/irR0YH p4Rmlt2PlU9Dj7+EuxgWQWsnOd90dTdx4ww2Jo/0rTQNEim79GtVE9wv2e8JQObchf8q bdLZJQOC6hF3XgKt5R2kjmfK40Ird+xZDjCyL3TxJYZJOkmP6tP+38J3fbFDLd8YL1Jp qG9w== 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 nn18-20020a17090b38d200b001cab35fecb9si5843987pjb.187.2022.04.06.11.25.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Apr 2022 11:25:47 -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 77D7D241B70; Wed, 6 Apr 2022 11:08:58 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240288AbiDFSKi (ORCPT + 99 others); Wed, 6 Apr 2022 14:10:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56430 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239752AbiDFSIJ (ORCPT ); Wed, 6 Apr 2022 14:08:09 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 18C0B1965D3; Wed, 6 Apr 2022 09:46:29 -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 E9F6A23A; 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 48D143F73B; Wed, 6 Apr 2022 09:46:28 -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 30/43] arm64: entry: Don't assume tramp_vectors is the start of the vectors Date: Wed, 6 Apr 2022 17:45:33 +0100 Message-Id: <20220406164546.1888528-30-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 ed50da7764535f1e24432ded289974f2bf2b0c5a upstream. The tramp_ventry macro uses tramp_vectors as the address of the vectors when calculating which ventry in the 'full fat' vectors to branch to. While there is one set of tramp_vectors, this will be true. Adding multiple sets of vectors will break this assumption. Move the generation of the vectors to a macro, and pass the start of the vectors as an argument to tramp_ventry. Reviewed-by: Russell King (Oracle) Reviewed-by: Catalin Marinas Signed-off-by: James Morse --- arch/arm64/kernel/entry.S | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/arch/arm64/kernel/entry.S b/arch/arm64/kernel/entry.S index 4c4f7df5f0f3..114922c1c3e3 100644 --- a/arch/arm64/kernel/entry.S +++ b/arch/arm64/kernel/entry.S @@ -926,7 +926,7 @@ __ni_sys_trace: sub \dst, \dst, PAGE_SIZE .endm - .macro tramp_ventry, regsize = 64 + .macro tramp_ventry, vector_start, regsize .align 7 1: .if \regsize == 64 @@ -948,9 +948,9 @@ __ni_sys_trace: #else ldr x30, =vectors #endif - prfm plil1strm, [x30, #(1b - tramp_vectors)] + prfm plil1strm, [x30, #(1b - \vector_start)] msr vbar_el1, x30 - add x30, x30, #(1b - tramp_vectors + 4) + add x30, x30, #(1b - \vector_start + 4) isb ret .org 1b + 128 // Did we overflow the ventry slot? @@ -968,19 +968,21 @@ __ni_sys_trace: eret .endm - .align 11 -ENTRY(tramp_vectors) + .macro generate_tramp_vector +.Lvector_start\@: .space 0x400 - tramp_ventry - tramp_ventry - tramp_ventry - tramp_ventry + .rept 4 + tramp_ventry .Lvector_start\@, 64 + .endr + .rept 4 + tramp_ventry .Lvector_start\@, 32 + .endr + .endm - tramp_ventry 32 - tramp_ventry 32 - tramp_ventry 32 - tramp_ventry 32 + .align 11 +ENTRY(tramp_vectors) + generate_tramp_vector END(tramp_vectors) ENTRY(tramp_exit_native) -- 2.30.2