mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 09:58:11 +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
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…
Add table
Add a link
Reference in a new issue