aboutsummaryrefslogtreecommitdiffstats
path: root/vm
diff options
context:
space:
mode:
authorAleksandr Nogikh <nogikh@google.com>2024-12-02 15:28:23 +0100
committerAleksandr Nogikh <nogikh@google.com>2024-12-03 09:29:37 +0000
commit9bacd5a34e12f90560c1d594634e0526185facde (patch)
tree312ea303b0dead377335dbf652bdf43773aa2947 /vm
parent578925bcbcaef470c75aea9e463ca6a44ac10c17 (diff)
pkg/report: detect the lost connection crash type
Diffstat (limited to 'vm')
-rw-r--r--vm/vm.go6
-rw-r--r--vm/vm_test.go8
2 files changed, 14 insertions, 0 deletions
diff --git a/vm/vm.go b/vm/vm.go
index 91398167d..7d580e837 100644
--- a/vm/vm.go
+++ b/vm/vm.go
@@ -24,6 +24,7 @@ import (
"github.com/google/syzkaller/pkg/mgrconfig"
"github.com/google/syzkaller/pkg/osutil"
"github.com/google/syzkaller/pkg/report"
+ "github.com/google/syzkaller/pkg/report/crash"
"github.com/google/syzkaller/pkg/stat"
"github.com/google/syzkaller/sys/targets"
"github.com/google/syzkaller/vm/dispatcher"
@@ -498,10 +499,15 @@ func (mon *monitor) createReport(defaultError string) *report.Report {
if defaultError == "" {
return nil
}
+ typ := crash.UnknownType
+ if defaultError == lostConnectionCrash {
+ typ = crash.LostConnection
+ }
return &report.Report{
Title: defaultError,
Output: mon.output,
Suppressed: report.IsSuppressed(mon.reporter, mon.output),
+ Type: typ,
}
}
start := rep.StartPos - mon.beforeContext
diff --git a/vm/vm_test.go b/vm/vm_test.go
index bede53fb7..434446083 100644
--- a/vm/vm_test.go
+++ b/vm/vm_test.go
@@ -11,6 +11,7 @@ import (
"github.com/google/syzkaller/pkg/mgrconfig"
"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"
)
@@ -115,6 +116,7 @@ var tests = []*Test{
},
Report: &report.Report{
Title: lostConnectionCrash,
+ Type: crash.LostConnection,
},
},
{
@@ -135,6 +137,7 @@ var tests = []*Test{
Output: []byte(
"DIAGNOSE\n",
),
+ Type: crash.LostConnection,
},
},
{
@@ -150,6 +153,7 @@ var tests = []*Test{
"VM DIAGNOSIS:\n" +
"DIAGNOSE\n",
),
+ Type: crash.LostConnection,
},
},
{
@@ -237,6 +241,7 @@ var tests = []*Test{
},
Report: &report.Report{
Title: lostConnectionCrash,
+ Type: crash.LostConnection,
},
},
{
@@ -417,6 +422,9 @@ func testMonitorExecution(t *testing.T, test *Test) {
if test.Report.Output != nil && !bytes.Equal(test.Report.Output, rep.Output) {
t.Fatalf("want output:\n%s\n\ngot output:\n%s", test.Report.Output, rep.Output)
}
+ if test.Report.Type != rep.Type {
+ t.Fatalf("want type %q, got type %q", test.Report.Type, rep.Type)
+ }
}
func TestVMType(t *testing.T) {