[PATCH, HURD]: Fix sbrk beyond 128MB

Samuel Thibault samuel.thibault@ens-lyon.org
Sun Sep 13 23:15:00 GMT 2009


Hello,

The patch below fixes sbrk() calls beyond the initial allocation of
128MB: passing pagebrk makes the kernel return an error when there is
some room (but not enough for the desired increase) between pagebrk and
_hurd_data_end where vm is already allocated.

Samuel

2009-09-14  Samuel Thibault  <samuel.thibault@ens-lyon.org>

        * sysdeps/mach/hurd/brk.c (_hurd_set_brk): Pass a copy of _hurd_data_end
        instead of pagebrk to __vm_allocate.

---
 brk.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/sysdeps/mach/hurd/brk.c b/sysdeps/mach/hurd/brk.c
index 931b260..087dbdd 100644
--- a/sysdeps/mach/hurd/brk.c
+++ b/sysdeps/mach/hurd/brk.c
@@ -101,8 +101,10 @@ _hurd_set_brk (vm_address_t addr)
 
   if (pagend > _hurd_data_end)
     {
+      vm_address_t alloc_start = _hurd_data_end;
       /* We didn't allocate enough space!  Hopefully we can get some more!  */
-      err = __vm_allocate (__mach_task_self (), &pagebrk, pagend - pagebrk, 0);
+      err = __vm_allocate (__mach_task_self (), &alloc_start,
+			   pagend - alloc_start, 0);
       if (! err)
 	_hurd_data_end = pagend;
     }



More information about the Libc-alpha mailing list