Skip to content

Commit

Permalink
x86/pvh: Use fixed_percpu_data for early boot GSBASE
Browse files Browse the repository at this point in the history
Instead of having a private area for the stack canary, use
fixed_percpu_data for GSBASE like the native kernel.

Signed-off-by: Brian Gerst <brgerst@gmail.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Link: https://lore.kernel.org/r/20250123190747.745588-5-brgerst@gmail.com
  • Loading branch information
Brian Gerst authored and Ingo Molnar committed Feb 18, 2025
1 parent a9a76b3 commit f58b638
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions arch/x86/platform/pvh/head.S
Original file line number Diff line number Diff line change
Expand Up @@ -173,10 +173,15 @@ SYM_CODE_START(pvh_start_xen)
1:
UNWIND_HINT_END_OF_STACK

/* Set base address in stack canary descriptor. */
mov $MSR_GS_BASE,%ecx
leal canary(%rip), %eax
xor %edx, %edx
/*
* Set up GSBASE.
* Note that on SMP the boot CPU uses the init data section until
* the per-CPU areas are set up.
*/
movl $MSR_GS_BASE,%ecx
leaq INIT_PER_CPU_VAR(fixed_percpu_data)(%rip), %rdx
movq %edx, %eax
shrq $32, %rdx
wrmsr

/* Call xen_prepare_pvh() via the kernel virtual mapping */
Expand Down Expand Up @@ -238,8 +243,6 @@ SYM_DATA_START_LOCAL(gdt_start)
SYM_DATA_END_LABEL(gdt_start, SYM_L_LOCAL, gdt_end)

.balign 16
SYM_DATA_LOCAL(canary, .fill 48, 1, 0)

SYM_DATA_START_LOCAL(early_stack)
.fill BOOT_STACK_SIZE, 1, 0
SYM_DATA_END_LABEL(early_stack, SYM_L_LOCAL, early_stack_end)
Expand Down

0 comments on commit f58b638

Please sign in to comment.