1
0
mirror of https://github.com/golang/go synced 2024-11-25 05:57:57 -07:00

runtime: check that SysReserve returns aligned memory

R=iant, iant2
CC=golang-dev
https://golang.org/cl/4180043
This commit is contained in:
Russ Cox 2011-02-11 14:32:34 -05:00
parent 7e77623120
commit 48535ae3f1

View File

@ -297,6 +297,9 @@ runtime·mallocinit(void)
if(p == nil) if(p == nil)
runtime·throw("runtime: cannot reserve arena virtual address space"); runtime·throw("runtime: cannot reserve arena virtual address space");
} }
if((uintptr)p & (((uintptr)1<<PageShift)-1))
runtime·throw("runtime: SysReserve returned unaligned address");
runtime·mheap.bitmap = p; runtime·mheap.bitmap = p;
runtime·mheap.arena_start = p + bitmap_size; runtime·mheap.arena_start = p + bitmap_size;
runtime·mheap.arena_used = runtime·mheap.arena_start; runtime·mheap.arena_used = runtime·mheap.arena_start;