aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArd Biesheuvel <[email protected]>2024-02-14 13:29:23 +0100
committerCatalin Marinas <[email protected]>2024-02-16 12:42:41 +0000
commit16f22981b6d7ea6815d2e4527b82cac5e2f65c89 (patch)
tree2b1069c8e0439e11a5b59f848433fbc25be8eeb3
parent0dd4f60a2c76938c2625f6c630c225699d97608b (diff)
arm64: ptdump: Disregard unaddressable VA space
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. Our software pagetable walker has little in the way of input address validation, and so it will happily start a walk from an address that is not representable by the number of paging levels that are actually active, resulting in lots of bogus output from the page table dumper unless we take care to start at a valid address. So define the start address at runtime based on vabits_actual. Signed-off-by: Ard Biesheuvel <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Catalin Marinas <[email protected]>
-rw-r--r--arch/arm64/mm/ptdump.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/arch/arm64/mm/ptdump.c b/arch/arm64/mm/ptdump.c
index 5f0849528ccf..16d0cf1d85c4 100644
--- a/arch/arm64/mm/ptdump.c
+++ b/arch/arm64/mm/ptdump.c
@@ -313,7 +313,6 @@ static void __init ptdump_initialize(void)
static struct ptdump_info kernel_ptdump_info __ro_after_init = {
.mm = &init_mm,
- .base_addr = PAGE_OFFSET,
};
void ptdump_check_wx(void)
@@ -329,7 +328,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}
}
}
@@ -370,6 +369,7 @@ static int __init ptdump_init(void)
static struct addr_marker address_markers[ARRAY_SIZE(m)] __ro_after_init;
kernel_ptdump_info.markers = memcpy(address_markers, m, sizeof(m));
+ kernel_ptdump_info.base_addr = page_offset;
ptdump_initialize();
ptdump_debugfs_register(&kernel_ptdump_info, "kernel_page_tables");