From 367d6e2f26472340aebf50604137461000c681dd Mon Sep 17 00:00:00 2001 From: Pimyn Girgis Date: Fri, 10 Oct 2025 11:37:05 +0000 Subject: 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. --- pkg/report/linux.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'pkg/report') diff --git a/pkg/report/linux.go b/pkg/report/linux.go index fdf960015..ace1d5ac4 100644 --- a/pkg/report/linux.go +++ b/pkg/report/linux.go @@ -1148,7 +1148,8 @@ var linuxStackParams = &stackParams{ regexp.MustCompile(`Freed:`), regexp.MustCompile(`Freed by task [0-9]+:`), // Match 'backtrace:', but exclude 'stack backtrace:' - regexp.MustCompile(`[^k] backtrace:`), + // Also match optional crc hash for KMEMLEAK reports. + regexp.MustCompile(`[^k] backtrace(?: \(crc [[:xdigit:]]*\))?:`), regexp.MustCompile(`Backtrace:`), regexp.MustCompile(`Uninit was stored to memory at`), }, @@ -1754,7 +1755,7 @@ var linuxOopses = append([]*oops{ fmt: "memory leak in %[1]v", stack: &stackFmt{ parts: []*regexp.Regexp{ - compile("backtrace:"), + compile("backtrace(?: \\(crc [[:xdigit:]]*\\))?:"), parseStackTrace, }, skip: []string{"kmemleak", "mmap", "kmem", "slab", "alloc", "create_object", -- cgit mrf-deployment