From 8ba1a581b0871089bc1d4df17c1d97f1a18357ff Mon Sep 17 00:00:00 2001 From: Aleksandr Nogikh Date: Thu, 22 Aug 2024 14:25:13 +0200 Subject: pkg/report: extract the syz-executor info For Linux bugs, extract the proc id and the prog id from the crash report. --- pkg/report/linux.go | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'pkg/report/linux.go') diff --git a/pkg/report/linux.go b/pkg/report/linux.go index 959089d70..216fcf18e 100644 --- a/pkg/report/linux.go +++ b/pkg/report/linux.go @@ -189,6 +189,7 @@ 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) if !rep.Corrupted { rep.Corrupted, rep.CorruptedReason = ctx.isCorrupted(title, report, format) } @@ -890,6 +891,26 @@ func (ctx *linux) isCorrupted(title string, report []byte, format oopsFormat) (b return false, "" } +var syzLinuxCommRe = regexp.MustCompile(` Comm: syz\.(\d+)\.(\d+) `) + +func (ctx *linux) setExecutorInfo(rep *Report) { + match := syzLinuxCommRe.FindSubmatch(rep.Report) + if match == nil { + return + } + info := &ExecutorInfo{} + var err error + info.ProcID, err = strconv.Atoi(string(match[1])) + if err != nil { + return + } + info.ExecID, err = strconv.Atoi(string(match[2])) + if err != nil { + return + } + rep.Executor = info +} + func linuxStallFrameExtractor(frames []string) string { // During rcu stalls and cpu lockups kernel loops in some part of code, // usually across several functions. When the stall is detected, traceback -- cgit mrf-deployment