From e19ceedd27955b049787857898b98d7fe033dc9e Mon Sep 17 00:00:00 2001 From: Michael Pratt Date: Fri, 19 May 2017 12:00:36 -0700 Subject: 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. --- tools/syz-execprog/execprog.go | 12 ++++++------ tools/syz-stress/stress.go | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'tools') 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) } -- cgit mrf-deployment