Skip to content

Commit 3648027

Browse files
ardbiesheuvelwilldeacon
authored andcommitted
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 <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Will Deacon <[email protected]>
1 parent 2014c95 commit 3648027

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

arch/arm64/mm/trans_pgd.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,13 @@ static int copy_p4d(struct trans_pgd_info *info, pgd_t *dst_pgdp,
162162
unsigned long next;
163163
unsigned long addr = start;
164164

165+
if (pgd_none(READ_ONCE(*dst_pgdp))) {
166+
dst_p4dp = trans_alloc(info);
167+
if (!dst_p4dp)
168+
return -ENOMEM;
169+
pgd_populate(NULL, dst_pgdp, dst_p4dp);
170+
}
171+
165172
dst_p4dp = p4d_offset(dst_pgdp, start);
166173
src_p4dp = p4d_offset(src_pgdp, start);
167174
do {

0 commit comments

Comments
 (0)