arm64: ptdump: Make note_page_flush() range aware
authorWei-Lin Chang <weilin.chang@arm.com>
Fri, 14 Aug 2026 22:24:57 +0000 (23:24 +0100)
committerWill Deacon <will@kernel.org>
Mon, 24 Aug 2026 13:31:19 +0000 (13:31 +0000)
commit902caade3cfd60f99bf71b355e7c86344bd831e5
tree1426fcde91f5cf91b0baecbdc3d27f9851ada0c2
parent26b77009ee74f6122a067a4f9926ff6e09fffb94
arm64: ptdump: Make note_page_flush() range aware

note_page_flush() calls note_page() with addr == 0 and level == -1 to
dump the last row of a ptdump. addr == 0 (1 << 64 wrapped around)
renders a huge region with enormous size for address spaces with
IA bits < 64. For example the stage-2 page tables and the EFI runtime
page table.

More importantly, the last region of the address space and everything
after the address space up to 1 << 64 are merged into one row of
output. If the last region within the address space is valid, it will
appear to remain valid up to 1 << 64 with the same attributes.

Currently only the EFI runtime ptdump is affected by this, but KVM will
soon fix its stage-2 ptdump by using note_page_flush(). Here is an
example of an EFI runtime ptdump (last row):

0x0000008000000000-0x0000000000000000   17179868672G PGD

With this patch:

0x0000008000000000-0x0001000000000000      261632G PGD

To fix this, cache the end address of a ptdump in ptdump_pg_state so
note_page_flush() can call the final note_page() with the correct end
address.

Fixes: 9d80448ac92b ("efi/arm64: Add debugfs node to dump UEFI runtime page tables")
Signed-off-by: Wei-Lin Chang <weilin.chang@arm.com>
Reviewed-by: Marc Zyngier <maz@kernel.org>
Signed-off-by: Will Deacon <will@kernel.org>
arch/arm64/include/asm/ptdump.h
arch/arm64/mm/ptdump.c