diff options
| author | Russ Cox <rsc@golang.org> | 2011-02-11 14:32:34 -0500 |
|---|---|---|
| committer | Russ Cox <rsc@golang.org> | 2011-02-11 14:32:34 -0500 |
| commit | 48535ae3f10e685f2385b67dbcc3037e8c297b5f (patch) | |
| tree | 31e3b0c189b77fbbefc3c89588d147a7098121b4 /src/pkg/runtime/malloc.goc | |
| parent | 7e77623120105b51f4a348d56798cb49007de029 (diff) | |
| download | go-48535ae3f10e685f2385b67dbcc3037e8c297b5f.tar.xz | |
runtime: check that SysReserve returns aligned memory
R=iant, iant2
CC=golang-dev
https://golang.org/cl/4180043
Diffstat (limited to 'src/pkg/runtime/malloc.goc')
| -rw-r--r-- | src/pkg/runtime/malloc.goc | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/pkg/runtime/malloc.goc b/src/pkg/runtime/malloc.goc index 18652d71a6..70b85d68d7 100644 --- a/src/pkg/runtime/malloc.goc +++ b/src/pkg/runtime/malloc.goc @@ -297,6 +297,9 @@ runtime·mallocinit(void) if(p == nil) 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.arena_start = p + bitmap_size; runtime·mheap.arena_used = runtime·mheap.arena_start; |
