Rainer Orth <r...@cebitec.uni-bielefeld.de> writes:

> * The message points to the wrong line due to a broken test: malloc.goc
>   has:
>
>               p = runtime_SysReserve((void*)(0x00f8ULL<<32), bitmap_size + 
> arena_size);
>               if(p == nil)
>                       runtime_throw("runtime: cannot reserve arena virtual 
> address space");
>
>   On failure, p will be MAP_FAILED ((void *)-1), not nil, so the wrong
>   assertion it thrown.

I fixed this particular issue as follows, copying the code from the
other Go library.  Bootstrapped and ran Go testsuite on
x86_64-unknown-linux-gnu.  Committed to mainline.

Ian

diff -r 1bc825e20b21 libgo/runtime/mem.c
--- a/libgo/runtime/mem.c	Mon Oct 31 21:07:36 2011 -0700
+++ b/libgo/runtime/mem.c	Mon Oct 31 21:53:12 2011 -0700
@@ -85,6 +85,7 @@
 runtime_SysReserve(void *v, uintptr n)
 {
 	int fd = -1;
+	void *p;
 
 	// On 64-bit, people with ulimit -v set complain if we reserve too
 	// much address space.  Instead, assume that the reservation is okay
@@ -103,7 +104,11 @@
 	fd = dev_zero;
 #endif
 
-	return runtime_mmap(v, n, PROT_NONE, MAP_ANON|MAP_PRIVATE, fd, 0);
+	p = runtime_mmap(v, n, PROT_NONE, MAP_ANON|MAP_PRIVATE, fd, 0);
+	if((uintptr)p < 4096 || -(uintptr)p < 4096) {
+		return nil;
+	}
+	return p;
 }
 
 void

Reply via email to