aboutsummaryrefslogtreecommitdiffstats
path: root/tools/syz-repro
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2016-01-19 17:17:40 +0100
committerDmitry Vyukov <dvyukov@google.com>2016-01-19 17:22:36 +0100
commit891b46a9a5a32dba986a8ba7e08d9192a2f9d894 (patch)
treed1f1e998cba1ee04c14a14e5e7f8a03af0814516 /tools/syz-repro
parentdfd341e3493321cb5de483efe7b2d78877aef344 (diff)
vm: faster output oops grepping
Use manual parsing instead of a regexp. Regexp takes ~220ms for typical output size. New code takes ~2ms. Brings manager CPU consumption from ~250% down to ~25%.
Diffstat (limited to 'tools/syz-repro')
-rw-r--r--tools/syz-repro/repro.go16
1 files changed, 8 insertions, 8 deletions
diff --git a/tools/syz-repro/repro.go b/tools/syz-repro/repro.go
index 2b8ad173f..a74791f62 100644
--- a/tools/syz-repro/repro.go
+++ b/tools/syz-repro/repro.go
@@ -57,11 +57,11 @@ func main() {
entries := prog.ParseLog(data)
log.Printf("parsed %v programs", len(entries))
- crashLoc := vm.CrashRe.FindIndex(data)
- if crashLoc == nil {
+ crashDesc, crashStart, _, found := vm.FindCrash(data)
+ if !found {
log.Fatalf("can't find crash message in the log")
}
- log.Printf("target crash: '%s'", data[crashLoc[0]:crashLoc[1]])
+ log.Printf("target crash: '%s'", crashDesc)
instances = make(chan VM, cfg.Count)
bootRequests = make(chan bool, cfg.Count)
@@ -90,7 +90,7 @@ func main() {
}()
}
- repro(cfg, entries, crashLoc)
+ repro(cfg, entries, crashStart)
for {
select {
@@ -102,10 +102,10 @@ func main() {
}
}
-func repro(cfg *config.Config, entries []*prog.LogEntry, crashLoc []int) {
+func repro(cfg *config.Config, entries []*prog.LogEntry, crashStart int) {
// Cut programs that were executed after crash.
for i, ent := range entries {
- if ent.Start > crashLoc[0] {
+ if ent.Start > crashStart {
entries = entries[:i]
break
}
@@ -244,8 +244,8 @@ func testImpl(inst vm.Instance, command string, timeout time.Duration) (res bool
select {
case out := <-outc:
output = append(output, out...)
- if loc := vm.CrashRe.FindIndex(output); loc != nil {
- log.Printf("program crashed with '%s'", output[loc[0]:loc[1]])
+ if desc, _, _, found := vm.FindCrash(output); found {
+ log.Printf("program crashed with '%s'", desc)
return true
}
case err := <-errc: