aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorMichael Pratt <mpratt@google.com>2017-05-19 12:00:36 -0700
committerMichael Pratt <mpratt@google.com>2017-05-19 16:14:57 -0700
commite19ceedd27955b049787857898b98d7fe033dc9e (patch)
tree9f74b6202d61969b07b3affd8a33ae34c4633aab /tools
parentea8a55cd916442d4643bca92c2fe7d638f7e9746 (diff)
ipc: add an optional 'abort' signal
If an external sandbox process wraps the executor, it may be helpful to send a signal other than SIGKILL to the sandbox when the program times out or fails to respond. This gives the sandbox the opportunity to emit additional debugging information before exiting. Add an 'abort' signal to ipc, which is sent to the executor before SIGKILL. If the executor fails to exit within 5s, the signal is upgraded to SIGKILL. The default abort signal remains SIGKILL, maintaining existing behavior.
Diffstat (limited to 'tools')
-rw-r--r--tools/syz-execprog/execprog.go12
-rw-r--r--tools/syz-stress/stress.go4
2 files changed, 8 insertions, 8 deletions
diff --git a/tools/syz-execprog/execprog.go b/tools/syz-execprog/execprog.go
index 7e0a25d75..1992279a7 100644
--- a/tools/syz-execprog/execprog.go
+++ b/tools/syz-execprog/execprog.go
@@ -56,14 +56,14 @@ func main() {
return
}
- flags, timeout, err := ipc.DefaultFlags()
+ config, err := ipc.DefaultConfig()
if err != nil {
Fatalf("%v", err)
}
- needCover := flags&ipc.FlagSignal != 0
+ needCover := config.Flags&ipc.FlagSignal != 0
dedupCover := true
if *flagCoverFile != "" {
- flags |= ipc.FlagSignal
+ config.Flags |= ipc.FlagSignal
needCover = true
dedupCover = false
}
@@ -75,7 +75,7 @@ func main() {
}
}
if handled["syz_emit_ethernet"] {
- flags |= ipc.FlagEnableTun
+ config.Flags |= ipc.FlagEnableTun
}
var wg sync.WaitGroup
@@ -89,7 +89,7 @@ func main() {
pid := p
go func() {
defer wg.Done()
- env, err := ipc.MakeEnv(*flagExecutor, timeout, flags, pid)
+ env, err := ipc.MakeEnv(*flagExecutor, pid, config)
if err != nil {
Fatalf("failed to create ipc env: %v", err)
}
@@ -126,7 +126,7 @@ func main() {
if failed {
fmt.Printf("BUG: executor-detected bug:\n%s", output)
}
- if flags&ipc.FlagDebug != 0 || err != nil {
+ if config.Flags&ipc.FlagDebug != 0 || err != nil {
fmt.Printf("result: failed=%v hanged=%v err=%v\n\n%s", failed, hanged, err, output)
}
if *flagCoverFile != "" {
diff --git a/tools/syz-stress/stress.go b/tools/syz-stress/stress.go
index 043af44fd..87f016504 100644
--- a/tools/syz-stress/stress.go
+++ b/tools/syz-stress/stress.go
@@ -50,7 +50,7 @@ func main() {
prios := prog.CalculatePriorities(corpus)
ct := prog.BuildChoiceTable(prios, calls)
- flags, timeout, err := ipc.DefaultFlags()
+ config, err := ipc.DefaultConfig()
if err != nil {
Fatalf("%v", err)
}
@@ -58,7 +58,7 @@ func main() {
for pid := 0; pid < *flagProcs; pid++ {
pid := pid
go func() {
- env, err := ipc.MakeEnv(*flagExecutor, timeout, flags, pid)
+ env, err := ipc.MakeEnv(*flagExecutor, pid, config)
if err != nil {
Fatalf("failed to create execution environment: %v", err)
}