pkg/report: add simplistic fuchsia reporter

This commit is contained in:
Dmitry Vyukov 2018-06-06 16:29:59 +02:00
parent 97d44b0288
commit a6bf43aeeb
6 changed files with 317 additions and 1 deletions

56
pkg/report/fuchsia.go Normal file
View File

@ -0,0 +1,56 @@
// Copyright 2017 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"
"github.com/google/syzkaller/pkg/symbolizer"
)
type fuchsia struct {
kernelSrc string
kernelObj string
symbols map[string][]symbolizer.Symbol
ignores []*regexp.Regexp
}
func ctorFuchsia(kernelSrc, kernelObj string, symbols map[string][]symbolizer.Symbol,
ignores []*regexp.Regexp) (Reporter, error) {
ctx := &fuchsia{
kernelSrc: kernelSrc,
kernelObj: kernelObj,
symbols: symbols,
ignores: ignores,
}
return ctx, nil
}
func (ctx *fuchsia) ContainsCrash(output []byte) bool {
return bytes.Contains(output, []byte("ZIRCON KERNEL PANIC")) ||
bytes.Contains(output, []byte("Supervisor Page Fault"))
}
func (ctx *fuchsia) Parse(output []byte) *Report {
title, pos := "", 0
if pos = bytes.Index(output, []byte("ZIRCON KERNEL PANIC")); pos != -1 {
title = "ZIRCON KERNEL PANIC"
} else if pos = bytes.Index(output, []byte("Supervisor Page Fault")); pos != -1 {
title = "Supervisor Page Fault"
} else {
return nil
}
return &Report{
Title: title,
Report: output,
Output: output,
StartPos: pos,
EndPos: pos + len(title),
}
}
func (ctx *fuchsia) Symbolize(rep *Report) error {
return nil
}

View File

@ -71,7 +71,7 @@ var ctors = map[string]fn{
"linux": ctorLinux,
"freebsd": ctorFreebsd,
"netbsd": ctorNetbsd,
"fuchsia": ctorStub,
"fuchsia": ctorFuchsia,
"windows": ctorStub,
}

93
pkg/report/testdata/fuchsia/report/0 vendored Normal file
View File

