mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-12 14:12:52 +00:00
Kernel: Use the CPU's NX bit to enforce PROT_EXEC on memory mappings
Now that we have PAE support, we can ask the CPU to crash processes for trying to execute non-executable memory. This is pretty cool! :^)
This commit is contained in:
parent
c22a4301ed
commit
ce5f7f6c07
Notes:
sideshowbarker
2024-07-19 10:41:25 +09:00
Author: https://github.com/awesomekling
Commit: ce5f7f6c07
2 changed files with 9 additions and 0 deletions
|
@ -216,6 +216,7 @@ void Region::remap_page(size_t index)
|
|||
pte.set_writable(false);
|
||||
else
|
||||
pte.set_writable(is_writable());
|
||||
pte.set_execute_disabled(!is_executable());
|
||||
pte.set_user_allowed(is_user_accessible());
|
||||
m_page_directory->flush(page_vaddr);
|
||||
#ifdef MM_DEBUG
|
||||
|
@ -264,6 +265,7 @@ void Region::map(PageDirectory& page_directory)
|
|||
pte.set_writable(false);
|
||||
else
|
||||
pte.set_writable(is_writable());
|
||||
pte.set_execute_disabled(!is_executable());
|
||||
} else {
|
||||
pte.set_physical_page_base(0);
|
||||
pte.set_present(false);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue