diff options
author | Austin Clements <austin@google.com> | 2018-01-18 17:33:04 -0500 |
---|---|---|
committer | Austin Clements <austin@google.com> | 2018-03-08 22:55:55 +0000 |
commit | 60a9e5d613d6de21735e54ca62246e3f8ef8c8d3 (patch) | |
tree | 624041ce95b576aea8c360107d5560c980a5f268 /src/runtime/signal_windows.go | |
parent | c950a90d7240a6f2124ae38564c137b86866b191 (diff) | |
download | go-60a9e5d613d6de21735e54ca62246e3f8ef8c8d3.tar.gz go-60a9e5d613d6de21735e54ca62246e3f8ef8c8d3.zip |
runtime: ensure abort actually crashes the process
On all non-x86 arches, runtime.abort simply reads from nil.
Unfortunately, if this happens on a user stack, the signal handler
will dutifully turn this into a panicmem, which lets user defers run
and which user code can even recover from.
To fix this, add an explicit check to the signal handler that turns
faults in abort into hard crashes directly in the signal handler. This
has the added benefit of giving a register dump at the abort point.
Change-Id: If26a7f13790745ee3867db7f53b72d8281176d70
Reviewed-on: https://go-review.googlesource.com/93661
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Diffstat (limited to 'src/runtime/signal_windows.go')
-rw-r--r-- | src/runtime/signal_windows.go | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/runtime/signal_windows.go b/src/runtime/signal_windows.go index 518aac3c48..4d55f0fe6c 100644 --- a/src/runtime/signal_windows.go +++ b/src/runtime/signal_windows.go @@ -46,6 +46,11 @@ func isgoexception(info *exceptionrecord, r *context) bool { return false } + if r.ip() == funcPC(abort) || (GOARCH == "arm" && r.ip() == funcPC(abort)+4) { + // Never turn abort into a panic. + return false + } + // Go will only handle some exceptions. switch info.exceptioncode { default: |