]> sourceware.org Git - glibc.git/commitdiff
* sysdeps/mach/hurd/brk.c (_hurd_set_brk): Deallocate and reallocate
authorRoland McGrath <roland@gnu.org>
Sun, 19 Sep 1999 20:40:43 +0000 (20:40 +0000)
committerRoland McGrath <roland@gnu.org>
Sun, 19 Sep 1999 20:40:43 +0000 (20:40 +0000)
pages rather than just reprotecting them.  This way we don't hold on
to the backing space.

ChangeLog
sysdeps/mach/hurd/brk.c

index 9019d9b2ab052c975a6481613d6899f0d3e5aa1c..f7a6a6b00330754461e876744050b03c77693a38 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 1999-09-19  Roland McGrath  <roland@baalperazim.frob.com>
 
+       * sysdeps/mach/hurd/brk.c (_hurd_set_brk): Deallocate and reallocate
+       pages rather than just reprotecting them.  This way we don't hold on
+       to the backing space.
+
        * hurd/hurdprio.c (_hurd_priority_which_map): Rearrange the code a bit.
        Use __munmap instead of __vm_deallocate.
 
index 3a5ed54247bbce13c32954c4dfd1453d1185b6f3..c5d09a35aca4bbaf1b3114254b69b5f0d8e1a50c 100644 (file)
@@ -72,9 +72,18 @@ _hurd_set_brk (vm_address_t addr)
   if (pagend <= pagebrk)
     {
       if (pagend < pagebrk)
-       /* Make that memory inaccessible.  */
-       __vm_protect (__mach_task_self (), pagend, pagebrk - pagend,
-                     0, VM_PROT_NONE);
+       {
+         /* XXX wish this were atomic... */
+         /* First deallocate the memory to release its backing space.  */
+         __vm_deallocate (__mach_task_self (), pagend, pagebrk - pagend);
+         /* Now reallocate it with no access allowed.  */
+         err = __vm_map (__mach_task_self (),
+                         &pagend, _hurd_data_end - pagend,
+                         0, 0, MACH_PORT_NULL, 0, 0,
+                         0, VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE,
+                         VM_INHERIT_COPY);
+         /* XXX what if error? */
+       }
       _hurd_brk = addr;
       return 0;
     }
This page took 0.205226 seconds and 5 git commands to generate.