You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
set StackFromSystem=1 and StackFaultOnFree=1 and go test -a -short strings.
It faults during gentraceback.
fatal error: unexpected signal during runtime execution
[signal 0xa code=0x2 addr=0x22084914b8 pc=0x1c290]
goroutine 1 [running, locked to thread]:
runtime.gothrow(0x1c0810, 0x2a)
/Users/rsc/g/go/src/runtime/panic.go:503 +0x8e fp=0x22084939a8 sp=0x2208493990
runtime.sigpanic()
/Users/rsc/g/go/src/runtime/sigpanic_unix.go:14 +0x5e fp=0x22084939f8 sp=0x22084939a8
runtime.gentraceback(0x10fe1, 0x2208491358, 0x0, 0x2082b2120, 0x4, 0x2208493b98, 0x20,
0x0, 0x0, 0x0, ...)
/Users/rsc/g/go/src/runtime/traceback.go:200 +0xbc0 fp=0x2208493ae8 sp=0x22084939f8
runtime.callers(0x4, 0x2208493b98, 0x20, 0x0)
/Users/rsc/g/go/src/runtime/traceback.go:514 +0xb5 fp=0x2208493b58 sp=0x2208493ae8
runtime.mProf_Malloc(0x2082f8000, 0x100000)
/Users/rsc/g/go/src/runtime/mprof.go:237 +0x51 fp=0x2208493cc0 sp=0x2208493b58
runtime.profilealloc(0x265880, 0x2082f8000, 0x100000)
/Users/rsc/g/go/src/runtime/malloc.go:408 +0x9b fp=0x2208493ce8 sp=0x2208493cc0
runtime.mallocgc(0x100000, 0x0, 0x3, 0x5c7d23d3aa6c13a4)
/Users/rsc/g/go/src/runtime/malloc.go:335 +0x3e0 fp=0x2208493d98 sp=0x2208493ce8
runtime.rawstring(0x100000, 0x0, 0x0, 0x0, 0x0, 0x0)
/Users/rsc/g/go/src/runtime/string.go:195 +0x94 fp=0x2208493dc8 sp=0x2208493d98
runtime.slicebytetostring(0x208500000, 0x100000, 0x100000, 0x0, 0x0)
/Users/rsc/g/go/src/runtime/string.go:69 +0x4b fp=0x2208493e58 sp=0x2208493dc8
strings_test.func·007(0x0, 0x0)
/Users/rsc/g/go/src/strings/strings_test.go:1163 +0xf2 fp=0x2208493ee8 sp=0x2208493e58
strings_test.init()
/Users/rsc/g/go/src/strings/strings_test.go:1166 +0xd6a fp=0x2208493f80 sp=0x2208493ee8
main.init()
strings/_test/_testmain.go:274 +0x4a fp=0x2208493f98 sp=0x2208493f80
runtime.main()
/Users/rsc/g/go/src/runtime/proc.go:58 +0xe4 fp=0x2208493fe0 sp=0x2208493f98
runtime.goexit()
/Users/rsc/g/go/src/runtime/asm_amd64.s:2232 +0x1 fp=0x2208493fe8 sp=0x2208493fe0
This was running on a 2k stack. It crossed the 2k boundary into a 4k stack in a call
made out of gentraceback with sp=...9f0. On return gentraceback was still using an
un-updated local SP variable.
We might be able to make gentraceback cope with this by giving the SP variables the
right types, but the result will still describe half one stack and half another. It
seems much safer to require that gentraceback of the current goroutine run on the g0
stack instead.
More generally, the result of getcallersp is invalidated by making a call to a function
that might grow the stack or pause the goroutine (because the stack can shrink during GC
pauses). It must be used basically immediately, and must only be passed to nosplit
functions that do not block.
This affects runtime.Callers, runtime.Stack, and nearly all the runtime profiling
routines. It does not directly impact garbage collection or stack copying; their uses of
gentraceback were already running on a g0 stack.
CL 167060043 should fix this.
The text was updated successfully, but these errors were encountered:
The text was updated successfully, but these errors were encountered: