]> git.baikalelectronics.ru Git - kernel.git/commit
x86, efi: Add dedicated EFI stub entry point
authorMatt Fleming <matt.fleming@intel.com>
Sun, 15 Apr 2012 15:06:04 +0000 (16:06 +0100)
committerH. Peter Anvin <hpa@linux.intel.com>
Mon, 16 Apr 2012 18:41:44 +0000 (11:41 -0700)
commit1a1572fc4da58a5ec2c0ace763cc4ad0ddc86789
treefda4b1fa900378abddf71bc8d815543a49783fee
parentf1232cf3a8e8c1ee837b8b60f149ce3bbd7a3bcb
x86, efi: Add dedicated EFI stub entry point

The method used to work out whether we were booted by EFI firmware or
via a boot loader is broken. Because efi_main() is always executed
when booting from a boot loader we will dereference invalid pointers
either on the stack (CONFIG_X86_32) or contained in %rdx
(CONFIG_X86_64) when searching for an EFI System Table signature.

Instead of dereferencing these invalid system table pointers, add a
new entry point that is only used when booting from EFI firmware, when
we know the pointer arguments will be valid. With this change legacy
boot loaders will no longer execute efi_main(), but will instead skip
EFI stub initialisation completely.

[ hpa: Marking this for urgent/stable since it is a regression when
  the option is enabled; without the option the patch has no effect ]

Signed-off-by: Matt Fleming <matt.hfleming@intel.com>
Link: http://lkml.kernel.org/r/1334584744.26997.14.camel@mfleming-mobl1.ger.corp.intel.com
Reported-by: Jordan Justen <jordan.l.justen@intel.com>
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Cc: <stable@vger.kernel.org> v3.3
arch/x86/boot/compressed/head_32.S
arch/x86/boot/compressed/head_64.S
arch/x86/boot/tools/build.c