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/os3_plan9.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/os3_plan9.go')
-rw-r--r-- | src/runtime/os3_plan9.go | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/runtime/os3_plan9.go b/src/runtime/os3_plan9.go index b05965b63d..9158c44f2f 100644 --- a/src/runtime/os3_plan9.go +++ b/src/runtime/os3_plan9.go @@ -35,6 +35,10 @@ func sighandler(_ureg *ureg, note *byte, gp *g) int { print("sighandler: note is longer than ERRMAX\n") goto Throw } + if c.pc() == funcPC(abort) || (GOARCH == "arm" && c.pc() == funcPC(abort)+4) { + // Never turn abort into a panic. + goto Throw + } // See if the note matches one of the patterns in sigtab. // Notes that do not match any pattern can be handled at a higher // level by the program but will otherwise be ignored. |