]> git.ipfire.org Git - thirdparty/grub.git/commit
efi: Generate stack protector canary at build time if urandom is available
authorGlenn Washburn <development@efficientek.com>
Tue, 19 Dec 2023 06:00:00 +0000 (00:00 -0600)
committerDaniel Kiper <daniel.kiper@oracle.com>
Wed, 20 Dec 2023 13:31:50 +0000 (14:31 +0100)
commitdcc1af5d688e32ec64e0125ac387c27fc7a7c6d1
tree2e77248c0110367b301389090bb7964e55eaa026
parente424e945c9298409e1c9b585a234d6676f3d4432
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>
config.h.in
configure.ac
grub-core/kern/efi/init.c