From: Keith Randall Date: Sat, 14 Feb 2015 23:46:36 +0000 (-0800) Subject: [release-branch.go1.4] runtime: don't fail if we find a pointer to an invalid span... X-Git-Tag: go1.4.2~2 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=e4acac3dfb97479e339fbf587af488bd6886cf09;p=gostls13.git [release-branch.go1.4] runtime: don't fail if we find a pointer to an invalid span on 32 bit The 32-bit heap may have holes in it. Pointers to (non-heap) objects in those holes shouldn't cause the GC to throw. This change is somewhat of a band-aid fix for 1.4.2. We should do a more thorough fix for tip (keep track of the holes in the heap with special MSpans, say). Update #9872 Change-Id: Ife9ba27b77ae6ac5a6792d249c68893b3df62134 Reviewed-on: https://go-review.googlesource.com/4920 Run-TryBot: Keith Randall Reviewed-by: Russ Cox --- diff --git a/src/runtime/mgc0.c b/src/runtime/mgc0.c index 7754bad89d..083beec229 100644 --- a/src/runtime/mgc0.c +++ b/src/runtime/mgc0.c @@ -350,6 +350,9 @@ scanblock(byte *b, uintptr n, byte *ptrmask) x -= (uintptr)arena_start>>PageShift; s = runtime·mheap.spans[x]; if(s == nil || k < s->start || obj >= s->limit || s->state != MSpanInUse) { + // Sometimes 32-bit heaps have holes. See issue 9872 + if(PtrSize == 4 && s == nil) + continue; // Stack pointers lie within the arena bounds but are not part of the GC heap. // Ignore them. if(s != nil && s->state == MSpanStack)