Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 33 additions & 2 deletions vm/qemu/qemu.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
"github.com/google/syzkaller/pkg/log"
"github.com/google/syzkaller/pkg/osutil"
"github.com/google/syzkaller/pkg/report"
"github.com/google/syzkaller/pkg/report/crash"
"github.com/google/syzkaller/sys/targets"
"github.com/google/syzkaller/vm/vmimpl"
)
Expand Down Expand Up @@ -734,8 +735,11 @@ func (inst *instance) Diagnose(rep *report.Report) ([]byte, bool) {
return output, wait
}
}
// TODO: we don't need registers on all reports. Probably only relevant for "crashes"
// (NULL derefs, paging faults, etc), but is not useful for WARNING/BUG/HANG (?).

if !needsRegisterInfo(rep) {
return nil, false
}

ret := []byte(fmt.Sprintf("%s Registers:\n", time.Now().Format("15:04:05 ")))
for cpu := 0; cpu < inst.cfg.CPU; cpu++ {
regs, err := inst.hmp("info registers", cpu)
Expand All @@ -750,6 +754,33 @@ func (inst *instance) Diagnose(rep *report.Report) ([]byte, bool) {
return ret, false
}

func needsRegisterInfo(rep *report.Report) bool {
// Do not collect register dump for the listed below report types.
// By default collect as crash (for unknown types too).
switch rep.Type {
case crash.Warning,
crash.AtomicSleep,
crash.Hang,
crash.DoS,
crash.KCSANAssert,
crash.KCSANDataRace,
crash.KCSANUnknown,
crash.KMSANInfoLeak,
crash.KMSANUninitValue,
crash.KMSANUnknown,
crash.KMSANUseAfterFreeRead,
crash.LockdepBug,
crash.MemoryLeak,
crash.RefcountWARNING,
crash.LostConnection,
crash.SyzFailure,
crash.UnexpectedReboot:
return false
default:
return true
}
}

func (inst *instance) ssh(args ...string) ([]byte, error) {
return osutil.RunCmd(time.Minute*inst.timeouts.Scale, "", "ssh", inst.sshArgs(args...)...)
}
Expand Down
Loading