From: Jan Janssen Date: Wed, 26 Jul 2023 13:08:53 +0000 (+0200) Subject: boot: Fall back to using image load address for stack guard X-Git-Tag: v255-rc1~911^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=bc32a9fdfd28886e4a037e97984b7a3bb230b224;p=thirdparty%2Fsystemd.git boot: Fall back to using image load address for stack guard If we cannot get random data from the RNG protocol we can still use our load address to make the stack guard a little less static. --- diff --git a/src/boot/efi/log.c b/src/boot/efi/log.c index 93631aca942..dd651bf18e8 100644 --- a/src/boot/efi/log.c +++ b/src/boot/efi/log.c @@ -79,6 +79,9 @@ void __stack_chk_guard_init(void) { EFI_RNG_PROTOCOL *rng; if (BS->LocateProtocol(MAKE_GUID_PTR(EFI_RNG_PROTOCOL), NULL, (void **) &rng) == EFI_SUCCESS) (void) rng->GetRNG(rng, NULL, sizeof(__stack_chk_guard), (void *) &__stack_chk_guard); + else + /* Better than no extra entropy. */ + __stack_chk_guard ^= (intptr_t) &__ImageBase; } #endif