• Dmitry Vyukov's avatar
    runtime: fix traceback from goexit1 · 894024f4
    Dmitry Vyukov authored
    We used to not call traceback from goexit1.
    But now tracer does it and crashes on amd64p32:
    
    runtime: unexpected return pc for runtime.getg called from 0x108a4240
    goroutine 18 [runnable, locked to thread]:
    runtime.traceGoEnd()
        src/runtime/trace.go:758 fp=0x10818fe0 sp=0x10818fdc
    runtime.goexit1()
        src/runtime/proc1.go:1540 +0x20 fp=0x10818fe8 sp=0x10818fe0
    runtime.getg(0x0)
        src/runtime/asm_386.s:2414 fp=0x10818fec sp=0x10818fe8
    created by runtime/pprof_test.TestTraceStress
        src/runtime/pprof/trace_test.go:123 +0x500
    
    Return PC from goexit1 points right after goexit (+0x6).
    It happens to work most of the time somehow.
    
    This change fixes traceback from goexit1 by adding an additional NOP to goexit.
    
    Fixes #9931
    
    Change-Id: Ied25240a181b0a2d7bc98127b3ed9068e9a1a13e
    Reviewed-on: https://go-review.googlesource.com/5460Reviewed-by: 's avatarRuss Cox <rsc@golang.org>
    894024f4
asm_amd64.s 46 KB