pkg/report: add simpler reporter for akaros

This commit is contained in:
Dmitry Vyukov 2018-07-04 09:57:55 +02:00
parent 0dee9249b7
commit d9ed95ab6f
7 changed files with 303 additions and 1 deletions

87
pkg/report/akaros.go Normal file
View File

@ -0,0 +1,87 @@
// Copyright 2018 syzkaller project authors. All rights reserved.
// Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
package report
import (
"bytes"
"regexp"
)
type akaros struct {
ignores []*regexp.Regexp
}
func ctorAkaros(kernelSrc, kernelObj string, ignores []*regexp.Regexp) (Reporter, []string, error) {
ctx := &akaros{
ignores: ignores,
}
return ctx, nil, nil
}
func (ctx *akaros) ContainsCrash(output []byte) bool {
return containsCrash(output, akarosOopses, ctx.ignores)
}
func (ctx *akaros) Parse(output []byte) *Report {
rep := &Report{
Output: output,
}
var oops *oops
for pos := 0; pos < len(output); {
next := bytes.IndexByte(output[pos:], '\n')
if next != -1 {
next += pos
} else {
next = len(output)
}
line := output[pos:next]
for _, oops1 := range akarosOopses {
match := matchOops(line, oops1, ctx.ignores)
if match != -1 {
oops = oops1
rep.StartPos = pos
break
}
}
if oops != nil {
break
}
pos = next + 1
}
if oops == nil {
return nil
}
title, corrupted, _ := extractDescription(output[rep.StartPos:], oops, nil)
rep.Title = title
rep.Report = output[rep.StartPos:]
rep.Corrupted = corrupted != ""
rep.corruptedReason = corrupted
return rep
}
func (ctx *akaros) Symbolize(rep *Report) error {
return nil
}
// kernel panic at kern/src/vfs.c:1359, from core 1: assertion failed: buf == buf_end
// kernel panic at kern/src/ns/sysfile.c:719, from core 1: assertion failed: n >= sizeof(struct kdirent)
/// $ kernel panic at kern/src/slab.c:518, from core 1: [German Accent]: OOM for a small slab growth!!!
var akarosOopses = []*oops{
&oops{
[]byte("kernel panic"),
[]oopsFormat{
{
title: compile("kernel panic .* assertion failed: (.*)"),
fmt: "assertion failed: %[1]v",
noStackTrace: true,
},
{
title: compile("kernel panic .* from core [0-9]+: (.*)"),
fmt: "kernel panic: %[1]v",
noStackTrace: true,
},
},
[]*regexp.Regexp{},
},
}

View File

