From patchwork Tue Mar 7 14:04:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 13163643 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 199DFC678D5 for ; Tue, 7 Mar 2023 14:14:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=cQVSmxGmDCwhTrSRysph7KWoUTicvq8TV+w8gCS+BLg=; b=oRzG0BuGj2ZLW9 ituvL1H2eLejUO5f3EK2Kz9ZhTRmmJW+zz2ibc8iBEle1nRuuBCkv0aR5CwCKNRAr8IVCvFX1hZqO EbEy8rnOIaHVp0AV2wzv4eOVvC9dH9xZgCmYXxJ2iVrDCblvedxbbvhOdq2CEF4UrWYEG6zOR6mYJ GyvCd+TS3QElXBHklZP4albsA4eGrZvCO9J3Wa6agkrdjThYk2kPwGvdSbTP+Q7KC+bkQNMxSmgEZ IuwlIqvWT+xry4bwu3xXGp73mAiaoHpU/HmX7HXdDCfRM9ls9KH8q/Alf/JmUxwHD9TFLf/i8FZ+V hthiTXLDMdedhwpCYFqQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pZY42-000goI-5V; Tue, 07 Mar 2023 14:13:16 +0000 Received: from ams.source.kernel.org ([2604:1380:4601:e00::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pZXxo-000dnW-OE for linux-arm-kernel@lists.infradead.org; Tue, 07 Mar 2023 14:06:50 +0000 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 BD606B818FE; Tue, 7 Mar 2023 14:06:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8D267C433A8; Tue, 7 Mar 2023 14:06:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1678198005; bh=hBUqn7EZsvUyWwjx7asK+P907e4suMk6qjEd4crdyQM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lvo/Hg08mBnHc9fz669GQGSADGEm5qsN1v4mbr78UWGMA8gQe98pgftKpnVST0tN1 xC9ri5iafO2UOEVPxceNcF4KQg2SwdHwWxL+IjoUVT1payPlvueLo0XmL8VFYHBCFq 88fTDGd0sMGo1LJvIFRybz6G4QXq/mNuQpibkAXJJQRuHJKZ9RiPxSiyDosnUsLEEe kAZHAUp1PQOKlXNBEhpcgZXhtHpArh9s49lU7tAo41mjudrNd5xXZAbtupUKc7lTpm lHAxPQ4mvXdzyG9cc7FfZeh6QCyKXUCvWG1YZI/cZfFxhfCqN8kMHECBwzqVCa+Pst tdP1q3jbsw5QQ== From: Ard Biesheuvel To: linux-kernel@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org, Ard Biesheuvel , Catalin Marinas , Will Deacon , Marc Zyngier , Mark Rutland , Ryan Roberts , Anshuman Khandual , Kees Cook Subject: [PATCH v3 03/60] arm64: mm: get rid of kimage_vaddr global variable Date: Tue, 7 Mar 2023 15:04:25 +0100 Message-Id: <20230307140522.2311461-4-ardb@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230307140522.2311461-1-ardb@kernel.org> References: <20230307140522.2311461-1-ardb@kernel.org> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2417; i=ardb@kernel.org; h=from:subject; bh=hBUqn7EZsvUyWwjx7asK+P907e4suMk6qjEd4crdyQM=; b=owGbwMvMwCFmkMcZplerG8N4Wi2JIYXdhUXbq3bTyunX+x8VqO+4uYjb8fxDT/u9ia8d7esSu wsqGc92lLIwiHEwyIopsgjM/vtu5+mJUrXOs2Rh5rAygQxh4OIUgInIOTL8Fe1LX33GdE3hs/xX zytaNbrmR3x5sNdS2qxbTdiC8fVFM0aG67eunz/Q91rl4Po9wiZXVhx4w7nqLAfzSZ/qFDNltYk rOAE= X-Developer-Key: i=ardb@kernel.org; a=openpgp; fpr=F43D03328115A198C90016883D200E9CA6329909 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230307_060649_124306_D2AAD92F X-CRM114-Status: GOOD ( 16.89 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org We store the address of _text in kimage_vaddr, but since commit 09e3c22a86f6889d ("arm64: Use a variable to store non-global mappings decision"), we no longer reference this variable from modules so we no longer need to export it. In fact, we don't need it at all so let's just get rid of it. Signed-off-by: Ard Biesheuvel Acked-by: Mark Rutland --- arch/arm64/include/asm/memory.h | 6 ++---- arch/arm64/kernel/head.S | 2 +- arch/arm64/mm/mmu.c | 3 --- 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/arch/arm64/include/asm/memory.h b/arch/arm64/include/asm/memory.h index 78e5163836a0ab95..a4e1d832a15a2d7a 100644 --- a/arch/arm64/include/asm/memory.h +++ b/arch/arm64/include/asm/memory.h @@ -182,6 +182,7 @@ #include #include #include +#include #if VA_BITS > 48 extern u64 vabits_actual; @@ -193,15 +194,12 @@ extern s64 memstart_addr; /* PHYS_OFFSET - the physical address of the start of memory. */ #define PHYS_OFFSET ({ VM_BUG_ON(memstart_addr & 1); memstart_addr; }) -/* the virtual base of the kernel image */ -extern u64 kimage_vaddr; - /* the offset between the kernel virtual and physical mappings */ extern u64 kimage_voffset; static inline unsigned long kaslr_offset(void) { - return kimage_vaddr - KIMAGE_VADDR; + return (u64)&_text - KIMAGE_VADDR; } static inline bool kaslr_enabled(void) diff --git a/arch/arm64/kernel/head.S b/arch/arm64/kernel/head.S index b98970907226b36c..65cdaaa2c859418f 100644 --- a/arch/arm64/kernel/head.S +++ b/arch/arm64/kernel/head.S @@ -482,7 +482,7 @@ SYM_FUNC_START_LOCAL(__primary_switched) str_l x21, __fdt_pointer, x5 // Save FDT pointer - ldr_l x4, kimage_vaddr // Save the offset between + adrp x4, _text // Save the offset between sub x4, x4, x0 // the kernel virtual and str_l x4, kimage_voffset, x5 // physical mappings diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c index 6f9d8898a02516f6..81e1420d2cc13246 100644 --- a/arch/arm64/mm/mmu.c +++ b/arch/arm64/mm/mmu.c @@ -50,9 +50,6 @@ u64 vabits_actual __ro_after_init = VA_BITS_MIN; EXPORT_SYMBOL(vabits_actual); #endif -u64 kimage_vaddr __ro_after_init = (u64)&_text; -EXPORT_SYMBOL(kimage_vaddr); - u64 kimage_voffset __ro_after_init; EXPORT_SYMBOL(kimage_voffset);