mirror of
https://github.com/reactos/syzkaller.git
synced 2024-11-23 19:39:40 +00:00
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.
This commit is contained in:
parent
76b59936da
commit
6839de7050
@ -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:`),
|
||||
}
|
||||
|
1139
pkg/report/testdata/linux/report/317
vendored
Normal file
1139
pkg/report/testdata/linux/report/317
vendored
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user