1
0
mirror of https://github.com/systemd/systemd.git synced 2025-01-25 10:04:04 +03:00

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.
This commit is contained in:
Jan Janssen 2023-07-26 15:08:53 +02:00
parent 99aa03c3af
commit bc32a9fdfd

View File

@ -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