[RFC/RFT PATCH 16/19] x86/kexec: Use 64-bit wide absolute reference from relocated code

Ard Biesheuvel
2026-01-08T09:28:41Z

The virtual_mapped() kexec routine runs from a different virtual address
than it was linked at, and so it needs to use an absolute reference to
load the address of 'saved_context'. Change this reference to a 64-bit
wide one, to make the code compatible with linking in PIE mode.

Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
---
arch/x86/kernel/relocate_kernel_64.S | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/kernel/relocate_kernel_64.S b/arch/x86/kernel/relocate_kernel_64.S
index 4ffba68dc57b..3fc1a3002e32 100644
--- a/arch/x86/kernel/relocate_kernel_64.S
+++ b/arch/x86/kernel/relocate_kernel_64.S
@@ -311,7 +311,7 @@ SYM_CODE_START_LOCAL_NOALIGN(virtual_mapped)

#ifdef CONFIG_KEXEC_JUMP
/* Saved in save_processor_state. */
- movq $saved_context, %rax
+ movabsq $saved_context, %rax
lgdt saved_context_gdt_desc(%rax)
#endif

--
2.47.3