mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-10 18:10:56 +09:00
Kernel: Randomize the stack canary on startup
This commit is contained in:
parent
0614c3dd3c
commit
99f71a9a2c
Notes:
sideshowbarker
2024-07-19 10:18:31 +09:00
Author: https://github.com/awesomekling
Commit: 99f71a9a2c
2 changed files with 6 additions and 3 deletions
|
@ -44,6 +44,7 @@
|
|||
#include <Kernel/Net/RTL8139NetworkAdapter.h>
|
||||
#include <Kernel/PCI/Access.h>
|
||||
#include <Kernel/PCI/Initializer.h>
|
||||
#include <Kernel/Random.h>
|
||||
#include <Kernel/TTY/PTYMultiplexer.h>
|
||||
#include <Kernel/TTY/VirtualConsole.h>
|
||||
#include <Kernel/VM/MemoryManager.h>
|
||||
|
@ -219,6 +220,9 @@ extern "C" int __cxa_atexit(void (*)(void*), void*, void*)
|
|||
return 0;
|
||||
}
|
||||
|
||||
extern u32 __stack_chk_guard;
|
||||
u32 __stack_chk_guard;
|
||||
|
||||
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
|
||||
|
@ -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");
|
||||
}
|
||||
|
||||
__stack_chk_guard = get_good_random<u32>();
|
||||
|
||||
RTC::initialize();
|
||||
PIC::initialize();
|
||||
gdt_init();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue