[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[xen master] x86/boot: Align mbi2.c stack to 16 bytes



commit f4c3300d88189ab18b6459e22e1aa945ab1d3f6f
Author:     Frediano Ziglio <frediano.ziglio@xxxxxxxxx>
AuthorDate: Tue Oct 15 09:25:12 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
CommitDate: Tue Oct 15 18:20:57 2024 +0100

    x86/boot: Align mbi2.c stack to 16 bytes
    
    Most of Xen is built with a stack alignment of 8 bytes, but the UEFI spec
    mandates 16 and UEFI services will fault if the stack is misaligned.
    
    While the caller of efi_multiboot2_prelude() takes care to align the stack,
    mbi2.c accidentally got the Xen-wide default of 8, and has a 50% chance of
    crashing depending on how many variables the compiler decided to spill to 
the
    stack.
    
    Compile mbi2.c with the appropriate alignment for UEFI functionality.
    
    Also take the opportunity to make it a fully .init object.
    
    Fixes: eb21ce14d709 ('x86/boot: Rewrite EFI/MBI2 code partly in C')
    Signed-off-by: Frediano Ziglio <frediano.ziglio@xxxxxxxxx>
    Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
    Acked-by: Marek Marczykowski-Górecki <marmarek@xxxxxxxxxxxxxxxxxxxxxx>
    [rewrite the commit message]
    Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
---
 xen/arch/x86/efi/Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/efi/Makefile b/xen/arch/x86/efi/Makefile
index 7e2b5c07de..c6678652fc 100644
--- a/xen/arch/x86/efi/Makefile
+++ b/xen/arch/x86/efi/Makefile
@@ -9,11 +9,11 @@ $(obj)/%.o: $(src)/%.ihex FORCE
 $(obj)/boot.init.o: $(obj)/buildid.o
 
 $(call cc-option-add,cflags-stack-boundary,CC,-mpreferred-stack-boundary=4)
-$(addprefix $(obj)/,$(EFIOBJ-y)): CFLAGS_stack_boundary := 
$(cflags-stack-boundary)
+$(addprefix $(obj)/,$(EFIOBJ-y) mbi2.init.o): CFLAGS_stack_boundary := 
$(cflags-stack-boundary)
 
 obj-y := common-stub.o stub.o
 obj-$(XEN_BUILD_EFI) := $(filter-out %.init.o,$(EFIOBJ-y))
 obj-bin-$(XEN_BUILD_EFI) := $(filter %.init.o,$(EFIOBJ-y))
-obj-bin-y += mbi2.o
+obj-bin-y += mbi2.init.o
 extra-$(XEN_BUILD_EFI) += buildid.o relocs-dummy.o
 nocov-$(XEN_BUILD_EFI) += stub.o
--
generated by git-patchbot for /home/xen/git/xen.git#master



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.