diff options
| author | Keith Randall <khr@golang.org> | 2015-02-24 09:25:09 -0800 |
|---|---|---|
| committer | Keith Randall <khr@golang.org> | 2015-02-25 21:07:10 +0000 |
| commit | 6d1ebeb5271a06cd55f55a84e95709e2f4805bcc (patch) | |
| tree | f1944b3f48500bc3f5cdae2b69c57f56f229c860 /src/runtime/mbitmap.go | |
| parent | 29421cbb5bc892124c965ead9e4d2e14d963254c (diff) | |
| download | go-6d1ebeb5271a06cd55f55a84e95709e2f4805bcc.tar.xz | |
runtime: handle holes in the heap
We need to distinguish pointers to free spans, which indicate bugs in
our pointer analysis, from pointers to never-in-the-heap spans, which
can legitimately arise from sysAlloc/mmap/etc. This normally isn't a
problem because the heap is contiguous, but in some situations (32
bit, particularly) the heap must grow around an already allocated
region.
The bad pointer test is disabled so this fix doesn't actually do
anything, but it removes one barrier from reenabling it.
Fixes #9872.
Change-Id: I0a92db4d43b642c58d2b40af69c906a8d9777f88
Reviewed-on: https://go-review.googlesource.com/5780
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
Diffstat (limited to 'src/runtime/mbitmap.go')
| -rw-r--r-- | src/runtime/mbitmap.go | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/runtime/mbitmap.go b/src/runtime/mbitmap.go index 369b5ed218..702fccae98 100644 --- a/src/runtime/mbitmap.go +++ b/src/runtime/mbitmap.go @@ -176,7 +176,10 @@ func heapBitsForObject(p uintptr) (base uintptr, hbits heapBits) { x -= mheap_.arena_start >> _PageShift s := h_spans[x] if s == nil || pageID(k) < s.start || p >= s.limit || s.state != mSpanInUse { - if s != nil && s.state == _MSpanStack { + if s == nil || s.state == _MSpanStack { + // If s is nil, the virtual address has never been part of the heap. + // This pointer may be to some mmap'd region, so we allow it. + // Pointers into stacks are also ok, the runtime manages these explicitly. return } |
