Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp1903750pxb; Sat, 2 Apr 2022 07:42:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwWLNkvV6XXM0/qtuA/G1VgSI66bW7TtSgDK3ajJVCL9P3N3Jd344ooDZOGeAGxLWAyfwX9 X-Received: by 2002:a17:902:da90:b0:154:4737:a3f with SMTP id j16-20020a170902da9000b0015447370a3fmr15083328plx.73.1648910534417; Sat, 02 Apr 2022 07:42:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648910534; cv=none; d=google.com; s=arc-20160816; b=s5MD1JXUleJmiPDvNaUXp2VcXemML4OiHxBluA0weUDBnYiy8JjP3TLF5eK/Fh9VIJ b86tWq1daJhpUrUx6+84o5CvrBodCpEOfJHxyyulxIP0vfZQA4XH4qbAcrJQxYfyI4wI cUIjyAjkLRrtzUpajWLCpGv9suA1J8ULaKJzM0quHW24VRxUgFm3m99WBHS9sgxjXLIt hltCFvRIwhXA7NVjs5MYCQgTvsxFAQxQRd6Saj80vhMgmDFsl/1V50DNoUgFvz0zGBOX izZiX/0OUrAx2PWYMZNHC8LulSY9M9NnErxofKN+g5qKwMeizh8GLVo6jy6yA/WS1fJd oDqQ== 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=gRx7MKhT3scWgYD3IA+Ddvuy06lwnrjmmUVh6pCOZU8=; b=S1r4j/R65XQXXwIoByeZXX0G+DQaGclhrhL2+e3skotaV5V/1fwPqayCq+FW7eQjIL UnVICFNtY7GoI2LCcxqoBo4QMD4JVeYVJeSngg7gqMcKN3kkFofIc6eqNOUTj48sNddS L/JLxPZmgoxKVsjTfy2EkB4BZ8DD+EJ8I7flhq3ah7auLIXDQZtdHRJhnMHfQHGwsmha T7M2C71N2arRX+pzqgC/EW8oSKLi2cqNpb3xSBCP5ZMVAa5VcPvY4bocQEKY2cEtl41B qROaP5i4euX9C+xodeKPLZTFtqKZet8HU8h+QwQItzOiN0Uy7VxuUafN5tT+dZ+MAUCU 3wlA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=uXkkpYaF; 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 b13-20020a170903228d00b00153b2d164c5si5685366plh.205.2022.04.02.07.41.56; Sat, 02 Apr 2022 07:42:14 -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=uXkkpYaF; 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 S1343553AbiDAGl4 (ORCPT + 99 others); Fri, 1 Apr 2022 02:41:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45304 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343577AbiDAGks (ORCPT ); Fri, 1 Apr 2022 02:40:48 -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 DC5A1263674; Thu, 31 Mar 2022 23:37:58 -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 85DF1B823D9; Fri, 1 Apr 2022 06:37:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E7D14C340EE; Fri, 1 Apr 2022 06:37:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1648795076; bh=s+xIgTkmKfr5tokAv9i5sEmT+FUSp2unDkisn9xnNSs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uXkkpYaFHsqbR756VwGqft0ddwKEtqFdaYc+lvhGaKlg3rer0FoPUDdlnKMhRiP7D RbWb6Yx6mF3NJoOz9/an/gxQl3smLCMwZPS65s8ycr2VKCc89aFyIOLoGL7RMfSJ2j Cjm83KXpXYvYaEwmi1s6Hj4P1Z5EixQ6pN1KqGhY= 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 14/27] arm64: entry: Dont assume tramp_vectors is the start of the vectors Date: Fri, 1 Apr 2022 08:36:24 +0200 Message-Id: <20220401063624.637108924@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 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 Signed-off-by: Greg Kroah-Hartman --- arch/arm64/kernel/entry.S | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) --- a/arch/arm64/kernel/entry.S +++ b/arch/arm64/kernel/entry.S @@ -1027,7 +1027,7 @@ alternative_else_nop_endif sub \dst, \dst, PAGE_SIZE .endm - .macro tramp_ventry, regsize = 64 + .macro tramp_ventry, vector_start, regsize .align 7 1: .if \regsize == 64 @@ -1049,9 +1049,9 @@ alternative_insn isb, nop, ARM64_WORKARO #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? @@ -1069,19 +1069,21 @@ alternative_insn isb, nop, ARM64_WORKARO eret .endm - .align 11 -ENTRY(tramp_vectors) + .macro generate_tramp_vector +.Lvector_start\@: .space 0x400 - tramp_ventry - tramp_ventry - tramp_ventry - tramp_ventry - - tramp_ventry 32 - tramp_ventry 32 - tramp_ventry 32 - tramp_ventry 32 + .rept 4 + tramp_ventry .Lvector_start\@, 64 + .endr + .rept 4 + tramp_ventry .Lvector_start\@, 32 + .endr + .endm + + .align 11 +ENTRY(tramp_vectors) + generate_tramp_vector END(tramp_vectors) ENTRY(tramp_exit_native)