aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/report/freebsd.go
blob: acb1aac8835ee1f405d22cf4af8a33f0d06f07c9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
// Copyright 2017 syzkaller project authors. All rights reserved.
// Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.

package report

import (
	"regexp"
)

type freebsd struct {
	*config
}

func ctorFreebsd(cfg *config) (reporterImpl, []string, error) {
	ctx := &freebsd{
		config: cfg,
	}
	return ctx, nil, nil
}

func (ctx *freebsd) ContainsCrash(output []byte) bool {
	return containsCrash(output, freebsdOopses, ctx.ignores)
}

func (ctx *freebsd) Parse(output []byte) *Report {
	return simpleLineParser(output, freebsdOopses, freebsdStackParams, ctx.ignores)
}

func (ctx *freebsd) Symbolize(rep *Report) error {
	return nil
}

var freebsdStackParams = &stackParams{}

var freebsdOopses = append([]*oops{
	{
		[]byte("Fatal trap"),
		[]oopsFormat{
			{
				title: compile("Fatal trap (.+?)\\n(?:.*\\n)+?" +
					"KDB: stack backtrace:\\n" +
					"(?:#[0-9]+ {{ADDR}} at (?:kdb_backtrace|vpanic|panic|trap_fatal|" +
					"trap_pfault|trap|calltrap|m_copydata|__rw_wlock_hard)" +
					"\\+{{ADDR}}\\n)*#[0-9]+ {{ADDR}} at {{FUNC}}{{ADDR}}"),
				fmt: "Fatal trap %[1]v in %[2]v",
			},
			{
				title: compile("(Fatal trap [0-9]+:.*) while in (?:user|kernel) mode\\n(?:.*\\n)+?" +
					"KDB: stack backtrace:\\n" +
					"(?:[a-zA-Z0-9_]+\\(\\) at [a-zA-Z0-9_]+\\+0x.*\\n)*" +
					"--- trap 0x[0-9a-fA-F]+.* ---\\n" +
					"([a-zA-Z0-9_]+)\\(\\) at [a-zA-Z0-9_]+\\+0x.*\\n"),
				fmt: "%[1]v in %[2]v",
			},
		},
		[]*regexp.Regexp{},
	},
	{
		[]byte("panic:"),
		[]oopsFormat{
			{
				title: compile("panic: ffs_write: type {{ADDR}} [0-9]+ \\([0-9]+,[0-9]+\\)"),
				fmt:   "panic: ffs_write: type ADDR X (Y,Z)",
			},
			{
				title: compile("panic: ([a-zA-Z]+[a-zA-Z0-9_]*\\(\\)) of destroyed (mutex|rmlock|rwlock|sx) @ " +
					"/.*/(sys/.*:[0-9]+)"),
				fmt: "panic: %[1]v of destroyed %[2]v at %[3]v",
			},
			{
				title: compile("panic: No chunks on the queues for sid [0-9]+\\.\\n"),
				fmt:   "panic: sctp: no chunks on the queues",
			},
			{
				title: compile("panic: size_on_all_streams = [0-9]+ smaller than control length [0-9]+\\n"),
				fmt:   "panic: size_on_all_streams smaller than control length",
			},
			{
				title: compile("panic: sbflush_internal: ccc [0-9]+ mb [0-9]+ mbcnt [0-9]+\\n"),
				fmt:   "panic: sbflush_internal: residual data",
			},
			{
				title: compile("(panic: sx lock still held)\\n(?:.*\\n)+?" +
					"KDB: stack backtrace:\\n" +
					"(?:[a-zA-Z0-9_]+\\(\\) at [a-zA-Z0-9_]+\\+0x.*\\n)*" +
					"sx_destroy\\(\\) at [a-zA-Z0-9_+/ ]+\\n" +
					"([a-zA-Z0-9_]+)\\(\\) at [a-zA-Z0-9_+/ ]+\\+0x.*\\n"),
				fmt: "%[1]v in %[2]v",
			},
			{
				title: compile("panic: pfi_dynaddr_setup: dyn is 0x[0-9a-f]+\\n"),
				fmt:   "panic: pfi_dynaddr_setup: non-NULL dyn",
			},
			{
				title: compile("(panic: ASan: Invalid access, [0-9]+-byte (?:read|write)) at {{ADDR}},.*\\n(?:.*\\n)+?" +
					"KDB: stack backtrace:\\n" +
					"(?:[a-zA-Z0-9_]+\\(\\) at [a-zA-Z0-9_]+\\+0x.*\\n)*" +
					"__asan_.*\\(\\) at [a-zA-Z0-9_+/ ]+\\n" +
					"([a-zA-Z0-9_]+)\\(\\) at [a-zA-Z0-9_+/ ]+\\+0x.*\\n"),
				fmt: "%[1]v in %[2]v",
			},
		},
		[]*regexp.Regexp{},
	},
	&groupGoRuntimeErrors,
}, commonOopses...)