diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2017-09-22 11:09:53 +0200 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2017-09-22 13:10:55 +0200 |
| commit | 913d592f973a0155647473eaa032711fe956f8a5 (patch) | |
| tree | 29b1b2083c00d199cf4d9a30917411d923b49ef4 /tools/syz-execprog | |
| parent | c26ea367cfa790e86800ac025638ad50f95b8287 (diff) | |
all: more assorted fuchsia support
Diffstat (limited to 'tools/syz-execprog')
| -rw-r--r-- | tools/syz-execprog/execprog.go | 9 | ||||
| -rw-r--r-- | tools/syz-execprog/execprog_fuchsia.go | 9 | ||||
| -rw-r--r-- | tools/syz-execprog/execprog_linux.go | 23 |
3 files changed, 5 insertions, 36 deletions
diff --git a/tools/syz-execprog/execprog.go b/tools/syz-execprog/execprog.go index 9f2c45ba6..ff85f4032 100644 --- a/tools/syz-execprog/execprog.go +++ b/tools/syz-execprog/execprog.go @@ -14,7 +14,6 @@ import ( "os" "runtime" "sync" - "sync/atomic" "time" "github.com/google/syzkaller/pkg/cover" @@ -110,7 +109,7 @@ func main() { gate := ipc.NewGate(2**flagProcs, nil) var pos int var lastPrint time.Time - var shutdown uint32 + shutdown := make(chan struct{}) for p := 0; p < *flagProcs; p++ { pid := p go func() { @@ -146,8 +145,10 @@ func main() { logMu.Unlock() } output, info, failed, hanged, err := env.Exec(execOpts, p) - if atomic.LoadUint32(&shutdown) != 0 { + select { + case <-shutdown: return false + default: } if failed { fmt.Printf("BUG: executor-detected bug:\n%s", output) @@ -190,6 +191,6 @@ func main() { }() } - go handleInterrupt(&shutdown) + osutil.HandleInterrupts(shutdown) wg.Wait() } diff --git a/tools/syz-execprog/execprog_fuchsia.go b/tools/syz-execprog/execprog_fuchsia.go deleted file mode 100644 index 14eac9306..000000000 --- a/tools/syz-execprog/execprog_fuchsia.go +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright 2017 syzkaller project authors. All rights reserved. -// Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file. - -// +build fuchsia - -package main - -func handleInterrupt(shutdown *uint32) { -} diff --git a/tools/syz-execprog/execprog_linux.go b/tools/syz-execprog/execprog_linux.go deleted file mode 100644 index 01e74cec5..000000000 --- a/tools/syz-execprog/execprog_linux.go +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2017 syzkaller project authors. All rights reserved. -// Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file. - -package main - -import ( - "os" - "os/signal" - "sync/atomic" - "syscall" - - "github.com/google/syzkaller/pkg/log" -) - -func handleInterrupt(shutdown *uint32) { - c := make(chan os.Signal, 2) - signal.Notify(c, syscall.SIGINT) - <-c - log.Logf(0, "shutting down...") - atomic.StoreUint32(shutdown, 1) - <-c - log.Fatalf("terminating") -} |
