-
Notifications
You must be signed in to change notification settings - Fork 17.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
runtime: crash on SI_USER SigPanic signal
Clean up the code a little bit to make it clearer: Don't check throwsplit for a SI_USER signal. If throwsplit is set for a SigPanic signal, always throw; discard any other flags. Fixes #36420 Change-Id: Ic9dcd1108603d241f71c040504dfdc6e528f9767 Reviewed-on: https://go-review.googlesource.com/c/go/+/228900 Run-TryBot: Ian Lance Taylor <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Austin Clements <[email protected]>
- Loading branch information
1 parent
5a75f7c
commit e5bd6e1
Showing
4 changed files
with
96 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
// Copyright 2020 The Go Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style | ||
// license that can be found in the LICENSE file. | ||
|
||
// +build !plan9,!windows | ||
|
||
package main | ||
|
||
// static void nop() {} | ||
import "C" | ||
|
||
import ( | ||
"sync" | ||
"syscall" | ||
) | ||
|
||
func init() { | ||
register("Segv", Segv) | ||
register("SegvInCgo", SegvInCgo) | ||
} | ||
|
||
var Sum int | ||
|
||
func Segv() { | ||
c := make(chan bool) | ||
var wg sync.WaitGroup | ||
wg.Add(1) | ||
go func() { | ||
defer wg.Done() | ||
close(c) | ||
for i := 0; i < 10000; i++ { | ||
Sum += i | ||
} | ||
}() | ||
|
||
<-c | ||
|
||
syscall.Kill(syscall.Getpid(), syscall.SIGSEGV) | ||
|
||
wg.Wait() | ||
} | ||
|
||
func SegvInCgo() { | ||
c := make(chan bool) | ||
var wg sync.WaitGroup | ||
wg.Add(1) | ||
go func() { | ||
defer wg.Done() | ||
close(c) | ||
for i := 0; i < 10000; i++ { | ||
C.nop() | ||
} | ||
}() | ||
|
||
<-c | ||
|
||
syscall.Kill(syscall.Getpid(), syscall.SIGSEGV) | ||
|
||
wg.Wait() | ||
} |