mirror of
https://github.com/morgan9e/systemd
synced 2026-04-15 00:47:10 +09: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:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user