From 0bbbd254473b576a405b9e7b6bae7fbe72277419 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Fri, 27 Mar 2020 06:23:11 +0100 Subject: pkg/report: fix detection of questionable frames The previous commit "pkg/report: handle cases when whole stack is questionable" mishandles frames that start with [PC] prefix before " ? ". Restore that part. --- pkg/report/linux.go | 7 +++++-- pkg/report/testdata/linux/report/95 | 21 ++++++++++++++++++++- 2 files changed, 25 insertions(+), 3 deletions(-) (limited to 'pkg') diff --git a/pkg/report/linux.go b/pkg/report/linux.go index 31b6be136..15047377e 100644 --- a/pkg/report/linux.go +++ b/pkg/report/linux.go @@ -25,6 +25,7 @@ type linux struct { consoleOutputRe *regexp.Regexp taskContext *regexp.Regexp cpuContext *regexp.Regexp + questionableFrame *regexp.Regexp guiltyFileBlacklist []*regexp.Regexp reportStartIgnores []*regexp.Regexp infoMessagesWithStack [][]byte @@ -50,6 +51,7 @@ func ctorLinux(cfg *config) (Reporter, []string, error) { ctx.consoleOutputRe = regexp.MustCompile(`^(?:\*\* [0-9]+ printk messages dropped \*\* )?(?:.* login: )?(?:\<[0-9]+\>)?\[ *[0-9]+\.[0-9]+\](\[ *(?:C|T)[0-9]+\])? `) ctx.taskContext = regexp.MustCompile(`\[ *T[0-9]+\]`) ctx.cpuContext = regexp.MustCompile(`\[ *C[0-9]+\]`) + ctx.questionableFrame = regexp.MustCompile(`(\[\<[0-9a-f]+\>\])? \? `) ctx.eoi = []byte("") ctx.guiltyFileBlacklist = []*regexp.Regexp{ regexp.MustCompile(`.*\.h`), @@ -300,8 +302,9 @@ func (ctx *linux) stripLinePrefix(line []byte, context string, useQuestionable b line = line[start+2:] if !bytes.Contains(line, ctx.eoi) { // x86_64 prefix. - if bytes.HasPrefix(line, []byte(" ? ")) { - return line[2:], !useQuestionable + if ctx.questionableFrame.Match(line) { + pos := bytes.Index(line, []byte(" ? ")) + return line[pos+2:], !useQuestionable } // powerpc suffix. if bytes.HasSuffix(line, []byte(" (unreliable)")) { diff --git a/pkg/report/testdata/linux/report/95 b/pkg/report/testdata/linux/report/95 index 031cd01dc..38736ec6f 100644 --- a/pkg/report/testdata/linux/report/95 +++ b/pkg/report/testdata/linux/report/95 @@ -32,4 +32,23 @@ TITLE: BUG: spinlock already unlocked in synchronize_sched_expedited_cpu_stop [ 108.804399] [] ? kthread_create_on_node+0x460/0x460 [ 108.811031] [] ret_from_fork+0x5c/0x90 [ 108.816532] [] ? kthread_create_on_node+0x460/0x460 - + +REPORT: +BUG: spinlock already unlocked on CPU#1, migration/1/12 + lock: rcu_sched_state+0xb40/0xc20, .magic: dead4ead, .owner: /-1, .owner_cpu: -1 +CPU: 1 PID: 12 Comm: migration/1 Not tainted 4.3.5+ #6 +Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 + 0000000000000001 ffff8801d8f6fb30 ffffffff81d0010d ffffffff837b69c0 + ffff8801d8f68340 0000000000000003 0000000000000001 0000000000000000 + ffff8801d8f6fb70 ffffffff813fba22 0000000000000046 ffff8801d8f68b80 +Call Trace: + [] dump_stack+0xc1/0x124 + [] spin_dump+0x152/0x280 + [] do_raw_spin_unlock+0x1e2/0x240 + [] _raw_spin_unlock_irqrestore+0x2c/0x60 + [] __wake_up+0x44/0x50 + [] synchronize_sched_expedited_cpu_stop+0x8a/0xa0 + [] cpu_stopper_thread+0x1f8/0x400 + [] smpboot_thread_fn+0x47c/0x880 + [] kthread+0x231/0x2c0 + [] ret_from_fork+0x5c/0x90 -- cgit mrf-deployment