From 2d8c311ede213548106d09f5d1785c2cb21d06e5 Mon Sep 17 00:00:00 2001 From: Andrey Konovalov Date: Fri, 8 Dec 2017 15:30:35 +0100 Subject: pkg/report: fix corrupted call trace detection linuxSymbolizeRe can match "IP: depot_fetch_stack+0x11/0x40", which is not part of the call stack trace. Add another regexp that only matches frames. --- pkg/report/linux.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'pkg/report/linux.go') diff --git a/pkg/report/linux.go b/pkg/report/linux.go index 352872366..d0be1acd8 100644 --- a/pkg/report/linux.go +++ b/pkg/report/linux.go @@ -396,7 +396,7 @@ func (ctx *linux) isCorrupted(title string, report []byte, format oopsFormat) bo corrupted := true // Check that at least one of the next 10 lines contains a frame. for i := 0; i < 10 && i < len(frames); i++ { - if bytes.Contains(frames[i], []byte("(stack is not available)")) || linuxSymbolizeRe.Match(frames[i]) { + if bytes.Contains(frames[i], []byte("(stack is not available)")) || stackFrameRe.Match(frames[i]) { corrupted = false break } @@ -411,6 +411,7 @@ func (ctx *linux) isCorrupted(title string, report []byte, format oopsFormat) bo var ( filenameRe = regexp.MustCompile(`[a-zA-Z0-9_\-\./]*[a-zA-Z0-9_\-]+\.(c|h):[0-9]+`) linuxSymbolizeRe = regexp.MustCompile(`(?:\[\<(?:[0-9a-f]+)\>\])?[ \t]+(?:[0-9]+:)?([a-zA-Z0-9_.]+)\+0x([0-9a-f]+)/0x([0-9a-f]+)`) + stackFrameRe = regexp.MustCompile(`^ *(?:\[\<(?:[0-9a-f]+)\>\])?[ \t]+(?:[0-9]+:)?([a-zA-Z0-9_.]+)\+0x([0-9a-f]+)/0x([0-9a-f]+)`) lineNumRe = regexp.MustCompile(`(:[0-9]+)+`) addrRe = regexp.MustCompile(`([^a-zA-Z])(?:0x)?[0-9a-f]{8,}`) decNumRe = regexp.MustCompile(`([^a-zA-Z])[0-9]{5,}`) -- cgit mrf-deployment