-
Notifications
You must be signed in to change notification settings - Fork 6
/
netbsd.go
91 lines (82 loc) · 2.2 KB
/
netbsd.go
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
// 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"
"github.com/ZHYfeng/Dependency/03-syzkaller/sys/targets"
)
type netbsd struct {
kernelSrc string
kernelObj string
ignores []*regexp.Regexp
}
func ctorNetbsd(target *targets.Target, kernelSrc, kernelObj string,
ignores []*regexp.Regexp) (Reporter, []string, error) {
ignores = append(ignores, regexp.MustCompile("event_init: unable to initialize")) // postfix output
ctx := &netbsd{
kernelSrc: kernelSrc,
kernelObj: kernelObj,
ignores: ignores,
}
return ctx, nil, nil
}
func (ctx *netbsd) ContainsCrash(output []byte) bool {
return containsCrash(output, netbsdOopses, ctx.ignores)
}
func (ctx *netbsd) Parse(output []byte) *Report {
return simpleLineParser(output, netbsdOopses, nil, ctx.ignores)
}
func (ctx *netbsd) Symbolize(rep *Report) error {
return nil
}
// nolint: lll
var netbsdOopses = []*oops{
{
[]byte("fault in supervisor mode"),
[]oopsFormat{
{
title: compile("fatal (page|protection|integer divide) fault in supervisor mode"),
report: compile(`fatal (page|protection|integer divide) fault in supervisor mode(?:.*\n)+?.*trap.*?\n.*?\](.*?)\(`),
fmt: "%[1]v fault in %[2]v",
},
},
[]*regexp.Regexp{},
},
{
[]byte("panic: "),
[]oopsFormat{
{
title: compile("panic: kernel diagnostic assertion"),
report: compile(`panic: kernel diagnostic assertion "(.*?)"`),
fmt: "assert failed: %[1]v",
},
{
title: compile("panic: lock error"),
report: compile(`panic: lock error:(?:.*\n)+?.*?Begin traceback.*?\n(?:.*(?:panic|printf|lockdebug|abort|mutex).*\n)*.*?\](.*?)\(`),
fmt: "lock error in %[1]v",
},
},
[]*regexp.Regexp{},
},
{
[]byte("ASan:"),
[]oopsFormat{
{
title: compile("ASan: Unauthorized Access"),
report: compile(`ASan: Unauthorized Access (?:.*\n)+?.*in (.*)\<`),
fmt: "ASan: Unauthorized Access in %[1]v",
},
},
[]*regexp.Regexp{},
},
{
[]byte("UBSan:"),
[]oopsFormat{
{
title: compile("UBSan:"),
fmt: "UBSan: Undefined behavior",
},
},
[]*regexp.Regexp{},
},
}