diff options
| author | Babak Huseynov <mirza.bhuseynov@gmail.com> | 2025-11-05 03:33:18 +0300 |
|---|---|---|
| committer | Aleksandr Nogikh <nogikh@google.com> | 2025-11-21 11:20:11 +0000 |
| commit | 62d19cd28b707f46963fd2af8ba42a29d9ff89d7 (patch) | |
| tree | 04317970b90334b4d2216f65c430010b029164e6 | |
| parent | 52ed5c960e0415439ac0b492e5f327d6e28b1d41 (diff) | |
vm/qemu: additional check for crashes only in Diagnose
| -rw-r--r-- | vm/qemu/qemu.go | 35 |
1 files changed, 33 insertions, 2 deletions
diff --git a/vm/qemu/qemu.go b/vm/qemu/qemu.go index 55473a419..d5d10d66b 100644 --- a/vm/qemu/qemu.go +++ b/vm/qemu/qemu.go @@ -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" ) @@ -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) @@ -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...)...) } |
