Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions pkg/report/linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -187,10 +187,10 @@ func (ctx *linux) Parse(output []byte) *Report {
}
rep.reportPrefixLen = len(rep.Report)
rep.Report = append(rep.Report, report...)
setReportType(rep, oops, format)
ctx.setExecutorInfo(rep)
rep.setType(format.reportType, oops.defaultReportType)
setExecutorInfo(rep)
if !rep.Corrupted {
rep.Corrupted, rep.CorruptedReason = ctx.isCorrupted(title, report, format)
rep.Corrupted, rep.CorruptedReason = isCorrupted(title, report, format)
}
if rep.CorruptedReason == corruptedNoFrames && context != contextConsole && !questionable {
// We used to look at questionable frame with the following incentive:
Expand Down Expand Up @@ -843,7 +843,7 @@ func getMaintainersImpl(kernelSrc, file string, blame bool) (vcs.Recipients, err
return vcs.ParseMaintainersLinux(output), nil
}

func (ctx *linux) isCorrupted(title string, report []byte, format oopsFormat) (bool, string) {
func isCorrupted(title string, report []byte, format oopsFormat) (bool, string) {
// Check for common title corruptions.
for _, re := range linuxCorruptedTitles {
if re.MatchString(title) {
Expand Down Expand Up @@ -899,7 +899,7 @@ func (ctx *linux) isCorrupted(title string, report []byte, format oopsFormat) (b

var syzLinuxCommRe = regexp.MustCompile(` Comm: syz\.(\d+)\.(\d+) `)

func (ctx *linux) setExecutorInfo(rep *Report) {
func setExecutorInfo(rep *Report) {
match := syzLinuxCommRe.FindSubmatch(rep.Report)
if match == nil {
return
Expand Down
34 changes: 17 additions & 17 deletions pkg/report/report.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,22 @@ type ExecutorInfo struct {
ExecID int // The program the syz-executor was executing.
}

func (r Report) String() string {
return fmt.Sprintf("crash: %v\n%s", r.Title, r.Report)
// unspecifiedType can be used to cancel oops.defaultReportType from oopsFormat.reportType.
const unspecifiedType = crash.Type("UNSPECIFIED")

func (rep *Report) setType(typ, defaultType crash.Type) {
if typ == unspecifiedType {
rep.Type = crash.UnknownType
} else if typ != crash.UnknownType {
rep.Type = typ
} else {
rep.Type = defaultType
}
}

// unspecifiedType can be used to cancel oops.reportType from oopsFormat.reportType.
const unspecifiedType = crash.Type("UNSPECIFIED")
func (rep *Report) String() string {
return fmt.Sprintf("crash: %v\n%s", rep.Title, rep.Report)
}

// NewReporter creates reporter for the specified OS/Type.
func NewReporter(cfg *mgrconfig.Config) (*Reporter, error) {
Expand Down Expand Up @@ -239,16 +249,6 @@ func (reporter *Reporter) Symbolize(rep *Report) error {
return nil
}

func setReportType(rep *Report, oops *oops, format oopsFormat) {
if format.reportType == unspecifiedType {
rep.Type = crash.UnknownType
} else if format.reportType != crash.UnknownType {
rep.Type = format.reportType
} else if oops.reportType != crash.UnknownType {
rep.Type = oops.reportType
}
}

func (reporter *Reporter) isInteresting(rep *Report) bool {
if len(reporter.interests) == 0 {
return true
Expand Down Expand Up @@ -405,8 +405,8 @@ type oops struct {
header []byte
formats []oopsFormat
suppressions []*regexp.Regexp
// This reportType will be used if oopsFormat's reportType is empty.
reportType crash.Type
// defaultReportType will be used if oopsFormat's reportType is empty.
defaultReportType crash.Type
}

type oopsFormat struct {
Expand Down Expand Up @@ -812,7 +812,7 @@ func simpleLineParser(output []byte, oopses []*oops, params *stackParams, ignore
rep.Report = output[rep.StartPos:]
rep.Corrupted = corrupted != ""
rep.CorruptedReason = corrupted
setReportType(rep, oops, format)
rep.setType(format.reportType, oops.defaultReportType)

return rep
}
Expand Down