mm: kill current task on usermode pagefault and fix destroy_page_dir destroying kernel space mappings
This commit is contained in:
@@ -101,6 +101,13 @@ void handle_page_fault(uint32_t error_code, uint32_t faulting_address)
|
||||
|
||||
printf("ERR: 0x%X\n", error_code);
|
||||
|
||||
if (user) {
|
||||
printf("page fault, killing task %x\n", current->pid);
|
||||
task_kill(current);
|
||||
asm volatile("sti");
|
||||
while (1) {}
|
||||
}
|
||||
|
||||
asm("hlt");
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -169,7 +169,7 @@ void destroy_page_dir(uint32_t* page_dir_virt) {
|
||||
|
||||
// Iterate through user-space page directory entries (PDEs 0-767).
|
||||
// Kernel space (768+) is shared and should not be freed.
|
||||
for (int i = 0; i < 768; i++) {
|
||||
for (int i = 1; i < 768; i++) {
|
||||
uint32_t pde = page_dir_virt[i];
|
||||
|
||||
// Check if the page directory entry is present
|
||||
|
||||
Reference in New Issue
Block a user