aboutsummaryrefslogtreecommitdiffstats
path: root/vm
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 /vm
parent11b28f516665846164a5a0b90a0a5e8918063d28 (diff)
manager: add support for suppressions
There are always some known bugs...
Diffstat (limited to 'vm')
-rw-r--r--vm/qemu/qemu.go20
-rw-r--r--vm/vm.go2
2 files changed, 16 insertions, 6 deletions
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
}