@ -73,7 +73,7 @@ func NewReporter(cfg *mgrconfig.Config) (Reporter, error) {
}
var ctors = map[string]fn{
"akaros": ctorStub,
"akaros": ctorAkaros,
"linux": ctorLinux,
"gvisor": ctorGvisor,
"freebsd": ctorFreebsd,

13
pkg/report/testdata/akaros/report/0 vendored Normal file
View File

@ -0,0 +1,13 @@
TITLE: kernel panic: [German Accent]: OOM for a small slab growth!!!
/ $ kernel panic at kern/src/slab.c:518, from core 1: [German Accent]: OOM for a small slab growth!!!
Entering Nanwan's Dungeon on Core 1 (Ints on):
Type 'help' for a list of commands.
ROS(Core 1)> kernel panic at kern/src/arena.c:686, from core 0: OOM!
Entering Nanwan's Dungeon on Core 0 (Ints on):
Type 'help' for a list of commands.

38
pkg/report/testdata/akaros/report/1 vendored Normal file
View File

@ -0,0 +1,38 @@
TITLE: kernel panic: Proc-ful Page Fault in the Kernel at ADDR!
HW TRAP frame at 0xfffffff00006ab90 on core 0
rax 0xffff8000044a0b60
rbx 0x000000000000000b
rcx 0xffff8000044a0b60
rdx 0x000000000000000b
rbp 0xfffffff00006ac58
rsi 0x0000000000483cda
rdi 0xffff8000044a0b60
r8 0x0000000000483cdc
r9 0x000000000000000a
r10 0xffff8000044a0b6a
r11 0xffff8000044a0b5a
r12 0xffff8000048b3020
r13 0x0000000000483cda
r14 0x0000000000010000
r15 0xffff8000044a0b60
trap 0x0000000e Page Fault
gsbs 0xffffffffc82e58c0
fsbs 0x0000000000000000
err 0x--------00000000
rip 0xffffffffc2053804
cs 0x------------0008
flag 0x0000000000010202
rsp 0xfffffff00006ac58
ss 0x------------0010
Backtrace of kernel context on Core 0:
#01 [<0xffffffffc2053804>] in memcpy
#02 [<0xffffffffc203a495>] in __qwrite
#03 [<0xffffffffc207ef26>] in pipewrite
#04 [<0xffffffffc203f3c4>] in rwrite
#05 [<0xffffffffc2057ca9>] in syscall
#06 [<0xffffffffc2057e64>] in run_local_syscall
#07 [<0xffffffffc20a957a>] in sysenter_callwrapper
kernel panic at kern/arch/x86/trap.c:311, from core 0: Proc-ful Page Fault in the Kernel at 0x0000000000483cda!
Entering Nanwan's Dungeon on Core 0 (Ints off):

15
pkg/report/testdata/akaros/report/2 vendored Normal file
View File

@ -0,0 +1,15 @@
TITLE: assertion failed: buf == buf_end
kernel panic at kern/src/vfs.c:1359, from core 1: assertion failed: buf == buf_end
Entering Nanwan's Dungeon on Core 1 (Ints on):
Type 'help' for a list of commands.
ROS(Core 1)> bash-4.3$ bt
Stack Backtrace on Core 1:
#01 [<0xffffffffc2016074>] in mon_backtrace
#02 [<0xffffffffc2017177>] in monitor
#03 [<0xffffffffc200cbfc>] in _panic
#04 [<0xffffffffc205c51c>] in generic_file_write
#05 [<0xffffffffc2053890>] in sys_write
#06 [<0xffffffffc2056919>] in syscall
#07 [<0xffffffffc2056ad4>] in run_local_syscall
#08 [<0xffffffffc20a28aa>] in sysenter_callwrapper

144
pkg/report/testdata/akaros/report/3 vendored Normal file
View File

@ -0,0 +1,144 @@
TITLE: assertion failed: page && pm_slot_check_refcnt(*page->pg_tree_slot)
Unhandled user trap in vcore context from VC 1
HW TRAP frame (partial) at 0xffffffffc82cbd20 on core 1
rax 0x0000100000011743
rbx 0x000030000005ced0
rcx 0x0000000000000001
rdx 0x0000100000011740
rbp 0x000030000005ceb0
rsi 0x0000100000008820
rdi 0x0000100000008820
r8 0x0000000000000000
r9 0x0000000000000000
r10 0x000030000005ced0
r11 0x0000000000000200
r12 0x0000000000000001
r13 0x0000000000000001
r14 0x0000000000409720
r15 0x0000000000000000
trap 0x0000000d General Protection
gsbs 0x0000000000000000
fsbs 0x0000000000000000
err 0x--------00000000
rip 0x00000000004005f0
cs 0x------------0023
flag 0x0000000000010286
rsp 0x000030000005ce98
ss 0x------------001b
err 0x0 (for PFs: User 4, Wr 2, Rd 1), aux 0x0000000000000000
Addr 0x00000000004005f0 is in syz-executor at offset 0x00000000000005f0
VM Regions for proc 540
NR: Range: Prot, Flags, File, Off
00: (0x0000000000400000 - 0x00000000004b2000): 0x00000005, 0x00000001, 0xffff800101103840, 0x0000000000000000
01: (0x00000000004b2000 - 0x00000000004b3000): 0x00000005, 0x00000002, 0xffff800101103840, 0x00000000000b2000
02: (0x00000000006b3000 - 0x00000000006b6000): 0x00000003, 0x00000002, 0xffff800101103840, 0x00000000000b3000
03: (0x00000000006b6000 - 0x0000000000925000): 0x00000003, 0x00000002, 0x0000000000000000, 0x0000000000000000
04: (0x0000100000000000 - 0x0000100000024000): 0x00000007, 0x00000022, 0x0000000000000000, 0x0000000000000000
05: (0x0000300000000000 - 0x0000300000001000): 0x00000003, 0x00000002, 0xffff800101103840, 0x0000000000000000
06: (0x0000300000001000 - 0x0000300000005000): 0x00000003, 0x00000022, 0x0000000000000000, 0x0000000000000000
07: (0x0000300000005000 - 0x0000300000007000): 0x00000007, 0x00000022, 0x0000000000000000, 0x0000000000000000
08: (0x0000300000007000 - 0x0000300000031000): 0x00000003, 0x00000022, 0x0000000000000000, 0x0000000000000000
09: (0x0000300000031000 - 0x000030000005d000): 0x00000007, 0x00000022, 0x0000000000000000, 0x0000000000000000
10: (0x00007f7fff8ff000 - 0x00007f7fff9ff000): 0x00000003, 0x00000022, 0x0000000000000000, 0x0000000000000000
Backtrace of user context on Core 1:
Offsets only matter for shared libraries
#01 Addr 0x00000000004005f0 is in syz-executor at offset 0x00000000000005f0
#02 Addr 0x0000000000410394 is in syz-executor at offset 0x0000000000010394
#03 Addr 0x000000006b3a3000 has no VMR
Unhandled user trap in vcore context from VC 0
HW TRAP frame (partial) at 0xffffffffc82cc720 on core 5
rax 0x0000100000005d03
rbx 0x00007f7fff9feb80
rcx 0x0000000000000001
rdx 0x0000100000005d00
rbp 0x00007f7fff9feb60
rsi 0x00001000000046c0
rdi 0x00001000000046c0
r8 0x0000000000000000
r9 0x0000000000000000
r10 0x00007f7fff9feb80
r11 0x0000000000000200
r12 0x0000000000000001
r13 0x0000000000000000
r14 0x0000000000409520
r15 0x0000000000000000
trap 0x0000000d General Protection
gsbs 0x0000000000000000
fsbs 0x0000000000000000
err 0x--------00000000
rip 0x00000000004005f0
cs 0x------------0023
flag 0x0000000000010206
rsp 0x00007f7fff9feb48
ss 0x------------001b
err 0x0 (for PFs: User 4, Wr 2, Rd 1), aux 0x0000000000000000
Addr 0x00000000004005f0 is in syz-executor at offset 0x00000000000005f0
VM Regions for proc 540
NR: Range: Prot, Flags, File, Off
00: (0x0000000000400000 - 0x00000000004b2000): 0x00000005, 0x00000001, 0xffff800101103840, 0x0000000000000000
01: (0x00000000004b2000 - 0x00000000004b3000): 0x00000005, 0x00000002, 0xffff800101103840, 0x00000000000b2000
02: (0x00000000006b3000 - 0x00000000006b6000): 0x00000003, 0x00000002, 0xffff800101103840, 0x00000000000b3000
03: (0x00000000006b6000 - 0x0000000000925000): 0x00000003, 0x00000002, 0x0000000000000000, 0x0000000000000000
04: (0x0000100000000000 - 0x0000100000024000): 0x00000007, 0x00000022, 0x0000000000000000, 0x0000000000000000
05: (0x0000300000000000 - 0x0000300000001000): 0x00000003, 0x00000002, 0xffff800101103840, 0x0000000000000000
06: (0x0000300000001000 - 0x0000300000005000): 0x00000003, 0x00000022, 0x0000000000000000, 0x0000000000000000
07: (0x0000300000005000 - 0x0000300000007000): 0x00000007, 0x00000022, 0x0000000000000000, 0x0000000000000000
08: (0x0000300000007000 - 0x0000300000031000): 0x00000003, 0x00000022, 0x0000000000000000, 0x0000000000000000
09: (0x0000300000031000 - 0x000030000005d000): 0x00000007, 0x00000022, 0x0000000000000000, 0x0000000000000000
10: (0x00007f7fff8ff000 - 0x00007f7fff9ff000): 0x00000003, 0x00000022, 0x0000000000000000, 0x0000000000000000
Backtrace of user context on Core 5:
Offsets only matter for shared libraries
#01 Addr 0x00000000004005f0 is in syz-executor at offset 0x00000000000005f0
#02 Addr 0x0000000000410394 is in syz-executor at offset 0x0000000000010394
#03 Addr 0x00009214b0000000 has no VMR
Unhandled user trap in vcore context from VC 0
HW TRAP frame (partial) at 0xffffffffc82cbaa0 on core 0
rax 0x0000100000005df0
rbx 0x00007f7fff9feaf0
rcx 0x00000000004368ee
rdx 0x0000100000005d00
rbp 0x00007f7fff9fead0
rsi 0x00001000000046c0
rdi 0x00001000000046c0
r8 0x0000000000000000
r9 0x0000000000000000
r10 0x00007f7fff9feaf0
r11 0x0000000000000200
r12 0x0000000000000001
r13 0x0000000000000000
r14 0x0000000000415400
r15 0x0000000000000000
trap 0x0000000d General Protection
gsbs 0x0000000000000000
fsbs 0x0000000000000000
err 0x--------00000000
rip 0x00000000004005f0
cs 0x------------0023
flag 0x0000000000010283
rsp 0x00007f7fff9feab8
ss 0x------------001b
err 0x0 (for PFs: User 4, Wr 2, Rd 1), aux 0x0000000000000000
Addr 0x00000000004005f0 is in syz-executor at offset 0x00000000000005f0
VM Regions for proc 506
NR: Range: Prot, Flags, File, Off
00: (0x0000000000400000 - 0x00000000004b2000): 0x00000005, 0x00000001, 0xffff800101103840, 0x0000000000000000
01: (0x00000000004b2000 - 0x00000000004b3000): 0x00000005, 0x00000002, 0xffff800101103840, 0x00000000000b2000
02: (0x00000000006b3000 - 0x00000000006b6000): 0x00000003, 0x00000002, 0xffff800101103840, 0x00000000000b3000
03: (0x00000000006b6000 - 0x0000000000925000): 0x00000003, 0x00000002, 0x0000000000000000, 0x0000000000000000
04: (0x0000100000000000 - 0x0000100000024000): 0x00000007, 0x00000022, 0x0000000000000000, 0x0000000000000000
05: (0x0000300000000000 - 0x0000300000001000): 0x00000003, 0x00000002, 0xffff800101103840, 0x0000000000000000
06: (0x0000300000001000 - 0x0000300000005000): 0x00000003, 0x00000022, 0x0000000000000000, 0x0000000000000000
07: (0x0000300000005000 - 0x0000300000007000): 0x00000007, 0x00000022, 0x0000000000000000, 0x0000000000000000
08: (0x0000300000007000 - 0x0000300000019000): 0x00000003, 0x00000022, 0x0000000000000000, 0x0000000000000000
09: (0x00007f7fff8ff000 - 0x00007f7fff9ff000): 0x00000003, 0x00000022, 0x0000000000000000, 0x0000000000000000
Backtrace of user context on Core 0:
Offsets only matter for shared libraries
#01 Addr 0x00000000004005f0 is in syz-executor at offset 0x00000000000005f0
#02 Addr 0x0000000000410394 is in syz-executor at offset 0x0000000000010394
#03 Addr 0x000000000c00007f has no VMR
kernel panic at kern/src/pagemap.c:222, from core 0: assertion failed: page && pm_slot_check_refcnt(*page->pg_tree_slot)
Entering Nanwan's Dungeon on Core 0 (Ints on):

5
pkg/report/testdata/akaros/report/4 vendored Normal file
View File

@ -0,0 +1,5 @@
TITLE: assertion failed: n >= sizeof(struct kdirent)
kernel panic at kern/src/ns/sysfile.c:719, from core 1: assertion failed: n >= sizeof(struct kdirent)
Entering Nanwan's Dungeon on Core 1 (Ints on):