aboutsummaryrefslogtreecommitdiffstats
path: root/pkg
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2018-06-30 13:21:17 +0200
committerDmitry Vyukov <dvyukov@google.com>2018-06-30 13:21:17 +0200
commit1d788bb883908c3db498a3e4c79b83443ac3aeab (patch)
tree3ea677acafe1d28be76a28088c930908ee835d60 /pkg
parent5739f7bef21ce8e3cee6b67f3cde2b37cb9891d4 (diff)
pkg/report: better detect hangs on fuchsia
Diffstat (limited to 'pkg')
-rw-r--r--pkg/report/fuchsia.go32
-rw-r--r--pkg/report/testdata/fuchsia/report/02
-rw-r--r--pkg/report/testdata/fuchsia/report/418
-rw-r--r--pkg/report/testdata/fuchsia/report/510
4 files changed, 50 insertions, 12 deletions
diff --git a/pkg/report/fuchsia.go b/pkg/report/fuchsia.go
index b7da7f3c1..50d93f0a1 100644
--- a/pkg/report/fuchsia.go
+++ b/pkg/report/fuchsia.go
@@ -24,6 +24,7 @@ type fuchsia struct {
var (
zirconPanic = []byte("ZIRCON KERNEL PANIC")
zirconPanicShort = []byte("KERNEL PANIC")
+ zirconKernelHang = []byte("stopping other cpus")
zirconRIP = regexp.MustCompile(` RIP: (0x[0-9a-f]+) `)
zirconBT = regexp.MustCompile(`^bt#[0-9]+: (0x[0-9a-f]+)`)
zirconReportEnd = []byte("Halted")
@@ -52,24 +53,30 @@ func ctorFuchsia(kernelSrc, kernelObj string, ignores []*regexp.Regexp) (Reporte
}
func (ctx *fuchsia) ContainsCrash(output []byte) bool {
- return bytes.Contains(output, zirconPanic)
+ return bytes.Contains(output, zirconPanic) ||
+ bytes.Contains(output, zirconKernelHang)
}
func (ctx *fuchsia) Parse(output []byte) *Report {
- pos := bytes.Index(output, zirconPanic)
- if pos == -1 {
- return nil
- }
rep := &Report{
- Title: string(zirconPanicShort),
- Output: output,
- StartPos: pos,
- EndPos: len(output),
+ Output: output,
+ EndPos: len(output),
+ }
+ wantLocation := true
+ if pos := bytes.Index(output, zirconPanic); pos != -1 {
+ rep.Title = string(zirconPanicShort)
+ rep.StartPos = pos
+ } else if pos := bytes.Index(output, zirconKernelHang); pos != -1 {
+ rep.Title = string(zirconKernelHang)
+ rep.StartPos = pos
+ wantLocation = false // these tend to produce random locations
+ } else {
+ return nil
}
symb := symbolizer.NewSymbolizer()
defer symb.Close()
where := ""
- for s := bufio.NewScanner(bytes.NewReader(output[pos:])); s.Scan(); {
+ for s := bufio.NewScanner(bytes.NewReader(output[rep.StartPos:])); s.Scan(); {
line := s.Bytes()
if len(line) == 0 || matchesAny(line, zirconUnrelated) {
continue
@@ -83,6 +90,9 @@ func (ctx *fuchsia) Parse(output []byte) *Report {
if bytes.Contains(line, []byte("Supervisor Page Fault exception")) {
rep.Title = "Supervisor fault"
}
+ if bytes.Contains(line, []byte("recursion in interrupt handler")) {
+ rep.Title = "recursion in interrupt handler"
+ }
if match := zirconRIP.FindSubmatchIndex(line); match != nil {
ctx.processPC(rep, symb, line, match, false, &where)
} else if match := zirconBT.FindSubmatchIndex(line); match != nil {
@@ -93,7 +103,7 @@ func (ctx *fuchsia) Parse(output []byte) *Report {
rep.Report = append(rep.Report, line...)
rep.Report = append(rep.Report, '\n')
}
- if where != "" {
+ if wantLocation && where != "" {
rep.Title = fmt.Sprintf("%v in %v", rep.Title, where)
}
return rep
diff --git a/pkg/report/testdata/fuchsia/report/0 b/pkg/report/testdata/fuchsia/report/0
index ca478b5af..7d09c4393 100644
--- a/pkg/report/testdata/fuchsia/report/0
+++ b/pkg/report/testdata/fuchsia/report/0
@@ -1,4 +1,4 @@
-TITLE: KERNEL PANIC
+TITLE: recursion in interrupt handler
gfxconsole: rows <PAGE FAULT> Instruction Pointer = 0x10:0xffffffff801a41a7
48<PAGE FAULT> Stack Pointer = 0x18:0xffffff9951906e90
diff --git a/pkg/report/testdata/fuchsia/report/4 b/pkg/report/testdata/fuchsia/report/4
new file mode 100644
index 000000000..f9635c1b2
--- /dev/null
+++ b/pkg/report/testdata/fuchsia/report/4
@@ -0,0 +1,18 @@
+TITLE: recursion in interrupt handler
+
+10:25:07 executing program 2:
+zx_eventpair_create(0x0, &(0x7f0000000040)=<r0=>0x0, &(0x7f0000000080)=<r1=>0x0)
+zx_handle_replace(r0, 0x800, &(0x7f00000000c0)=<r2=>0x0)
+zx_object_set_cookie(r2, r1, 0x0)
+
+gfxconsole: rows 48, columns 113, extray 0
+stopping other cpus
+vector 14
+recursion in interrupt handler
+Connection to localhost closed by remote host.
+halting cpu 0
+
+REPORT:
+vector 14
+recursion in interrupt handler
+Connection to localhost closed by remote host.
diff --git a/pkg/report/testdata/fuchsia/report/5 b/pkg/report/testdata/fuchsia/report/5
new file mode 100644
index 000000000..3ae746f92
--- /dev/null
+++ b/pkg/report/testdata/fuchsia/report/5
@@ -0,0 +1,10 @@
+TITLE: recursion in interrupt handler
+
+gfxconsole: rows stopping other cpus
+48halting cpu 0
+, columns 113, extray 0
+vector 14
+recursion in interrupt handler
+Connection to localhost closed by remote host.
+ RIP: 0x001a1f12 fillrect16 lib/gfx/gfx.c:289
+ CS: 0x10 RIP: 0xffffffff001a1f12 EFL: 0x10006 CR2: 0xffffff9bf8dab000