[syslinux] [PATCH] Fix for crash with certain EFIs

Ady Ady ady-sf at hotmail.com
Mon Oct 17 11:21:32 PDT 2016


> Hello syslinux maintainers,
> 
> I came across the issue of syslinux crashing with some EFIs in the
> UEFI boot mode.
> 
> Upon closer investigation it turned out that most object files which
> go into syslinux efi64 are compiled with the so-called red zone. Some
> EFIs follow Windows ABI more strictly and cause syslinux to crash due
> to stack overwrite.
> 
> Looking at mk/efi.mk there was a previous attempt to fix it, but the
> fix applied only to a handful of source files.
> 
> As far as I can tell (I may be wrong), the problem is limited to efi64
> on x86_64 build and does not affect the efi32 and bios builds.
> 
> I see that a similar patch was proposed before in November 2015, but
> for some reason it did not make it to the repository.
> 
> Please help fixing this bug.
> 
> Best Regards,
> - Chris
> 
> PATCH:
> 
> Makefile: add -mno-red-zone to all efi64 objects
> 
> x86_64 EFI requires that all sources are compiled without red zone,
> which is not supported by the Windows ABI.
> 
> Without this, syslinux crashes on some UEFI implementations.
> 
> --- syslinux-6.03-orig/mk/com32.mk
> +++ syslinux-6.03/mk/com32.mk
> @@ -29,6 +29,9 @@
>  ifeq ($(strip $(ARCH)),x86_64)
>         GCCOPT += $(call gcc_ok,-m64,)
>         GCCOPT += $(call gcc_ok,-march=x86-64)
> +ifdef EFI_BUILD
> +       GCCOPT += $(call gcc_ok,-mno-red-zone)
> +endif
 
 {snip}

Thank you.

During 2016Nov there were several patches proposed in the official 
Syslinux Mailing List. For the future, it might be helpful to mention 
prior patches more specifically.

Unfortunately, this proposal cannot be evaluated against the current 
git master head:

 http://repo.or.cz/syslinux.git/tree 

nor against 6.04-pre1:
 http://repo.or.cz/syslinux.git/tree/refs/tags/syslinux-6.04-pre1 

simply because "EFI_BUILD" is no longer present / available in the 
current code (as it was removed from the code by a couple of commits 
after the release of 6.03).

I am not saying the intention of the patch is (in)correct; it might or 
might not be (I wouldn't know).

Regards,
Ady.



More information about the Syslinux mailing list