Skip to contentSkip to conversation

Catch NULL dereferences

PATCH New Samuel Thibault 1 participant 1 message Nov 27, 2007

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Catch NULL dereferences

Unmap page 0 (only used early at boot) so as to catch NULL dereferences.

extras/mini-os/arch/x86/mm.c +3 -0
diff -r 26e766e0c628 extras/mini-os/arch/x86/mm.c
@@ -270,6 +270,9 @@ void build_pagetable(unsigned long *star
         start_address += PAGE_SIZE;
     }
 
+    if (HYPERVISOR_update_va_mapping(0, (pte_t) {}, UVMF_INVLPG))
+        printk("Unable to unmap page 0\n");
+
     *start_pfn = pt_pfn;
 }