aboutsummaryrefslogtreecommitdiff
path: root/src/runtime
diff options
context:
space:
mode:
authorRick Hudson <rlh@golang.org>2015-06-22 14:05:00 -0400
committerRick Hudson <rlh@golang.org>2015-06-22 20:37:23 +0000
commit1ab9176e54bedd37cbb0c6941160a0cfc2e24eac (patch)
tree1bd00d61c489b3340c259b1db69d0de9dd555aba /src/runtime
parentffbed5c22aec733ae2527f5a1025a4eff8eca93a (diff)
downloadgo-1ab9176e54bedd37cbb0c6941160a0cfc2e24eac.tar.xz
runtime: remove race and increase precision in pointer validation.
This CL removes the single and racy use of mheap.arena_end outside of the bookkeeping done in mHeap_init and mHeap_Alloc. There should be no way for heapBitsForSpan to see a pointer to an invalid span. This CL makes the check for this more precise by checking that the pointer is between mheap_.arena_start and mheap_.arena_used instead of mheap_.arena_end. Change-Id: I1200b54353ee1eda002d92645fd8d26048600ceb Reviewed-on: https://go-review.googlesource.com/11342 Reviewed-by: Austin Clements <austin@google.com>
Diffstat (limited to 'src/runtime')
-rw-r--r--src/runtime/mbitmap.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/runtime/mbitmap.go b/src/runtime/mbitmap.go
index 146ffbfcb6..4d39c321d8 100644
--- a/src/runtime/mbitmap.go
+++ b/src/runtime/mbitmap.go
@@ -164,7 +164,7 @@ func heapBitsForAddr(addr uintptr) heapBits {
// heapBitsForSpan returns the heapBits for the span base address base.
func heapBitsForSpan(base uintptr) (hbits heapBits) {
- if base < mheap_.arena_start || base >= mheap_.arena_end {
+ if base < mheap_.arena_start || base >= mheap_.arena_used {
throw("heapBitsForSpan: base out of range")
}
hbits = heapBitsForAddr(base)