@ -0,0 +1,93 @@
TITLE: ZIRCON KERNEL PANIC
gfxconsole: rows <PAGE FAULT> Instruction Pointer = 0x10:0xffffffff801a41a7
48<PAGE FAULT> Stack Pointer = 0x18:0xffffff9951906e90
, columns <PAGE FAULT> Fault Linear Address = 0xb0
113<PAGE FAULT> Error Code Value = 0x0
, extray <PAGE FAULT> Error Code Type = supervisor read data, page not present
0dump_thread: t 0xffffff806c388ae0 (/syz-executor:initial-thread)
state run, curr/last cpu 0/0, cpu_affinity 0xffffffff, priority 16:0, remaining time slice 6101766
runtime_ns 11497170, runtime_s 0
stack 0xffffff9951905000, stack_size 8192
entry 0xffffffff8015262c, arg 0xffffff806c3888c0, flags 0x0
ZIRCON KERNEL PANIC
UPTIME: wait queue 0, blocked_status 0, interruptable 0
311133 aspace 0xffffff806c372d98
ms
user_thread 0xffffff806c3888c0, pid 1923727, tid 1923758
BUILDID stopping other cpus
git-9fd63dbbac9589e8c902f28e73f9e980a859fc7d-dirtyhalting cpu 3
dso: id=9c808053206b45ef38224aa56daad5e8aac8c998 base=0xffffffff80100000 name=zircon.elf
vector 14
recursion in interrupt handler
CS: 0x10 RIP: 0xffffffff801066f3 EFL: 0x10006 CR2: 0x38
RAX: 0 RBX: 0xffffff995190ee50 RCX: 0x2 RDX: 0
RSI: 0xe00 RDI: 0x2003002 RBP: 0xffffff995190ee40 RSP: 0xffffff995190ee00
R8: 0xab R9: 0xffffffff801dc0b6 R10: 0xffffff806c343508 R11: 0
R12: 0x10 R13: 0 R14: 0xc R15: 0x1d
errc: 0
bottom of kernel stack at 0xffffff995190ed50:
0xffffff995190ed50: 02003002 00000000 00000e00 00000000 |.0..............|
0xffffff995190ed60: 5190ee40 ffffff99 5190ee50 ffffff99 |@..Q....P..Q....|
0xffffff995190ed70: 00000000 00000000 00000002 00000000 |................|
0xffffff995190ed80: 00000000 00000000 000000ab 00000000 |................|
0xffffff995190ed90: 801dc0b6 ffffffff 6c343508 ffffff80 |.........54l....|
0xffffff995190eda0: 00000000 00000000 00000010 00000000 |................|
0xffffff995190edb0: 00000000 00000000 0000000c 00000000 |................|
0xffffff995190edc0: 0000001d 00000000 0000000e 00000000 |................|
platform_halt suggested_action 0 reason 9
Halting...
Halted
entering panic shell loop
! vector 14
Supervisor Page Fault exception, halting
CS: 0x10 RIP: 0xffffffff801a41a7 EFL: 0x10202 CR2: 0xb0
RAX: 0xffffff801ea2a830 RBX: 0xffffff806c324770 RCX: 0 RDX: 0xb0
RSI: 0xffffff9951906eb8 RDI: 0xffffffff802876c0 RBP: 0xffffff9951906ea0 RSP: 0xffffff9951906e90
R8: 0x200 R9: 0xffffffff801d4e58 R10: 0x4578b7f95dd0 R11: 0xffffffff801d698a
R12: 0 R13: 0x41000 R14: 0xffffff9951906f50 R15: 0x63e5e31e8d20
errc: 0
bottom of kernel stack at 0xffffff9951906de0:
0xffffff9951906de0: 802876c0 ffffffff 51906eb8 ffffff99 |.v(......n.Q....|
0xffffff9951906df0: 51906ea0 ffffff99 6c324770 ffffff80 |.n.Q....pG2l....|
0xffffff9951906e00: 000000b0 00000000 00000000 00000000 |................|
0xffffff9951906e10: 1ea2a830 ffffff80 00000200 00000000 |0...............|
0xffffff9951906e20: 801d4e58 ffffffff b7f95dd0 00004578 |XN.......]..xE..|
0xffffff9951906e30: 801d698a ffffffff 00000000 00000000 |.i..............|
0xffffff9951906e40: 00041000 00000000 51906f50 ffffff99 |........Po.Q....|
0xffffff9951906e50: e31e8d20 000063e5 0000000e 00000000 | ....c..........|
platform_halt suggested_action 0 reason 9
Halting...
bt#00: 0xffffffff8010659d
bt#01: 0xffffffff80106eaa
bt#02: 0xffffffff80113fd3
bt#03: 0xffffffff801a5fd4
bt#04: 0xffffffff801a6109
bt#05: 0xffffffff80175177
bt#06: 0xffffffff8015a1e4
bt#07: 0xffffffff80114569
bt#08: end
start of symbolized stack:
pc: 0xffffffff801a41a7 => fbl::DoublyLinkedList<VmObject*, VmObject::GlobalListTraits>::internal_insert(VmObject*, VmObject*&&) at ../../zircon/system/ulib/fbl/include/fbl/intrusive_double_list.h:549
(inlined by) fbl::DoublyLinkedList<VmObject*, VmObject::GlobalListTraits>::push_back(VmObject*&&) at ../../zircon/system/ulib/fbl/include/fbl/intrusive_double_list.h:174
(inlined by) VmObject::VmObject(fbl::RefPtr<VmObject>) at ../../zircon/kernel/vm/vm_object.cpp:41
bt#00: 0xffffffff8010659d => exception_die(x86_64_iframe*, char const*) at ../../zircon/kernel/arch/x86/faults.cpp:72
bt#01: 0xffffffff80106eaa => x86_fatal_pfe_handler at ../../zircon/kernel/arch/x86/faults.cpp:223
(inlined by) x86_exception_handler at ../../zircon/kernel/arch/x86/faults.cpp:379
bt#02: 0xffffffff80113fd3 => interrupt_common at ../../zircon/kernel/arch/x86/exceptions.S:125
bt#03: 0xffffffff801a5fd4 => VmObjectPaged::VmObjectPaged(unsigned int, fbl::RefPtr<VmObject>) at ../../zircon/kernel/vm/vm_object_paged.cpp:55
bt#04: 0xffffffff801a6109 => VmObjectPaged::Create(unsigned int, unsigned long, fbl::RefPtr<VmObject>*) at ../../zircon/kernel/vm/vm_object_paged.cpp:83 (discriminator 1)
bt#05: 0xffffffff80175177 => sys_vmo_create(unsigned long, unsigned int, user_ptr<unsigned int>) at ../../zircon/kernel/syscalls/syscalls_vmo.cpp:40
bt#06: 0xffffffff8015a1e4 => operator() at /usr/local/google/home/dvyukov/src/fuchsia/out/build-zircon/build-zircon-pc-x86-64/gen/include/zircon/syscall-kernel-wrappers.inc:282
(inlined by) do_syscall<wrapper_vmo_create(uint64_t, uint32_t, zx_handle_t*, uint64_t)::<lambda()> > at ../../zircon/kernel/syscalls/syscalls.cpp:60
(inlined by) wrapper_vmo_create at /usr/local/google/home/dvyukov/src/fuchsia/out/build-zircon/build-zircon-pc-x86-64/gen/include/zircon/syscall-kernel-wrappers.inc:283
bt#07: 0xffffffff80114569 => x86_syscall at /usr/local/google/home/dvyukov/src/fuchsia/out/build-zircon/build-zircon-pc-x86-64/gen/include/zircon/syscall-kernel-branches.S:60
end of symbolized stack
cannot create qrcode
Halted

