aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/signal_windows.go
diff options
context:
space:
mode:
authorSimon Ferquel <simon.ferquel@docker.com>2019-08-05 11:28:52 +0000
committerAlex Brainman <alex.brainman@gmail.com>2019-08-31 00:47:27 +0000
commite5e5fb024a228b200d474b030deb4998af4c45f1 (patch)
tree9f36f330e425ca0a9e5f036958d9a4d6b1f9990e /src/runtime/signal_windows.go
parent1786ecd502364ac92493acbdee5ddca50c80afde (diff)
downloadgo-e5e5fb024a228b200d474b030deb4998af4c45f1.tar.gz
go-e5e5fb024a228b200d474b030deb4998af4c45f1.zip
runtime: do not crash in lastcontinuehandler when running as DLL
If Go DLL is used by external C program, and lastcontinuehandler is reached, lastcontinuehandler will crash the process it is running in. But it should not be up to Go runtime to decide if process to be crashed or not - it should be up to C runtime. This CL adjusts lastcontinuehandler to not to crash when running as DLL. Fixes #32648. Change-Id: Ia455e69b8dde2a6f42f06b90e8af4aa322ca269a GitHub-Last-Rev: dbdffcb43206e94ef130ecadd1c82a8763225ac2 GitHub-Pull-Request: golang/go#32574 Reviewed-on: https://go-review.googlesource.com/c/go/+/181839 Run-TryBot: Alex Brainman <alex.brainman@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Diffstat (limited to 'src/runtime/signal_windows.go')
-rw-r--r--src/runtime/signal_windows.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/runtime/signal_windows.go b/src/runtime/signal_windows.go
index 3fc1ec5886..3b2c06b39c 100644
--- a/src/runtime/signal_windows.go
+++ b/src/runtime/signal_windows.go
@@ -171,6 +171,12 @@ var testingWER bool
//
//go:nosplit
func lastcontinuehandler(info *exceptionrecord, r *context, gp *g) int32 {
+ if islibrary || isarchive {
+ // Go DLL/archive has been loaded in a non-go program.
+ // If the exception does not originate from go, the go runtime
+ // should not take responsibility of crashing the process.
+ return _EXCEPTION_CONTINUE_SEARCH
+ }
if testingWER {
return _EXCEPTION_CONTINUE_SEARCH
}