diff options
author | Ard Biesheuvel <ardb@kernel.org> | 2025-01-10 18:51:46 +0100 |
---|---|---|
committer | Will Deacon <will@kernel.org> | 2025-02-04 12:23:09 +0000 |
commit | 3648027de1fa91a0c80cffd3ecff263d06e62605 (patch) | |
tree | dc1228b81e19a06fb9ae6edd86e0f0c2d7e1fdbe /arch | |
parent | 2014c95afecee3e76ca4a56956a936e23283f05b (diff) |
arm64: Fix 5-level paging support in kexec/hibernate trampoline
Add the missing code to allocate P4D level page tables when cloning the
the kernel page tables. This fixes a crash that may be observed when
attempting to resume from hibernation on an LPA2 capable system with 4k
pages, which therefore uses 5 levels of paging.
Presumably, kexec is equally affected.
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Link: https://lore.kernel.org/r/20250110175145.785702-2-ardb+git@google.com
Signed-off-by: Will Deacon <will@kernel.org>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm64/mm/trans_pgd.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/arch/arm64/mm/trans_pgd.c b/arch/arm64/mm/trans_pgd.c index 19c67ed1a21f..18543b603c77 100644 --- a/arch/arm64/mm/trans_pgd.c +++ b/arch/arm64/mm/trans_pgd.c @@ -162,6 +162,13 @@ static int copy_p4d(struct trans_pgd_info *info, pgd_t *dst_pgdp, unsigned long next; unsigned long addr = start; + if (pgd_none(READ_ONCE(*dst_pgdp))) { + dst_p4dp = trans_alloc(info); + if (!dst_p4dp) + return -ENOMEM; + pgd_populate(NULL, dst_pgdp, dst_p4dp); + } + dst_p4dp = p4d_offset(dst_pgdp, start); src_p4dp = p4d_offset(src_pgdp, start); do { |