]> Cypherpunks repositories - gostls13.git/commit
runtime: overwrite asyncPreempt PC when injecting sigpanic on Windows
authorCherry Zhang <cherryyz@google.com>
Wed, 8 Jan 2020 23:23:51 +0000 (18:23 -0500)
committerCherry Zhang <cherryyz@google.com>
Thu, 9 Jan 2020 15:37:52 +0000 (15:37 +0000)
commit17e97322fb0605206d8503a321bd24eca17afd34
treedcefbff8bb301897cba9a431684614c4afefa035
parent817afe83578d869b36e8697344bb2d557c86b264
runtime: overwrite asyncPreempt PC when injecting sigpanic on Windows

On Windows, it might be possible that SuspendThread suspends a
thread right between when an exception happens and when the
exception handler runs. (This is my guess. I don't know the
implementation detail of Windows exceptions to be sure.) In this
case, we may inject a call to asyncPreempt before the exception
handler runs. The exception handler will inject a sigpanic call,
which will make the stack trace looks like

sigpanic
asyncPreempt
actual panicking function

i.e. it appears asyncPreempt panicked.

Instead, just overwrite the PC, without pushing another frame.

Fixes #35773.

Change-Id: Ief4e964dcb7f45670b5f93c4dcf285cc1c737514
Reviewed-on: https://go-review.googlesource.com/c/go/+/213879
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
src/runtime/signal_windows.go