83
pkg/report/testdata/fuchsia/report/1 vendored Normal file
View File

@ -0,0 +1,83 @@
TITLE: ZIRCON KERNEL PANIC
ZIRCON KERNEL PANIC
UPTIME: 255780ms
stopping other cpus
BUILDID git-9fd63dbbac9589e8c902f28e73f9e980a859fc7d-dirty
halting cpu 0
dso: id=9c808053206b45ef38224aa56daad5e8aac8c998 base=0xffffffff80100000 name=zircon.elf
panic (caller 0xffffffff80106655 frame 0xffffff9a0e934eb0): DEBUG ASSERT FAILED at (system/ulib/fbl/include/fbl/ref_counted_int
ernal.h:46): magic_ == expected
Invalid magic (expect: 0x52634144, got: 0x00)
platform_halt suggested_action 0 reason 9
Halting...
bt#00: 0xffffffff80180dc8
bt#01: 0xffffffff8013d438
bt#02: 0xffffffff80106655
bt#03: 0xffffffff80106c90
bt#04: 0xffffffff80113fd3
bt#05: end
start of symbolized stack:
bt#00: 0xffffffff80180dc8 => _panic at ../../zircon/kernel/lib/debug/debug.c:42
bt#01: 0xffffffff8013d438 => fbl::internal::AdoptionValidator<true>::AssertMagic(unsigned int) const at ../../zircon/system/ulib/fbl/include/fbl/ref_counted_internal.h:43
(inlined by) fbl::internal::AdoptionValidator<true>::ValidateRelease() const at ../../zircon/system/ulib/fbl/include/fbl/ref_counted_internal.h:38
(inlined by) fbl::internal::RefCountedBase<true>::Release() const at ../../zircon/system/ulib/fbl/include/fbl/ref_counted_internal.h:113
(inlined by) fbl::RefPtr<JobDispatcher>::~RefPtr() at ../../zircon/system/ulib/fbl/include/fbl/ref_ptr.h:165
(inlined by) ExceptionPortIterator::~ExceptionPortIterator() at ../../zircon/kernel/object/exception.cpp:53
(inlined by) exception_handler_worker at ../../zircon/kernel/object/exception.cpp:155
(inlined by) dispatch_user_exception at ../../zircon/kernel/object/exception.cpp:216
bt#02: 0xffffffff80106655 => call_dispatch_user_exception at ../../zircon/kernel/arch/x86/faults.cpp:81
(inlined by) try_dispatch_user_exception at ../../zircon/kernel/arch/x86/faults.cpp:93
bt#03: 0xffffffff80106c90 => try_dispatch_user_exception at ../../zircon/kernel/arch/x86/faults.cpp:105
(inlined by) x86_invop_handler at ../../zircon/kernel/arch/x86/faults.cpp:146
(inlined by) x86_exception_handler at ../../zircon/kernel/arch/x86/faults.cpp:344
bt#04: 0xffffffff80113fd3 => interrupt_common at ../../zircon/kernel/arch/x86/exceptions.S:125
end of symbolized stack
Halted
entering panic shell loop
! vector 14
recursion in interrupt handler
CS: 0x10 RIP: 0xffffffff8012758f EFL: 0x10007 CR2: 0x210
RAX: 0x1f8 RBX: 0xffffffff80249f50 RCX: 0x3b8e54b573 RDX: 0xe
RSI: 0xffffffff80249f50 RDI: 0x2 RBP: 0xffffff9a0e918e20 RSP: 0xffffff9a0e918df0
R8: 0x200 R9: 0x3b8e54b573 R10: 0xffffffff80249f40 R11: 0x246
R12: 0 R13: 0x3b8e54b573 R14: 0x46 R15: 0xffffffff80248d40
errc: 0
bottom of kernel stack at 0xffffff9a0e918d40:
0xffffff9a0e918d40: 00000002 00000000 80249f50 ffffffff |........P.$.....|
0xffffff9a0e918d50: 0e918e20 ffffff9a 80249f50 ffffffff | .......P.$.....|
0xffffff9a0e918d60: 0000000e 00000000 8e54b573 0000003b |........s.T.;...|
0xffffff9a0e918d70: 000001f8 00000000 00000200 00000000 |................|
0xffffff9a0e918d80: 8e54b573 0000003b 80249f40 ffffffff |s.T.;...@.$.....|
0xffffff9a0e918d90: 00000246 00000000 00000000 00000000 |F...............|
0xffffff9a0e918da0: 8e54b573 0000003b 00000046 00000000 |s.T.;...F.......|
0xffffff9a0e918db0: 80248d40 ffffffff 0000000e 00000000 |@.$.............|
platform_halt suggested_action 0 reason 9
Halting...
bt#00: 0xffffffff8010659d
bt#01: 0xffffffff801069e0
bt#02: 0xffffffff80113fd3
bt#03: 0xffffffff80127959
bt#04: 0xffffffff8012431c
bt#05: 0xffffffff80127eb3
bt#06: 0xffffffff80106b1f
bt#07: 0xffffffff80113fd3
bt#08: end
start of symbolized stack:
#05: (unknown)
#00: (unknown)
#01: (unknown)
#02: (unknown)
#03: (unknown)
#04: (unknown)
#05: (unknown)
#06: (unknown)
#07: (unknown)
end of symbolized stack
Halted
entering panic shell loop

