1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 07:37:46 +00:00

Kernel: Harden memory mapping of the kernel image

We now map the kernel's text and rodata segments read+execute.
We also make the data and bss segments non-executable.

Thanks to q3k for the idea! :^)
This commit is contained in:
Andreas Kling 2020-01-06 13:53:30 +01:00
parent 47cc3e68c6
commit 8e7420ddf2
2 changed files with 26 additions and 5 deletions

View file

@ -9,8 +9,10 @@ SECTIONS
Arch/i386/Boot/boot.ao
*(.multiboot)
*(.page_tables)
start_of_kernel_text = .;
*(.text)
*(.text.startup)
end_of_kernel_text = .;
}
.rodata BLOCK(4K) : ALIGN(4K)
@ -24,12 +26,16 @@ SECTIONS
.data BLOCK(4K) : ALIGN(4K)
{
start_of_kernel_data = .;
*(.data)
end_of_kernel_data = .;
}
.bss BLOCK(4K) : ALIGN(4K)
{
start_of_kernel_bss = .;
*(COMMON)
*(.bss)
end_of_kernel_bss = .;
}
}