aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/report/linux.go
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2018-11-22 07:40:50 +0100
committerDmitry Vyukov <dvyukov@google.com>2018-11-22 07:40:50 +0100
commit6839de7050c6949fee1d3a5fc3e53cf363a5a172 (patch)
tree24743bdb23b73a1c5a8eeb802b9bfab01e21b34c /pkg/report/linux.go
parent76b59936dab9134fbf0b81b1de7960b88ab970ef (diff)
pkg/report: fix corrupted stack trace checking
We started detecting all kernel reboots as corrupted, because we considered that after any "Allocated" line a stack trace should follow. Kernel boot output now contains: ima: Allocated hash algorithm: sha256 and there is no stack trace after that. 1. Refine stack trace regexps (we actually want to look for "Allocated by task PID:" lines). 2. Don't check stacks if report format says that it does not contain stacks.
Diffstat (limited to 'pkg/report/linux.go')
-rw-r--r--pkg/report/linux.go19
1 files changed, 12 insertions, 7 deletions
diff --git a/pkg/report/linux.go b/pkg/report/linux.go
index cec2b4e69..c397919bc 100644
--- a/pkg/report/linux.go
+++ b/pkg/report/linux.go
@@ -464,17 +464,20 @@ func (ctx *linux) extractFiles(report []byte) []string {
}
func (ctx *linux) isCorrupted(title string, report []byte, format oopsFormat) (bool, string) {
- // Check if the report contains stack trace.
- if !format.noStackTrace && !bytes.Contains(report, []byte("Call Trace")) &&
- !bytes.Contains(report, []byte("backtrace")) {
- return true, "no stack trace in report"
- }
// Check for common title corruptions.
for _, re := range linuxCorruptedTitles {
if re.MatchString(title) {
return true, "title matches corrupted regexp"
}
}
+ // Check if the report contains stack trace.
+ if !format.noStackTrace && !bytes.Contains(report, []byte("Call Trace")) &&
+ !bytes.Contains(report, []byte("backtrace")) {
+ return true, "no stack trace in report"
+ }
+ if format.noStackTrace {
+ return false, ""
+ }
// When a report contains 'Call Trace', 'backtrace', 'Allocated' or 'Freed' keywords,
// it must also contain at least a single stack frame after each of them.
for _, key := range linuxStackKeywords {
@@ -621,8 +624,10 @@ var linuxCorruptedTitles = []*regexp.Regexp{
var linuxStackKeywords = []*regexp.Regexp{
regexp.MustCompile(`Call Trace`),
- regexp.MustCompile(`Allocated`),
- regexp.MustCompile(`Freed`),
+ regexp.MustCompile(`Allocated:`),
+ regexp.MustCompile(`Allocated by task [0-9]+:`),
+ regexp.MustCompile(`Freed:`),
+ regexp.MustCompile(`Freed by task [0-9]+:`),
// Match 'backtrace:', but exclude 'stack backtrace:'
regexp.MustCompile(`[^k] backtrace:`),
}