Skip to content

Commit e4acac3

Browse files
randall77adg
authored andcommitted
[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 <[email protected]> Reviewed-by: Russ Cox <[email protected]>
1 parent 3e5977f commit e4acac3

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/runtime/mgc0.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,9 @@ scanblock(byte *b, uintptr n, byte *ptrmask)
350350
x -= (uintptr)arena_start>>PageShift;
351351
s = runtime·mheap.spans[x];
352352
if(s == nil || k < s->start || obj >= s->limit || s->state != MSpanInUse) {
353+
// Sometimes 32-bit heaps have holes. See issue 9872
354+
if(PtrSize == 4 && s == nil)
355+
continue;
353356
// Stack pointers lie within the arena bounds but are not part of the GC heap.
354357
// Ignore them.
355358
if(s != nil && s->state == MSpanStack)

0 commit comments

Comments
 (0)