Skip to content

Commit 4d5f1da

Browse files
dwmw2bp3tk0v
authored andcommitted
x86/kexec: Ensure preserve_context flag is set on return to kernel
The swap_pages() function will only actually *swap*, as its name implies, if the preserve_context flag in the %r11 register is non-zero. On the way back from a ::preserve_context kexec, ensure that the %r11 register is non-zero so that the pages get swapped back. Fixes: 9e5683e ("x86/kexec: Only swap pages for ::preserve_context mode") Signed-off-by: David Woodhouse <[email protected]> Signed-off-by: Borislav Petkov (AMD) <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent d144d8a commit 4d5f1da

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

arch/x86/kernel/relocate_kernel_64.S

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,7 @@ SYM_CODE_START_LOCAL_NOALIGN(identity_mapped)
220220
movq kexec_pa_table_page(%rip), %rax
221221
movq %rax, %cr3
222222
lea PAGE_SIZE(%r8), %rsp
223+
movl $1, %r11d /* Ensure preserve_context flag is set */
223224
call swap_pages
224225
movq kexec_va_control_page(%rip), %rax
225226
addq $(virtual_mapped - relocate_kernel), %rax

0 commit comments

Comments
 (0)