Re: [PATCHv3 3/4] x86/64/kexec: Map original relocate_kernel() in init_transition_pgtable()

From: kirill.shutemov@xxxxxxxxxxxxxxx
Date: Tue Aug 20 2024 - 07:15:03 EST


On Tue, Aug 20, 2024 at 11:06:34AM +0000, Huang, Kai wrote:
> At later time:
>
> call swap_pages
> movq $virtual_mapped, %rax <---- (1)
> pushq %rax
> ANNOTATE_UNRET_SAFE
> ret <---- (2)
>
> (1) will load the VA which has __START_KERNEL_map to %rax, and after (2) the
> kernel will run at VA of the original relocate_kernel() which maps to the PA
> of the original relcoate_kernel(). But I think the memory page of the
> original relocate_kernel() won't get corrupted after returning from the second
> kernel, so should be safe to use?

Yes.

--
Kiryl Shutsemau / Kirill A. Shutemov