summaryrefslogtreecommitdiff
path: root/sys/uvm/uvm_init.c
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2007-04-12 21:47:47 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2007-04-12 21:47:47 +0000
commit0003df26691626da39d85b2ee1accdeb534684b2 (patch)
tree4e1ebec7624e9ff753a1e1c6c4a8f0fb8151aec0 /sys/uvm/uvm_init.c
parentc96c8d60569ece4c81cfeed0d77047930008fb2d (diff)
Allow machine-dependant overrides for the ``deadbeef'' sentinel values,
and make sure that nothing can ever be mapped at theses addresses. Only i386 overrides the default for now. From mickey@, ok art@ miod@
Diffstat (limited to 'sys/uvm/uvm_init.c')
-rw-r--r--sys/uvm/uvm_init.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/sys/uvm/uvm_init.c b/sys/uvm/uvm_init.c
index 92f14bcccbc..2f33534d941 100644
--- a/sys/uvm/uvm_init.c
+++ b/sys/uvm/uvm_init.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uvm_init.c,v 1.13 2006/07/13 22:51:26 deraadt Exp $ */
+/* $OpenBSD: uvm_init.c,v 1.14 2007/04/12 21:47:46 miod Exp $ */
/* $NetBSD: uvm_init.c,v 1.14 2000/06/27 17:29:23 mrg Exp $ */
/*
@@ -153,6 +153,23 @@ uvm_init()
uvm_km_page_init();
/*
+ * reserve some unmapped space for malloc/pool use after free usage
+ */
+#ifdef DEADBEEF0
+ kvm_start = DEADBEEF0 - PAGE_SIZE;
+ if (uvm_map(kernel_map, &kvm_start, 3 * PAGE_SIZE,
+ NULL, UVM_UNKNOWN_OFFSET, 0, UVM_MAPFLAG(UVM_PROT_NONE,
+ UVM_PROT_NONE, UVM_INH_NONE, UVM_ADV_RANDOM, UVM_FLAG_FIXED)))
+ panic("uvm_init: cannot reserve dead beef @0x%x\n", DEADBEEF0);
+#endif
+#ifdef DEADBEEF1
+ kvm_start = DEADBEEF1 - PAGE_SIZE;
+ if (uvm_map(kernel_map, &kvm_start, 3 * PAGE_SIZE,
+ NULL, UVM_UNKNOWN_OFFSET, 0, UVM_MAPFLAG(UVM_PROT_NONE,
+ UVM_PROT_NONE, UVM_INH_NONE, UVM_ADV_RANDOM, UVM_FLAG_FIXED)))
+ panic("uvm_init: cannot reserve dead beef @0x%x\n", DEADBEEF1);
+#endif
+ /*
* done!
*/