• Russ Cox's avatar
    runtime: crash if we see an invalid pointer into GC arena · 11e53e46
    Russ Cox authored
    This will help find bugs during the release freeze.
    It's not clear it should be kept for the release itself.
    That's issue 8861.
    
    The most likely thing that would trigger this is stale
    pointers that previously were ignored or caused memory
    leaks. These were allowed due to the use of conservative
    collection. Now that everything is precise, we should not
    see them anymore.
    
    The small number check reinforces what the stack copier
    is already doing, catching the storage of integers in pointers.
    It caught issue 8864.
    
    The check is disabled if _cgo_allocate is linked into the binary,
    which is to say if the binary is using SWIG to allocate untyped
    Go memory. In that case, there are invalid pointers and there's
    nothing we can do about it.
    
    LGTM=rlh
    R=golang-codereviews, dvyukov, rlh
    CC=golang-codereviews, iant, khr, r
    https://golang.org/cl/148470043
    11e53e46
godefs.c 6.98 KB