mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-25 00:50:22 +00:00
Kernel: Randomize memory location of the dynamic loader :^)
This should make it a little bit harder for those who would mess with our loader.
This commit is contained in:
parent
02ef3f6343
commit
34e9df3c5e
Notes:
sideshowbarker
2024-07-19 00:43:29 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/34e9df3c5e4
1 changed files with 3 additions and 2 deletions
|
@ -188,8 +188,9 @@ int Process::load(NonnullRefPtr<FileDescription> main_program_description, RefPt
|
|||
return 0;
|
||||
}
|
||||
|
||||
// TODO: This should be randomized for ASLR
|
||||
constexpr FlatPtr interpreter_load_offset = 0x08000000;
|
||||
// TODO: I'm sure this can be randomized even better. :^)
|
||||
FlatPtr random_offset = get_good_random<u16>() * PAGE_SIZE;
|
||||
FlatPtr interpreter_load_offset = 0x08000000 + random_offset;
|
||||
|
||||
auto interpreter_load_result = load_elf_object(*interpreter_description, interpreter_load_offset, ShouldAllocateTls::No);
|
||||
if (interpreter_load_result.is_error())
|
||||
|
|
Loading…
Reference in a new issue