From patchwork Thu Nov 17 13:24:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 13046884 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 F253AC4332F for ; Thu, 17 Nov 2022 13:26:30 +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=QOGz06deIiyqZ0RZ5KF2QKeZuIOjEYoDde2BgJr2gyc=; b=jJMbhb/xl4e6HI yh34ehOji2HAKSF/ZHuMg0/ZjULxwI9bnrLS4a80gbuFslFGYFcRjsOKN2gZjY8+8f6CwyUirrAZ5 R6Vt4Vwd00cgn3ox2uh3pOo9kK5DRjDjxzFocOu8URPjtzbL1fYWEZ2oA3MlBl4p+nN/YEf9t+IdW PHHGpMw9fxWg3vJ5acj53prbvtyyv2wDILkvBEjIEkfzgi1X0W9Wv/0FfKWz3psDkkRMclaa7LJOg NGQ+uePqzfyfZ+IFtEEl/KG5uCsNVp6DGw9dLt856iDzZ7h/YdQaEW4GsjMle7w6KEvMmVtr6r/hj 526+6fpF17W1gfZoOCCA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ovetT-00EEvo-LP; Thu, 17 Nov 2022 13:25:27 +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 1ovesd-00EEIp-B1 for linux-arm-kernel@lists.infradead.org; Thu, 17 Nov 2022 13:24:37 +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 A3BE6B8206C; Thu, 17 Nov 2022 13:24:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 44759C43141; Thu, 17 Nov 2022 13:24:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1668691472; bh=g37aA3YoYN0HWL09AC2QchQp+ELezXG/xhhYiN8WxJI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Z+k3XwwoI01zTSY/0/DZAybHRzWOxi+Y62CgnueMK23bKVhzUNOqXKxVvirbF/BuF BXqJNh4CCqw2uqA7OdmQiiWS1eN6KPI81GYveOlwo+yppnPgGvK8lFe4u1vVtohJiG e/3oogWj1PH2E4t8RmLSh5Gh0OTpyjKKKcj3bZZI9tqs6SElhFOxr6S+V7YpdipwFg EcwNuZ528XB/3Zh2N3v+hGoUBUsQEa3UTj9WR+AgVQ2UhxtyGXIr3FU2bJAPEeFW3o JuFvozkCJ+zrxSPmdKpkJkG95qEKo3U1YrpdnBUK4vwBEn6e2FmnPUuseJibvyVPx0 DGPVcpG6f85dw== From: Ard Biesheuvel To: linux-arm-kernel@lists.infradead.org Cc: Ard Biesheuvel , Marc Zyngier , Will Deacon , Mark Rutland , Kees Cook , Catalin Marinas , Mark Brown , Anshuman Khandual , Richard Henderson Subject: [RFC PATCH 1/7] arm64: ptdump: Disregard unaddressable VA space Date: Thu, 17 Nov 2022 14:24:17 +0100 Message-Id: <20221117132423.1252942-2-ardb@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20221117132423.1252942-1-ardb@kernel.org> References: <20221117132423.1252942-1-ardb@kernel.org> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1559; i=ardb@kernel.org; h=from:subject; bh=g37aA3YoYN0HWL09AC2QchQp+ELezXG/xhhYiN8WxJI=; b=owEB7QES/pANAwAKAcNPIjmS2Y8kAcsmYgBjdjX8d4zbUoMmFr+Dh9bdU/ycgyOjobS1FrhWWax6 CddCGKGJAbMEAAEKAB0WIQT72WJ8QGnJQhU3VynDTyI5ktmPJAUCY3Y1/AAKCRDDTyI5ktmPJLhnC/ 4xOQ7sq5ggQZn27GQ7fIBGu9ZpdFVzoLWHVEYNK93G6AcF9DBu6qbxzVa6h8ygTSPAjk8WUXPSsgju hudp9LsxdszaDoOzOpHOXg9myhPSEnemx1WT6Fzf7C/mG316fzy0O1o095BLDoxdu5pwZ7aYIUv7N0 iIJ6hOH5yVmg1tcHDD9WH/gcZ5e9II2zG6lk0xlzO0BDj5NI2y4aeoIozq+eWLDMnGGncsjRiklG5e sFkoS1BRNMzCTLOS9hIloYCNPDHs9zScnzwxI5vBdFCgZvOQXsySx+hOrjkl1hEwPEbraR/upvt90v VyssH60YhUM7zaMmWLaBnpDaWQEqVVPd9+FnAcKu9VngvvSXwtRZnS2Jp93uegOWKp06TPXNSl4QlR X9MUtjuo2J3b+M+uLpxFbe4FmcwJcPksqk81Mytl5nzYvF6cj4Dhf4YsYnRWtjl3a0wSJCIDdQjE7D ySXVZsTjZvOyVtAkq40Ywfyv0Ubv4RcYxTy8ylNulHq7g= 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-20221117_052435_725100_FABD9811 X-CRM114-Status: GOOD ( 16.09 ) 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 Configurations built with support for 52-bit virtual addressing can also run on CPUs that only support 48 bits of VA space, in which case only that part of swapper_pg_dir that represents the 48-bit addressable region is relevant, and everything else is ignored by the hardware. In a future patch, we will clone the top 2 pgd_t entries at the bottom, to support 52-bit VA configurations built for 16k pages and LPA2, where we cannot simply point TTBR1 to the pgd_t entries where they actually reside. However, we should avoid misinterpreting those cloned entries as describing the start of the 52-bit VA space when the hardware does not support that. Signed-off-by: Ard Biesheuvel --- arch/arm64/mm/ptdump.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/arm64/mm/ptdump.c b/arch/arm64/mm/ptdump.c index 9bc4066c5bf33a72..6c13bf6b7d5df4e4 100644 --- a/arch/arm64/mm/ptdump.c +++ b/arch/arm64/mm/ptdump.c @@ -358,7 +358,7 @@ void ptdump_check_wx(void) .ptdump = { .note_page = note_page, .range = (struct ptdump_range[]) { - {PAGE_OFFSET, ~0UL}, + {_PAGE_OFFSET(vabits_actual), ~0UL}, {0, 0} } } @@ -380,6 +380,8 @@ static int __init ptdump_init(void) address_markers[KASAN_START_NR].start_address = KASAN_SHADOW_START; #endif ptdump_initialize(); + if (VA_BITS > VA_BITS_MIN) + kernel_ptdump_info.base_addr = _PAGE_OFFSET(vabits_actual); ptdump_debugfs_register(&kernel_ptdump_info, "kernel_page_tables"); return 0; }