49
pkg/report/testdata/fuchsia/report/2 vendored Normal file
View File

@ -0,0 +1,49 @@
TITLE: ZIRCON KERNEL PANIC
ZIRCON KERNEL PANIC
UPTIME: 36568ms
BUILDID git-9fd63dbbac9589e8c902f28e73f9e980a859fc7d-dirty
dso: id=198a153579d0f1484482cf2ef63189a62575a4e8 base=0xffffffff80100000 name=zircon.elf
stopping other cpus
halting cpu 0
halting cpu 2
halting cpu 3
panic (caller 0xffffffff801a3c99 frame 0xffffff9f79f37c10): mutex_acquire: thread 0xffffff806c3a9f60 (pthread_t:0x3d22e7178b30)
tried to acquire mutex 0xffffff806c3301a0 it already owns.
platform_halt suggested_action 0 reason 9
Halting...
bt#00: 0xffffffff80180f18
bt#01: 0xffffffff80123a29
bt#02: 0xffffffff801a3c99
bt#03: 0xffffffff80197938
bt#04: 0xffffffff8019f90d
bt#05: 0xffffffff80106808
bt#06: 0xffffffff8011408f
bt#07: 0xffffffff801a74bb
bt#08: 0xffffffff80173b44
bt#09: 0xffffffff80158df6
bt#10: end
start of symbolized stack:
bt#00: 0xffffffff80180f18 => _panic at ../../zircon/kernel/lib/debug/debug.c:42
bt#01: 0xffffffff80123a29 => mutex_acquire at ../../zircon/kernel/kernel/mutex.c:81
bt#02: 0xffffffff801a3c99 => fbl::AutoLock::AutoLock(mutex*) at ../../zircon/system/ulib/fbl/include/fbl/auto_lock.h:31
(inlined by) fbl::AutoLock::AutoLock(fbl::Mutex*) at ../../zircon/system/ulib/fbl/include/fbl/auto_lock.h:35
(inlined by) VmMapping::PageFault(unsigned long, unsigned int) at ../../zircon/kernel/vm/vm_mapping.cpp:562
bt#03: 0xffffffff80197938 => VmAddressRegion::PageFault(unsigned long, unsigned int) at ../../zircon/kernel/vm/vm_address_region.cpp:391
bt#04: 0xffffffff8019f90d => VmAspace::PageFault(unsigned long, unsigned int) at ../../zircon/kernel/vm/vm_aspace.cpp:548
bt#05: 0xffffffff80106808 => x86_pfe_handler at ../../zircon/kernel/arch/x86/faults.cpp:273
(inlined by) x86_exception_handler at ../../zircon/kernel/arch/x86/faults.cpp:378
bt#06: 0xffffffff8011408f => interrupt_common at ../../zircon/kernel/arch/x86/exceptions.S:125
bt#07: 0xffffffff801a74bb => user_ptr<void const>::copy_array_from_user(void*, unsigned long) const at ../../zircon/kernel/lib/user_copy/include/lib/user_copy/user_ptr.h:81
(inlined by) operator() at ../../zircon/kernel/vm/vm_object_paged.cpp:1001
(inlined by) ReadWriteInternal<VmObjectPaged::WriteUser(user_ptr<void const>, uint64_t, size_t, size_t*)::<lambda(void*, size_t, size_t)> > at ../../zircon/kernel/vm/vm_object_paged.cpp:858
(inlined by) VmObjectPaged::WriteUser(user_ptr<void const>, unsigned long, unsigned long, unsigned long*) at ../../zircon/kernel/vm/vm_object_paged.cpp:1004
bt#08: 0xffffffff80173b44 => sys_process_write_memory(unsigned int, unsigned long, user_ptr<void const>, unsigned long, user_ptr<unsigned long>) at ../../zircon/kernel/syscalls/syscalls_task.cpp:542 (discriminator 1)
bt#09: 0xffffffff80158df6 => operator() at /usr/local/google/home/dvyukov/src/fuchsia/out/build-zircon/build-zircon-pc-x86-64/gen/include/zircon/syscall-kernel-wrappers.inc:187
(inlined by) do_syscall<wrapper_process_write_memory(zx_handle_t, uintptr_t, void const*, size_t, size_t*, uint64_t)::<lambda()> > at ../../zircon/kernel/syscalls/syscalls.cpp:60
(inlined by) wrapper_process_write_memory at /usr/local/google/home/dvyukov/src/fuchsia/out/build-zircon/build-zircon-pc-x86-64/gen/include/zircon/syscall-kernel-wrappers.inc:188
end of symbolized stack
Halted

