mirror of
https://git.savannah.gnu.org/git/grub.git
synced 2026-10-27 09:39:22 +00:00
efi: Generate stack protector canary at build time if urandom is available
Generating the canary at build time allows the canary to be different for every build which could limit the effectiveness of certain exploits. Fallback to the statically generated random bytes if /dev/urandom is not readable, e.g. Windows. On 32-bit architectures, which use a 32-bit canary, reduce the canary to 4 bytes with one byte being NUL to filter out string buffer overflow attacks. Signed-off-by: Glenn Washburn <development@efficientek.com> Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
This commit is contained in:
1 parent
e424e945c9
commit
dcc1af5d68
3 files changed
+23
-1
No files matched your search
@@ -46,7 +46,7 @@ static grub_guid_t rng_protocol_guid = GRUB_EFI_RNG_PROTOCOL_GUID;
|
||||
static grub_efi_uint8_t stack_chk_guard_buf[32];
|
||||
|
||||
/* Initialize canary in case there is no RNG protocol. */
|
||||
grub_addr_t __stack_chk_guard = (grub_addr_t) 0x00f2b7e2f193b25c;
|
||||
grub_addr_t __stack_chk_guard = (grub_addr_t) GRUB_STACK_PROTECTOR_INIT;
|
||||
|
||||
void __attribute__ ((noreturn))
|
||||
__stack_chk_fail (void)
|
||||
|
||||
Reference in new issue
Block a user