summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustus Winter <4winter@informatik.uni-hamburg.de>2014-09-22 17:59:57 +0200
committerJustus Winter <4winter@informatik.uni-hamburg.de>2014-09-29 12:35:06 +0200
commitdb9ad21d272a4dce53c35095b97ca0a597b45004 (patch)
treedd230face414cba271bf4542981561424638884f
parentaf77f771b687d3653018bc18b1b07a4805beaa19 (diff)
exec: redzone page zero before loading anything
This prevents load_section from mapping any sections to page zero. * exec/exec.c (do_exec): Redzone page zero before loading anything.
-rw-r--r--exec/exec.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/exec/exec.c b/exec/exec.c
index 2fc1e441..0ecf2d3e 100644
--- a/exec/exec.c
+++ b/exec/exec.c
@@ -1116,6 +1116,16 @@ do_exec (file_t file,
mach_port_destroy (oldtask, destroynames[i]);
}
+ /* Map page zero redzoned. */
+ {
+ vm_address_t addr = 0;
+ e.error = vm_map (newtask,
+ &addr, vm_page_size, 0, 0, MACH_PORT_NULL, 0, 1,
+ VM_PROT_NONE, VM_PROT_NONE, VM_INHERIT_COPY);
+ if (e.error)
+ goto out;
+ }
+
/* XXX this should be below
it is here to work around a vm_map kernel bug. */
if (interp.file != MACH_PORT_NULL)