Skip to content

Commit aac4849

Browse files
lian-bojfvogel
authored andcommitted
kexec: allocate unencrypted control pages for kdump in case SME is enabled
Orabug: 28796835 When SME is enabled in the first kernel, we will allocate unencrypted pages for kdump in order to be able to boot the kdump kernel like kexec. Signed-off-by: Lianbo Jiang <[email protected]> Signed-off-by: Dan Duval <[email protected]> Reviewed-by: Henry Willard <[email protected]>
1 parent 2bc872f commit aac4849

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

kernel/kexec_core.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -472,6 +472,16 @@ static struct page *kimage_alloc_crash_control_pages(struct kimage *image,
472472
}
473473
}
474474

475+
if (pages) {
476+
/*
477+
* For kdump, we need to ensure that these pages are
478+
* unencrypted pages if SME is enabled.
479+
* By the way, it is unnecessary to call the arch_
480+
* kexec_pre_free_pages(), which will make the code
481+
* become more simple.
482+
*/
483+
arch_kexec_post_alloc_pages(page_address(pages), 1 << order, 0);
484+
}
475485
return pages;
476486
}
477487

@@ -866,6 +876,7 @@ static int kimage_load_crash_segment(struct kimage *image,
866876
result = -ENOMEM;
867877
goto out;
868878
}
879+
arch_kexec_post_alloc_pages(page_address(page), 1, 0);
869880
ptr = kmap(page);
870881
ptr += maddr & ~PAGE_MASK;
871882
mchunk = min_t(size_t, mbytes,
@@ -883,6 +894,7 @@ static int kimage_load_crash_segment(struct kimage *image,
883894
result = copy_from_user(ptr, buf, uchunk);
884895
kexec_flush_icache_page(page);
885896
kunmap(page);
897+
arch_kexec_pre_free_pages(page_address(page), 1);
886898
if (result) {
887899
result = -EFAULT;
888900
goto out;

0 commit comments

Comments
 (0)