diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2019-05-10 10:24:57 +0200 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2019-05-10 10:31:07 +0200 |
| commit | 4e7ecf0713aa5b07b0e2b9fffb6d6e51f759900d (patch) | |
| tree | 6c4dee1d0d3040df68d55b66093bb5e27475445c /pkg/report/linux.go | |
| parent | e551e0ce0db45b722ab6d8eaba10c16bf5d28e8a (diff) | |
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.
Diffstat (limited to 'pkg/report/linux.go')
| -rw-r--r-- | pkg/report/linux.go | 12 |
1 files changed, 10 insertions, 2 deletions
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("<EOI>") 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"))) { |
