aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2015-11-20 19:58:27 +0100
committerDmitry Vyukov <dvyukov@google.com>2015-11-20 19:58:27 +0100
commitb0131d4eefe908aef51ea88be98dc8a926023371 (patch)
treedde3663897c60bf2f2a0343ba54d6702482686da
parent11b28f516665846164a5a0b90a0a5e8918063d28 (diff)
manager: add support for suppressions
There are always some known bugs...
-rw-r--r--manager/main.go18
-rw-r--r--vm/qemu/qemu.go20
-rw-r--r--vm/vm.go2
3 files changed, 34 insertions, 6 deletions
diff --git a/manager/main.go b/manager/main.go
index b539e1f5c..c67661767 100644
--- a/manager/main.go
+++ b/manager/main.go
@@ -10,6 +10,7 @@ import (
"fmt"
"io/ioutil"
"log"
+ "regexp"
"strings"
"github.com/google/syzkaller/sys"
@@ -37,6 +38,7 @@ type Config struct {
Params map[string]interface{}
Enable_Syscalls []string
Disable_Syscalls []string
+ Suppressions []string
}
func main() {
@@ -62,6 +64,22 @@ func main() {
EnabledSyscalls: enabledSyscalls,
NoCover: cfg.Nocover,
}
+
+ // Add some builtin suppressions.
+ cfg.Suppressions = append(cfg.Suppressions, []string{
+ "panic: failed to start executor binary",
+ "panic: executor failed: pthread_create failed",
+ "panic: failed to create temp dir",
+ "Out of memory: Kill process .* \\(syzkaller_fuzze\\)",
+ }...)
+ for _, s := range cfg.Suppressions {
+ re, err := regexp.Compile(s)
+ if err != nil {
+ fatalf("failed to compile suppression '%v': %v", s, err)
+ }
+ vmCfg.Suppressions = append(vmCfg.Suppressions, re)
+ }
+
var instances []vm.Instance
for i := 0; i < cfg.Count; i++ {
inst, err := vm.Create(cfg.Type, vmCfg, i)
diff --git a/vm/qemu/qemu.go b/vm/qemu/qemu.go
index bcd1f3e57..be62c343e 100644
--- a/vm/qemu/qemu.go
+++ b/vm/qemu/qemu.go
@@ -34,7 +34,7 @@ type qemu struct {
crashdir string
callsFlag string
id int
- mgrPort int
+ cfg *vm.Config
}
type params struct {
@@ -92,7 +92,7 @@ func ctor(cfg *vm.Config, index int) (vm.Instance, error) {
workdir: workdir,
crashdir: crashdir,
id: index,
- mgrPort: cfg.ManagerPort,
+ cfg: cfg,
}
if cfg.EnabledSyscalls != "" {
@@ -147,7 +147,7 @@ func (q *qemu) Run() {
log: logf,
rpipe: rpipe,
wpipe: wpipe,
- mgrPort: q.mgrPort,
+ cfg: q.cfg,
cmds: make(map[*Command]bool),
}
inst.Run()
@@ -167,7 +167,7 @@ type Instance struct {
log *os.File
rpipe *os.File
wpipe *os.File
- mgrPort int
+ cfg *vm.Config
cmds map[*Command]bool
qemu *Command
}
@@ -273,7 +273,7 @@ func (inst *Instance) Run() {
// Run the binary.
cmd := inst.CreateSSHCommand(fmt.Sprintf("/syzkaller_fuzzer -name %v -executor /syzkaller_executor -manager %v:%v %v",
- inst.name, hostAddr, inst.mgrPort, inst.callsFlag))
+ inst.name, hostAddr, inst.cfg.ManagerPort, inst.callsFlag))
deadline := start.Add(time.Hour)
lastOutput := time.Now()
@@ -350,7 +350,15 @@ func (inst *Instance) Run() {
}
func (inst *Instance) SaveCrasher(output []byte) {
- ioutil.WriteFile(filepath.Join(inst.crashdir, fmt.Sprintf("crash%v-%v", inst.id, time.Now().UnixNano())), output, 0660)
+ for _, re := range inst.cfg.Suppressions {
+ if re.Match(output) {
+ log.Printf("qemu/%v: suppressing '%v'", inst.id, re.String())
+ return
+ }
+ }
+ filename := fmt.Sprintf("crash%v-%v", inst.id, time.Now().UnixNano())
+ log.Printf("qemu/%v: saving crash to %v", inst.id, filename)
+ ioutil.WriteFile(filepath.Join(inst.crashdir, filename), output, 0660)
}
func (inst *Instance) Shutdown() {
diff --git a/vm/vm.go b/vm/vm.go
index c49d5b756..e6430ec47 100644
--- a/vm/vm.go
+++ b/vm/vm.go
@@ -5,6 +5,7 @@ package vm
import (
"fmt"
+ "regexp"
)
type Instance interface {
@@ -16,6 +17,7 @@ type Config struct {
ManagerPort int
Params []byte
EnabledSyscalls string
+ Suppressions []*regexp.Regexp
NoCover bool
}