From 4e7ecf0713aa5b07b0e2b9fffb6d6e51f759900d Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Fri, 10 May 2019 10:24:57 +0200 Subject: pkg/report: preserve trackback from other CPUs For some bug types kernel produces traceback of all CPUs (which is presumably useful for these crashes). However, we currently throw it away because it has context different from the oops context. Detect such traceback and preserve output. --- pkg/report/linux.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'pkg/report/linux.go') diff --git a/pkg/report/linux.go b/pkg/report/linux.go index 8542fce37..2f179a9e8 100644 --- a/pkg/report/linux.go +++ b/pkg/report/linux.go @@ -28,6 +28,7 @@ type linux struct { consoleOutputRe *regexp.Regexp questionableRe *regexp.Regexp taskContext *regexp.Regexp + cpuContext *regexp.Regexp guiltyFileBlacklist []*regexp.Regexp reportStartIgnores []*regexp.Regexp infoMessagesWithStack [][]byte @@ -55,6 +56,7 @@ func ctorLinux(target *targets.Target, kernelSrc, kernelObj string, ignores []*r ctx.consoleOutputRe = regexp.MustCompile(`^(?:\*\* [0-9]+ printk messages dropped \*\* )?(?:.* login: )?(?:\<[0-9]+\>)?\[ *[0-9]+\.[0-9]+\](\[ *(?:C|T)[0-9]+\])? `) ctx.questionableRe = regexp.MustCompile(`(\[\<[0-9a-f]+\>\])? \? +[a-zA-Z0-9_.]+\+0x[0-9a-f]+/[0-9a-f]+`) ctx.taskContext = regexp.MustCompile(`\[ *T[0-9]+\]`) + ctx.cpuContext = regexp.MustCompile(`\[ *C[0-9]+\]`) ctx.eoi = []byte("") ctx.guiltyFileBlacklist = []*regexp.Regexp{ regexp.MustCompile(`.*\.h`), @@ -198,7 +200,7 @@ func (ctx *linux) findReport(output []byte, oops *oops, startPos int, context st } secondReportPos := 0 textLines := 0 - skipText := false + skipText, cpuTraceback := false, false for pos, next := 0, 0; pos < len(output); pos = next + 1 { next = bytes.IndexByte(output[pos:], '\n') if next != -1 { @@ -238,13 +240,19 @@ func (ctx *linux) findReport(output []byte, oops *oops, startPos int, context st } } } - if !oopsLine && (context1 != context || questionable) { + if !oopsLine && (questionable || + context1 != context && (!cpuTraceback || !ctx.cpuContext.MatchString(context1))) { continue } textLines++ skipLine := skipText if bytes.Contains(line, []byte("Disabling lock debugging due to kernel taint")) { skipLine = true + } else if bytes.Contains(line, []byte("Sending NMI from CPU")) { + // If we are doing traceback of all CPUs, then we also need to preserve output + // from other CPUs regardless of what is the current context. + // Otherwise we will throw traceback away because it does not match the oops context. + cpuTraceback = true } else if textLines > 25 && (bytes.Contains(line, []byte("Kernel panic - not syncing")) || bytes.Contains(line, []byte("WARNING: possible circular locking dependency detected"))) { -- cgit mrf-deployment