Skip to content

Commit

Permalink
pkg/report: don't record error for empty repro log case
Browse files Browse the repository at this point in the history
It's not entirely normal, but it can still happen and it's not a big
problem by itself. Let's not pollute our error logs.
  • Loading branch information
a-nogikh committed May 25, 2023
1 parent 49dc4c1 commit b247b6b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
5 changes: 4 additions & 1 deletion pkg/repro/repro.go
Expand Up @@ -5,6 +5,7 @@ package repro

import (
"bytes"
"errors"
"fmt"
"sort"
"sync"
Expand Down Expand Up @@ -59,14 +60,16 @@ type context struct {
timeouts targets.Timeouts
}

var ErrNoPrograms = errors.New("crash log does not contain any programs")

func Run(crashLog []byte, cfg *mgrconfig.Config, features *host.Features, reporter *report.Reporter,
vmPool *vm.Pool, vmIndexes []int) (*Result, *Stats, error) {
if len(vmIndexes) == 0 {
return nil, nil, fmt.Errorf("no VMs provided")
}
entries := cfg.Target.ParseLog(crashLog)
if len(entries) == 0 {
return nil, nil, fmt.Errorf("crash log does not contain any programs")
return nil, nil, ErrNoPrograms
}
crashStart := len(crashLog)
crashTitle, crashType := "", report.Unknown
Expand Down
13 changes: 12 additions & 1 deletion syz-manager/manager.go
Expand Up @@ -437,7 +437,7 @@ func (mgr *Manager) vmLoop() {
log.Logf(1, "loop: repro on %+v finished '%v', repro=%v crepro=%v desc='%v'",
res.instances, res.report0.Title, res.repro != nil, crepro, title)
if res.err != nil {
log.Errorf("repro failed: %v", res.err)
reportReproError(res.err)
}
delete(reproducing, res.report0.Title)
if res.repro == nil {
Expand Down Expand Up @@ -468,6 +468,17 @@ func (mgr *Manager) vmLoop() {
}
}

func reportReproError(err error) {
switch err {
case repro.ErrNoPrograms:
// This is not extraordinary as programs are collected via SSH.
log.Logf(0, "repro failed: %v", err)
default:
// Report everything else as errors.
log.Errorf("repro failed: %v", err)
}
}

func (mgr *Manager) runRepro(crash *Crash, vmIndexes []int, putInstances func(...int)) *ReproResult {
features := mgr.checkResult.Features
res, stats, err := repro.Run(crash.Output, mgr.cfg, features, mgr.reporter, mgr.vmPool, vmIndexes)
Expand Down

0 comments on commit b247b6b

Please sign in to comment.