Commit 32d00913 authored by Arvind Sankar's avatar Arvind Sankar Committed by Ard Biesheuvel

x86/boot: Reload GDTR after copying to the end of the buffer

The GDT may get overwritten during the copy or during extract_kernel,
which will cause problems if any segment register is touched before the
GDTR is reloaded by the decompressed kernel. For safety update the GDTR
to point to the GDT within the copied kernel.
Signed-off-by: default avatarArvind Sankar <nivedita@alum.mit.edu>
Link: https://lore.kernel.org/r/20200202171353.3736319-4-nivedita@alum.mit.eduSigned-off-by: default avatarArd Biesheuvel <ardb@kernel.org>
parent 90ff2262
...@@ -439,6 +439,16 @@ trampoline_return: ...@@ -439,6 +439,16 @@ trampoline_return:
cld cld
popq %rsi popq %rsi
/*
* The GDT may get overwritten either during the copy we just did or
* during extract_kernel below. To avoid any issues, repoint the GDTR
* to the new copy of the GDT.
*/
leaq gdt64(%rbx), %rax
subq %rbp, 2(%rax)
addq %rbx, 2(%rax)
lgdt (%rax)
/* /*
* Jump to the relocated address. * Jump to the relocated address.
*/ */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment