diff options
author | Michael Brown | 2020-06-24 00:08:49 +0200 |
---|---|---|
committer | Michael Brown | 2020-06-24 17:23:21 +0200 |
commit | a61b27b97f572a83ede765a0e779694865950cf2 (patch) | |
tree | 01be6a68c487542581fb9cb1b1f95902fd9ad657 /src/interface/efi/efiprefix.c | |
parent | [parseopt] Treat empty integer strings in user input as invalid (diff) | |
download | ipxe-a61b27b97f572a83ede765a0e779694865950cf2.tar.gz ipxe-a61b27b97f572a83ede765a0e779694865950cf2.tar.xz ipxe-a61b27b97f572a83ede765a0e779694865950cf2.zip |
[efi] Enable stack protection where possible
Enable -fstack-protector for EFI builds, where binary size is less
critical than for BIOS builds.
The stack cookie must be constructed immediately on entry, which
prohibits the use of any viable entropy source. Construct a cookie by
XORing together various mildly random quantities to produce a value
that will at least not be identical on each run.
On detecting a stack corruption, attempt to call Exit() with an
appropriate error. If that fails, then lock up the machine since
there is no other safe action that can be taken.
The old conditional check for support of -fno-stack-protector is
omitted since this flag dates back to GCC 4.1.
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/interface/efi/efiprefix.c')
-rw-r--r-- | src/interface/efi/efiprefix.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/interface/efi/efiprefix.c b/src/interface/efi/efiprefix.c index de3572c7..2c5a5b31 100644 --- a/src/interface/efi/efiprefix.c +++ b/src/interface/efi/efiprefix.c @@ -41,6 +41,9 @@ EFI_STATUS EFIAPI _efi_start ( EFI_HANDLE image_handle, EFI_STATUS efirc; int rc; + /* Initialise stack cookie */ + efi_init_stack_guard ( image_handle ); + /* Initialise EFI environment */ if ( ( efirc = efi_init ( image_handle, systab ) ) != 0 ) goto err_init; |