Skip to content

Commit 3fce097

Browse files
committed
pkg/report: support optional CRC in backtrace lines
At some point kmemleak started adding a CRC checksum to the "backtrace:" line in memory leak reports. The existing regular expression did not account for this, causing parsing to fail for these reports. Update the regex to make the CRC component optional, allowing reports both with and without the checksum to be parsed correctly. Fixes #4728.
1 parent 16fc45b commit 3fce097

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

pkg/report/linux.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1148,7 +1148,8 @@ var linuxStackParams = &stackParams{
11481148
regexp.MustCompile(`Freed:`),
11491149
regexp.MustCompile(`Freed by task [0-9]+:`),
11501150
// Match 'backtrace:', but exclude 'stack backtrace:'
1151-
regexp.MustCompile(`[^k] backtrace:`),
1151+
// Also match optional crc hash for KMEMLEAK reports.
1152+
regexp.MustCompile(`[^k] backtrace(?: \(crc [[:xdigit:]]*\))?:`),
11521153
regexp.MustCompile(`Backtrace:`),
11531154
regexp.MustCompile(`Uninit was stored to memory at`),
11541155
},
@@ -1750,7 +1751,7 @@ var linuxOopses = append([]*oops{
17501751
fmt: "memory leak in %[1]v",
17511752
stack: &stackFmt{
17521753
parts: []*regexp.Regexp{
1753-
compile("backtrace:"),
1754+
compile("backtrace(?: \\(crc [[:xdigit:]]*\\))?:"),
17541755
parseStackTrace,
17551756
},
17561757
skip: []string{"kmemleak", "mmap", "kmem", "slab", "alloc", "create_object",

0 commit comments

Comments
 (0)