mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 19:57:35 +00:00
Kernel: Add .unmap_after_init section for code we don't need after init
You can now declare functions with UNMAP_AFTER_INIT and they'll get segregated into a separate kernel section that gets completely unmapped at the end of initialization. This can be used for anything we don't need to call once we've booted into userspace. There are two nice things about this mechanism: - It allows us to free up entire pages of memory for other use. (Note that this patch does not actually make use of the freed pages yet, but in the future we totally could!) - It allows us to get rid of obviously dangerous gadgets like write-to-CR0 and write-to-CR4 which are very useful for an attacker trying to disable SMAP/SMEP/etc. I've also made sure to include a helpful panic message in case you hit a kernel crash because of this protection. :^)
This commit is contained in:
parent
da100f12a6
commit
6136faa4eb
6 changed files with 40 additions and 0 deletions
|
@ -142,6 +142,7 @@ public:
|
|||
PageFaultResponse handle_page_fault(const PageFault&);
|
||||
|
||||
void protect_readonly_after_init_memory();
|
||||
void unmap_memory_after_init();
|
||||
|
||||
static void enter_process_paging_scope(Process&);
|
||||
static void enter_space(Space&);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue