aboutsummaryrefslogtreecommitdiffstats
path: root/report
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2016-10-13 13:14:08 +0200
committerDmitry Vyukov <dvyukov@google.com>2016-10-13 13:16:23 +0200
commitb3f098b002f4b68f0e3d38717bc610da268d0d18 (patch)
tree3a0227f47bf683fbfb3b8d7e0c0716ff976db3b4 /report
parent91d59fb1ce040c25f3f62014226571062f860b97 (diff)
report: use non-greedy new line matching
The intention in these regexp's is to find the first line containing e.g. func name. Currently we use greedy new line matching and find the _last_ line with func name. E.g. if we have 2 KASAN reports we will match header from the first report, but then access info from the second report. Use non-greedy new line matching to fix it.
Diffstat (limited to 'report')
-rw-r--r--report/report.go20
-rw-r--r--report/report_test.go48
2 files changed, 50 insertions, 18 deletions
diff --git a/report/report.go b/report/report.go
index 28159067a..5cf85d96b 100644
--- a/report/report.go
+++ b/report/report.go
@@ -30,15 +30,15 @@ var oopses = []*oops{
[]byte("BUG:"),
[]oopsFormat{
{
- compile("BUG: KASAN: ([a-z\\-]+) in {{FUNC}}(?:.*\\n)+.*(Read|Write) of size ([0-9]+)"),
+ compile("BUG: KASAN: ([a-z\\-]+) in {{FUNC}}(?:.*\\n)+?.*(Read|Write) of size ([0-9]+)"),
"KASAN: %[1]v %[3]v of size %[4]v in %[2]v",
},
{
- compile("BUG: KASAN: ([a-z\\-]+) on address(?:.*\\n)+.*(Read|Write) of size ([0-9]+)"),
+ compile("BUG: KASAN: ([a-z\\-]+) on address(?:.*\\n)+?.*(Read|Write) of size ([0-9]+)"),
"KASAN: %[1]v %[2]v of size %[3]v",
},
{
- compile("BUG: unable to handle kernel paging request(?:.*\\n)+.*IP: {{PC}} +{{FUNC}}"),
+ compile("BUG: unable to handle kernel paging request(?:.*\\n)+?.*IP: {{PC}} +{{FUNC}}"),
"BUG: unable to handle kernel paging request in %[1]v",
},
{
@@ -46,7 +46,7 @@ var oopses = []*oops{
"BUG: unable to handle kernel paging request",
},
{
- compile("BUG: unable to handle kernel NULL pointer dereference(?:.*\\n)+.*IP: {{PC}} +{{FUNC}}"),
+ compile("BUG: unable to handle kernel NULL pointer dereference(?:.*\\n)+?.*IP: {{PC}} +{{FUNC}}"),
"BUG: unable to handle kernel NULL pointer dereference in %[1]v",
},
{
@@ -58,7 +58,7 @@ var oopses = []*oops{
"BUG: soft lockup",
},
{
- compile("BUG: .*still has locks held!(?:.*\\n)+.*{{PC}} +{{FUNC}}"),
+ compile("BUG: .*still has locks held!(?:.*\\n)+?.*{{PC}} +{{FUNC}}"),
"BUG: still has locks held in %[1]v",
},
{
@@ -88,7 +88,7 @@ var oopses = []*oops{
[]byte("INFO:"),
[]oopsFormat{
{
- compile("INFO: possible circular locking dependency detected \\](?:.*\\n)+.*is trying to acquire lock(?:.*\\n)+.*at: {{PC}} +{{FUNC}}"),
+ compile("INFO: possible circular locking dependency detected \\](?:.*\\n)+?.*is trying to acquire lock(?:.*\\n)+?.*at: {{PC}} +{{FUNC}}"),
"possible deadlock in %[1]v",
},
{
@@ -105,7 +105,7 @@ var oopses = []*oops{
[]byte("Unable to handle kernel paging request"),
[]oopsFormat{
{
- compile("Unable to handle kernel paging request(?:.*\\n)+.*PC is at {{FUNC}}"),
+ compile("Unable to handle kernel paging request(?:.*\\n)+?.*PC is at {{FUNC}}"),
"unable to handle kernel paging request in %[1]v",
},
},
@@ -114,7 +114,7 @@ var oopses = []*oops{
[]byte("general protection fault:"),
[]oopsFormat{
{
- compile("general protection fault:(?:.*\n)+.*RIP: [0-9]+:{{PC}} +{{PC}} +{{FUNC}}"),
+ compile("general protection fault:(?:.*\\n)+?.*RIP: [0-9]+:{{PC}} +{{PC}} +{{FUNC}}"),
"general protection fault in %[1]v",
},
},
@@ -154,7 +154,7 @@ var oopses = []*oops{
[]byte("divide error:"),
[]oopsFormat{
{
- compile("divide error: (?:.*\n)+.*RIP: [0-9]+:{{PC}} +{{PC}} +{{FUNC}}"),
+ compile("divide error: (?:.*\\n)+?.*RIP: [0-9]+:{{PC}} +{{PC}} +{{FUNC}}"),
"divide error in %[1]v",
},
},
@@ -163,7 +163,7 @@ var oopses = []*oops{
[]byte("invalid opcode:"),
[]oopsFormat{
{
- compile("invalid opcode: (?:.*\n)+.*RIP: [0-9]+:{{PC}} +{{PC}} +{{FUNC}}"),
+ compile("invalid opcode: (?:.*\\n)+?.*RIP: [0-9]+:{{PC}} +{{PC}} +{{FUNC}}"),
"invalid opcode in %[1]v",
},
},
diff --git a/report/report_test.go b/report/report_test.go
index 118afffd4..6721f648e 100644
--- a/report/report_test.go
+++ b/report/report_test.go
@@ -81,6 +81,8 @@ IP: [<ffffffff810a376f>] __call_rcu.constprop.76+0x1f/0x280 kernel/rcu/tree.c:30
==================================================================
BUG: KASAN: slab-out-of-bounds in memcpy+0x1d/0x40 at addr ffff88003a6bd110
Read of size 8 by task a.out/6260
+BUG: KASAN: slab-out-of-bounds in memcpy+0x1d/0x40 at addr ffff88003a6bd110
+Write of size 4 by task a.out/6260
`: `KASAN: slab-out-of-bounds Read of size 8 in memcpy`,
`
@@ -150,14 +152,44 @@ other info that might help us debug this:
`
[ 80.586804] =====================================
-[ 80.587241] [ BUG: syz-executor/13525 still has locks held! ]
-[ 80.587792] 4.8.0+ #29 Not tainted
-[ 80.588114] -------------------------------------
-[ 80.588585] 1 lock held by syz-executor/13525:
-[ 80.588975] #0: (&pipe->mutex/1){+.+.+.}, at: [<ffffffff81844c8b>] pipe_lock+0x5b/0x70
-[ 80.589809]
-[ 80.589809] stack backtrace:
-[ 80.590236] CPU: 2 PID: 13525 Comm: syz-executor Not tainted 4.8.0+ #29
+[ 734.270366] [ BUG: syz-executor/31761 still has locks held! ]
+[ 734.307462] 4.8.0+ #30 Not tainted
+[ 734.325126] -------------------------------------
+[ 734.417271] 1 lock held by syz-executor/31761:
+[ 734.442178] #0: (&pipe->mutex/1){+.+.+.}, at: [<ffffffff81844c6b>] pipe_lock+0x5b/0x70
+[ 734.451474]
+[ 734.451474] stack backtrace:
+[ 734.521109] CPU: 0 PID: 31761 Comm: syz-executor Not tainted 4.8.0+ #30
+[ 734.527900] Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
+[ 734.537256] ffff8800458dfa38 ffffffff82d383a9 ffffffff00000000 fffffbfff1097248
+[ 734.545358] ffff88005639a700 ffff88005639a700 dffffc0000000000 ffff88005639a700
+[ 734.553482] ffff8800530148f8 ffff8800458dfa58 ffffffff81463cb5 0000000000000000
+[ 734.562654] Call Trace:
+[ 734.565257] [<ffffffff82d383a9>] dump_stack+0x12e/0x185
+[ 734.570819] [<ffffffff81463cb5>] debug_check_no_locks_held+0x125/0x140
+[ 734.577590] [<ffffffff860bae47>] unix_stream_read_generic+0x1317/0x1b70
+[ 734.584440] [<ffffffff860b9b30>] ? unix_getname+0x290/0x290
+[ 734.590238] [<ffffffff8146870b>] ? __lock_acquire+0x7fb/0x3410
+[ 734.596306] [<ffffffff81467f10>] ? debug_check_no_locks_freed+0x3c0/0x3c0
+[ 734.603322] [<ffffffff81905282>] ? fsnotify+0xca2/0x1020
+[ 734.608874] [<ffffffff81467f10>] ? debug_check_no_locks_freed+0x3c0/0x3c0
+[ 734.615894] [<ffffffff814475b0>] ? prepare_to_wait_event+0x450/0x450
+[ 734.622486] [<ffffffff860bb7fb>] unix_stream_splice_read+0x15b/0x1d0
+[ 734.629066] [<ffffffff860bb6a0>] ? unix_stream_read_generic+0x1b70/0x1b70
+[ 734.636086] [<ffffffff82b27c3a>] ? common_file_perm+0x15a/0x3a0
+[ 734.642242] [<ffffffff860b52f0>] ? unix_accept+0x460/0x460
+[ 734.647963] [<ffffffff82a5c02e>] ? security_file_permission+0x8e/0x1e0
+[ 734.654729] [<ffffffff860bb6a0>] ? unix_stream_read_generic+0x1b70/0x1b70
+[ 734.661754] [<ffffffff85afc54e>] sock_splice_read+0xbe/0x100
+[ 734.667649] [<ffffffff85afc490>] ? kernel_sock_shutdown+0x80/0x80
+[ 734.673973] [<ffffffff818d11ff>] do_splice_to+0x10f/0x170
+[ 734.679697] [<ffffffff818d6acc>] SyS_splice+0x114c/0x15b0
+[ 734.685329] [<ffffffff81506bf4>] ? SyS_futex+0x144/0x2e0
+[ 734.690961] [<ffffffff818d5980>] ? compat_SyS_vmsplice+0x250/0x250
+[ 734.697375] [<ffffffff8146750c>] ? trace_hardirqs_on_caller+0x44c/0x5e0
+[ 734.704230] [<ffffffff8100501a>] ? trace_hardirqs_on_thunk+0x1a/0x1c
+[ 734.710821] [<ffffffff86da6d05>] entry_SYSCALL_64_fastpath+0x23/0xc6
+[ 734.717436] [<ffffffff816939e7>] ? perf_event_mmap+0x77/0xb20
`: `BUG: still has locks held in pipe_lock`,
`