35
pkg/report/testdata/fuchsia/report/3 vendored Normal file
View File

@ -0,0 +1,35 @@
TITLE: Supervisor Page Fault
vector 14
Supervisor Page Fault exception, halting
CS: 0x10 RIP: 0xffffffff8019fabf EFL: 0x10282 CR2: 0x18
RAX: 0xffffffff801d1fe0 RBX: 0xffffff806496e0e0 RCX: 0x10000 RDX: 0
RSI: 0xffffff806496e0e0 RDI: 0 RBP: 0xffffff93ab473d30 RSP: 0xffffff93ab473d20
R8: 0xa9 R9: 0xffffffff801ccd46 R10: 0 R11: 0xffffffff
R12: 0xffffff806496e0e0 R13: 0xffffff93ab473e98 R14: 0xffffff93ab473e98 R15: 0xffffff8051d507a8
errc: 0
bottom of kernel stack at 0xffffff93ab473c70:
0xffffff93ab473c70: 00000000 00000000 6496e0e0 ffffff80 |...........d....|
0xffffff93ab473c80: ab473d30 ffffff93 6496e0e0 ffffff80 |0=G........d....|
0xffffff93ab473c90: 00000000 00000000 00010000 00000000 |................|
0xffffff93ab473ca0: 801d1fe0 ffffffff 000000a9 00000000 |................|
0xffffff93ab473cb0: 801ccd46 ffffffff 00000000 00000000 |F...............|
0xffffff93ab473cc0: ffffffff 00000000 6496e0e0 ffffff80 |...........d....|
0xffffff93ab473cd0: ab473e98 ffffff93 ab473e98 ffffff93 |.>G......>G.....|
0xffffff93ab473ce0: 51d507a8 ffffff80 0000000e 00000000 |...Q............|
platform_halt suggested_action 0 reason 9
Halting...
bt#00: 0xffffffff80105861
bt#01: 0xffffffff801061bb
bt#02: 0xffffffff80112d0d
bt#03: 0xffffffff8013c8a0
bt#04: 0xffffffff801481a1
bt#05: 0xffffffff80148212
bt#06: 0xffffffff80148212
bt#07: 0xffffffff8013cee3
bt#08: 0xffffffff801b1d55
bt#09: 0xffffffff80105ad3
bt#10: end
cannot create qrcode
Halted
entering panic shell loop