mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 19:17:44 +00:00
Kernel: Randomize the stack canary on startup
This commit is contained in:
parent
0614c3dd3c
commit
99f71a9a2c
2 changed files with 6 additions and 3 deletions
|
@ -213,9 +213,6 @@ void free(void* p)
|
||||||
return kfree(p);
|
return kfree(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern u32 __stack_chk_guard;
|
|
||||||
u32 __stack_chk_guard = (u32)0xc0000c13;
|
|
||||||
|
|
||||||
[[noreturn]] void __stack_chk_fail()
|
[[noreturn]] void __stack_chk_fail()
|
||||||
{
|
{
|
||||||
ASSERT_NOT_REACHED();
|
ASSERT_NOT_REACHED();
|
||||||
|
|
|
@ -44,6 +44,7 @@
|
||||||
#include <Kernel/Net/RTL8139NetworkAdapter.h>
|
#include <Kernel/Net/RTL8139NetworkAdapter.h>
|
||||||
#include <Kernel/PCI/Access.h>
|
#include <Kernel/PCI/Access.h>
|
||||||
#include <Kernel/PCI/Initializer.h>
|
#include <Kernel/PCI/Initializer.h>
|
||||||
|
#include <Kernel/Random.h>
|
||||||
#include <Kernel/TTY/PTYMultiplexer.h>
|
#include <Kernel/TTY/PTYMultiplexer.h>
|
||||||
#include <Kernel/TTY/VirtualConsole.h>
|
#include <Kernel/TTY/VirtualConsole.h>
|
||||||
#include <Kernel/VM/MemoryManager.h>
|
#include <Kernel/VM/MemoryManager.h>
|
||||||
|
@ -219,6 +220,9 @@ extern "C" int __cxa_atexit(void (*)(void*), void*, void*)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern u32 __stack_chk_guard;
|
||||||
|
u32 __stack_chk_guard;
|
||||||
|
|
||||||
extern "C" [[noreturn]] void init(u32 physical_address_for_kernel_page_tables)
|
extern "C" [[noreturn]] void init(u32 physical_address_for_kernel_page_tables)
|
||||||
{
|
{
|
||||||
// this is only used one time, directly below here. we can't use this part
|
// this is only used one time, directly below here. we can't use this part
|
||||||
|
@ -313,6 +317,8 @@ extern "C" [[noreturn]] void init(u32 physical_address_for_kernel_page_tables)
|
||||||
kprintf("x86: No RDRAND support detected. Randomness will be shitty\n");
|
kprintf("x86: No RDRAND support detected. Randomness will be shitty\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
__stack_chk_guard = get_good_random<u32>();
|
||||||
|
|
||||||
RTC::initialize();
|
RTC::initialize();
|
||||||
PIC::initialize();
|
PIC::initialize();
|
||||||
gdt_init();
|
gdt_init();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue