From 1d788bb883908c3db498a3e4c79b83443ac3aeab Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Sat, 30 Jun 2018 13:21:17 +0200 Subject: pkg/report: better detect hangs on fuchsia --- pkg/report/fuchsia.go | 32 +++++++++++++++++++++----------- pkg/report/testdata/fuchsia/report/0 | 2 +- pkg/report/testdata/fuchsia/report/4 | 18 ++++++++++++++++++ pkg/report/testdata/fuchsia/report/5 | 10 ++++++++++ 4 files changed, 50 insertions(+), 12 deletions(-) create mode 100644 pkg/report/testdata/fuchsia/report/4 create mode 100644 pkg/report/testdata/fuchsia/report/5 (limited to 'pkg') 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 Instruction Pointer = 0x10:0xffffffff801a41a7 48 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)=0x0, &(0x7f0000000080)=0x0) +zx_handle_replace(r0, 0x800, &(0x7f00000000c0)=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 -- cgit mrf-deployment