]> Cypherpunks repositories - gostls13.git/commit
runtime: clear m.gsignal when the M exits
authorCherry Zhang <cherryyz@google.com>
Tue, 29 Oct 2019 21:07:21 +0000 (17:07 -0400)
committerCherry Zhang <cherryyz@google.com>
Tue, 29 Oct 2019 22:56:47 +0000 (22:56 +0000)
commit15ea61c50ca25295497e78354f7f8397e73e3590
treeff74e8c1b4f3fa19d00562118269968f9f064c7a
parent20d621d2533b0b7ad5a57a68c298f978b4fc02b7
runtime: clear m.gsignal when the M exits

On some platforms (currently ARM and ARM64), when calling into
VDSO we store the G to the gsignal stack, if there is one, so if
we receive a signal during VDSO we can find the G.

When an M exits, it frees the gsignal stack. But m.gsignal.stack
still points to that stack. When we call nanotime on this M, we
will write to the already freed gsignal stack, which is bad.
Prevent this by unlinking the freed stack from the M.

Should fix #35235.

Change-Id: I338b1fc8ec62aae036f38afaca3484687e11a40d
Reviewed-on: https://go-review.googlesource.com/c/go/+/204158
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
src/runtime/proc.go