runtime: nanotime1 is not reentrant #40697
Labels
FrozenDueToAge
NeedsFix
The path to resolution is known, but the work has not been done.
release-blocker
Milestone
What version of Go are you using (
go version
)?tip (up to ba9e108)
Does this issue reproduce with the latest release?
Not sure.
What operating system and processor architecture are you using (
go env
)?linux/amd64
What did you do?
In the runtime, on platforms that uses VDSO,
nanotime1
(andwalltime1
) is not reentrant. At entry it saves the current PC and SP tom.vdsoPC
andm.vdsoSP
, and clearsm.vdsoSP
at exit. If a signal lands in between, andnanotime1
is called in the signal handler (e.g.sigprof
callingcpuProfile.add
callingnanotime1
), it will clearm.vdsoSP
at exit. Now, if it receives another signal, it will observem.vdsoSP
is zero and assumed it is not in VDSO and so okay to unwind the stack, which is not true, and the stack unwinding code will crash. This could happen in the rare situation where two (or more) profiling signals land in onenanotime1
(orwalltime1
) execution.CL https://golang.org/cl/246763 addresses this, by making
nanotime1
(andwalltime1
) reentrant.The risk of that CL: if some register is accidentally clobbered, it will crash the runtime, and essentially any Go program won't run. Or all times will go completely off. Neither of them seems happening.
The text was updated successfully, but these errors were encountered: