Re: [PATCHv3 3/4] x86/64/kexec: Map original relocate_kernel() in init_transition_pgtable()
From: Huang, Kai
Date: Tue Aug 20 2024 - 07:52:42 EST
On Tue, 2024-08-20 at 14:14 +0300, kirill.shutemov@xxxxxxxxxxxxxxx wrote:
> 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.
>
Reviewed-by: Kai Huang <kai.huang@xxxxxxxxx>