Kernel: Add mechanism to make some memory read-only after init finishes

You can now use the READONLY_AFTER_INIT macro when declaring a variable
and we will put it in a special ".ro_after_init" section in the kernel.

Data in that section remains writable during the boot and init process,
and is then marked read-only just before launching the SystemServer.

This is based on an idea from the Linux kernel. :^)
This commit is contained in:
Andreas Kling 2021-02-14 17:35:07 +01:00
commit d8013c60bb
Notes: sideshowbarker 2024-07-18 22:19:09 +09:00
5 changed files with 28 additions and 0 deletions

View file

@ -141,6 +141,8 @@ public:
PageFaultResponse handle_page_fault(const PageFault&);
void protect_readonly_after_init_memory();
static void enter_process_paging_scope(Process&);
static void enter_space(Space&);