[PATCH 8/9] x86/kexec: Cope with relocate_kernel() not being at the start of the page
David Woodhouse
dwmw2 at infradead.org
Mon Jan 6 08:13:22 PST 2025
On Mon, 2025-01-06 at 17:09 +0100, Ard Biesheuvel wrote:
>
> I suppose you're referring to
>
> #ifdef CONFIG_KEXEC_JUMP
> /* Saved in save_processor_state. */
> movq $saved_context, %rax
> lgdt saved_context_gdt_desc(%rax)
> #endif
>
> Any reason not to simply use
>
> lgdt saved_context+saved_context_gdt_desc(%rip)
>
> here?
Because the %rip isn't what you (and the linker) think it is.
This code is copied into a control page which is allocated as part of
the kexec kimage. It can only access things within that same page via
%rip. (Which is not as much of a restriction as it sounds, as for most
of its execution the rest of the kernel isn't even present in the page
tables).
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 5069 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/kexec/attachments/20250106/8965a24c/attachment.p7s>
More information about the kexec
mailing list