Skip to content

Commit 83981ae

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 83981ae

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

pkg/report/linux.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1148,7 +1148,7 @@ 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+
regexp.MustCompile(`[^k] backtrace(?: \(crc [[:xdigit:]]*\))?:`),
11521152
regexp.MustCompile(`Backtrace:`),
11531153
regexp.MustCompile(`Uninit was stored to memory at`),
11541154
},
@@ -1750,7 +1750,7 @@ var linuxOopses = append([]*oops{
17501750
fmt: "memory leak in %[1]v",
17511751
stack: &stackFmt{
17521752
parts: []*regexp.Regexp{
1753-
compile("backtrace:"),
1753+
compile("backtrace(?: \\(crc [[:xdigit:]]*\\))?:"),
17541754
parseStackTrace,
17551755
},
17561756
skip: []string{"kmemleak", "mmap", "kmem", "slab", "alloc", "create_object",

0 commit comments

Comments
 (0)