about summary refs log tree commit diff
path: root/sysdeps/mach/hurd
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>1999-09-19 20:40:43 +0000
committerRoland McGrath <roland@gnu.org>1999-09-19 20:40:43 +0000
commit55ffcab7b6e26b33fcb281aa70dc9abc33aa7ead (patch)
tree59b7784f40690543b645c580d499849425bf455a /sysdeps/mach/hurd
parent349447daaf7ba94f1b77849142eb0f03cd97d418 (diff)
downloadglibc-55ffcab7b6e26b33fcb281aa70dc9abc33aa7ead.tar.gz
glibc-55ffcab7b6e26b33fcb281aa70dc9abc33aa7ead.tar.xz
glibc-55ffcab7b6e26b33fcb281aa70dc9abc33aa7ead.zip
* 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.
Diffstat (limited to 'sysdeps/mach/hurd')
-rw-r--r--sysdeps/mach/hurd/brk.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/sysdeps/mach/hurd/brk.c b/sysdeps/mach/hurd/brk.c
index 3a5ed54247..c5d09a35ac 100644
--- a/sysdeps/mach/hurd/brk.c
+++ b/sysdeps/mach/hurd/brk.c
@@ -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;
     }