summary refs log tree commit diff
path: root/hurd
diff options
context:
space:
mode:
Diffstat (limited to 'hurd')
-rw-r--r--hurd/hurdinit.c20
-rw-r--r--hurd/hurdstartup.c8
2 files changed, 8 insertions, 20 deletions
diff --git a/hurd/hurdinit.c b/hurd/hurdinit.c
index bc2334e69f..1704fa8879 100644
--- a/hurd/hurdinit.c
+++ b/hurd/hurdinit.c
@@ -203,23 +203,3 @@ _hurd_setproc (process_t procserver)
 
   return 0;
 }
-
-/* Map the page at address zero with no access allowed, so
-   dereferencing NULL will fault and no "anywhere" allocations
-   (e.g. the out of line memory containing the argument strings)
-   can be assigned address zero, which C says is not a valid pointer.
-
-   When dynamically linked, this should be done by the dynamic linker
-   before we run, but failing is harmless and we ignore the error.  */
-
-static void map0 (void) __attribute__ ((unused));
-text_set_element (_hurd_preinit_hook, map0);
-
-static void
-map0 (void)
-{
-  vm_address_t addr = 0;
-  __vm_map (__mach_task_self (),
-	    &addr, __vm_page_size, 0, 0, MACH_PORT_NULL, 0, 1,
-	    VM_PROT_NONE, VM_PROT_NONE, VM_INHERIT_COPY);
-}
diff --git a/hurd/hurdstartup.c b/hurd/hurdstartup.c
index 17a7705847..cd6922fd2a 100644
--- a/hurd/hurdstartup.c
+++ b/hurd/hurdstartup.c
@@ -75,6 +75,14 @@ _hurd_startup (void **argptr, void (*main) (int *data))
   char **argv, **envp;
   int argc, envc;
   int *argcptr;
+  vm_address_t addr;
+
+  /* Attempt to map page zero redzoned before we receive any RPC
+     data that might get allocated there.  We can ignore errors.  */
+  addr = 0;
+  __vm_map (__mach_task_self (),
+	    &addr, __vm_page_size, 0, 0, MACH_PORT_NULL, 0, 1,
+	    VM_PROT_NONE, VM_PROT_NONE, VM_INHERIT_COPY);
 
   if (err = __task_get_special_port (__mach_task_self (), TASK_BOOTSTRAP_PORT,
 				     &in_bootstrap))