mirror of
https://github.com/Fennix-Project/Kernel.git
synced 2025-05-30 00:08:03 +00:00
Use bigger random numbers for stack guard
This commit is contained in:
parent
18dd70b139
commit
e851d32e49
@ -8,10 +8,22 @@
|
|||||||
|
|
||||||
EXTERNC __attribute__((weak, no_stack_protector)) uintptr_t __stack_chk_guard_init(void)
|
EXTERNC __attribute__((weak, no_stack_protector)) uintptr_t __stack_chk_guard_init(void)
|
||||||
{
|
{
|
||||||
|
int MaxRetries = 0;
|
||||||
#if UINTPTR_MAX == UINT32_MAX
|
#if UINTPTR_MAX == UINT32_MAX
|
||||||
return Random::rand32();
|
uint32_t num;
|
||||||
|
Retry:
|
||||||
|
num = Random::rand32();
|
||||||
|
if (num < 0x1000 && MaxRetries++ < 10)
|
||||||
|
goto Retry;
|
||||||
|
return num;
|
||||||
|
|
||||||
#else
|
#else
|
||||||
return Random::rand64();
|
uint64_t num;
|
||||||
|
Retry:
|
||||||
|
num = Random::rand64();
|
||||||
|
if (num < 0x100000 && MaxRetries++ < 10)
|
||||||
|
goto Retry;
|
||||||
|
return num;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user