Apport Crash Database/Requirements

From openSUSE

Keywords: crash analysis, apport, crashdb

Contents

Summary

This page lists the requirements for an Apport Crash Database implementation for openSUSE. The first version will have reduced functionality and only include a report collector and a report viewer.

Since Apport itself is written in Python, a possible implementation of the server in Python could leverage the report parsing code.

Links:


Report Collector

The report is sent by the client side apport module. The server side generates and unique identifier that is included in the reply to the HTTP POST. The client side can use the UUID to generate an URL to track the report afterwards.

Task Status
Receive the report by HTTPS POST (on port 80)
Basic validation of received report (very simple SPAM protection)
Generate unique identifier (UUID) for the received report
Detect duplicate reports before returning the unique identifier



Report Viewer

All received reports are presented in an overview page.

Examples are:

Task Status
Overview page of all reports received
Detailed view of specific report
Overview page per product/component/application
Search in reports for free text



Example Crash Report

demo sender script

ProblemType: Crash
Architecture: i586
Date: Mon Oct 20 09:55:27 2008
DistroRelease: SUSE LINUX 11.1
ExecutablePath: /bin/cat
ProcAttrCurrent: unconfined
ProcCmdline: cat
ProcCwd: /home/jblunck
ProcEnviron:
 SHELL=/bin/bash
 PATH=/home/jblunck/bin:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/X11R6/bin:/usr/games:/opt/kde3/bin:/opt/cross/bin:/usr/lib/jvm/jre/bin:/usr/lib/mit/bin:/usr/lib/mit/sbin:/opt/gnome/bin:/usr/lib/qt3/bin:/suse/bin:/suse/bin:/suse/bin
 LANG=en_US.UTF-8
ProcMaps:
 08048000-08051000 r-xp 00000000 fd:00 65631      /bin/cat
 08051000-08052000 r--p 00008000 fd:00 65631      /bin/cat
 08052000-08053000 rw-p 00009000 fd:00 65631      /bin/cat
 08053000-08074000 rw-p 08053000 00:00 0          [heap]
 b7d9c000-b7ddb000 r--p 00000000 fd:03 544270     /usr/lib/locale/en_US.utf8/LC_CTYPE
 b7ddb000-b7ec3000 r--p 00000000 fd:03 557799     /usr/lib/locale/en_US.utf8/LC_COLLATE
 b7ec3000-b7ec4000 rw-p b7ec3000 00:00 0 
 b7ec4000-b8004000 r-xp 00000000 fd:00 148037     /lib/libc-2.8.90.so
 b8004000-b8006000 r--p 00140000 fd:00 148037     /lib/libc-2.8.90.so
 b8006000-b8007000 rw-p 00142000 fd:00 148037     /lib/libc-2.8.90.so
 b8007000-b800a000 rw-p b8007000 00:00 0 
 b801c000-b801d000 r--p 00000000 fd:03 349556     /usr/lib/locale/en_US.utf8/LC_NUMERIC
 b801d000-b801e000 r--p 00000000 fd:03 557776     /usr/lib/locale/en_US.utf8/LC_TIME
 b801e000-b801f000 r--p 00000000 fd:03 557775     /usr/lib/locale/en_US.utf8/LC_MONETARY
 b801f000-b8020000 r--p 00000000 fd:03 22168      /usr/lib/locale/en_US.utf8/LC_MESSAGES/SYS_LC_MESSAGES
 b8020000-b8021000 r--p 00000000 fd:03 301439     /usr/lib/locale/en_US.utf8/LC_PAPER
 b8021000-b8022000 r--p 00000000 fd:03 19843      /usr/lib/locale/en_US.utf8/LC_NAME
 b8022000-b8023000 r--p 00000000 fd:03 19906      /usr/lib/locale/en_US.utf8/LC_ADDRESS
 b8023000-b8024000 r--p 00000000 fd:03 300950     /usr/lib/locale/en_US.utf8/LC_TELEPHONE
 b8024000-b8025000 r--p 00000000 fd:03 557780     /usr/lib/locale/en_US.utf8/LC_MEASUREMENT
 b8025000-b802c000 r--s 00000000 fd:03 179147     /usr/lib/gconv/gconv-modules.cache
 b802c000-b802d000 r--p 00000000 fd:03 557774     /usr/lib/locale/en_US.utf8/LC_IDENTIFICATION
 b802d000-b802e000 rw-p b802d000 00:00 0 
 b802e000-b804b000 r-xp 00000000 fd:00 147561     /lib/ld-2.8.90.so
 b804b000-b804c000 r--p 0001c000 fd:00 147561     /lib/ld-2.8.90.so
 b804c000-b804d000 rw-p 0001d000 fd:00 147561     /lib/ld-2.8.90.so
 bfe36000-bfe4c000 rw-p bffea000 00:00 0          [stack]
 ffffe000-fffff000 r-xp 00000000 00:00 0          [vdso]
ProcStatus:
 Name:  cat
 State: S (sleeping)
 Tgid:  2538
 Pid:   2538
 PPid:  2391
 TracerPid:     0
 Uid:   16484   16484   16484   16484
 Gid:   50      50      50      50
 FDSize:        256
 Groups:        17 33 50 100 10043 
 VmPeak:            2948 kB
 VmSize:            2948 kB
 VmLck:        0 kB
 VmHWM:      608 kB
 VmRSS:      608 kB
 VmData:             152 kB
 VmStk:       88 kB
 VmExe:       36 kB
 VmLib:     1396 kB
 VmPTE:       16 kB
 Threads:       1
 SigQ:  2/16383
 SigPnd:        0000000000000000
 ShdPnd:        0000000000000000
 SigBlk:        fffffffe00000000
 SigIgn:        0000000000000000
 SigCgt:        0000000000000000
 CapInh:        0000000000000000
 CapPrm:        0000000000000000
 CapEff:        0000000000000000
 CapBnd:        ffffffffffffffff
 Cpus_allowed:  00000003
 Cpus_allowed_list:     0-1
 Mems_allowed:  1
 Mems_allowed_list:     0
 voluntary_ctxt_switches:       4
 nonvoluntary_ctxt_switches:    1
Signal: 11
Uname: Linux 2.6.27-rc7-12-default i686
UserGroups: audio users video
Dependencies:
 zlib 1.2.3-133.7
 terminfo-base 5.6-88.18
 audit-libs 1.7.7-1.6
 libreadline5 5.2-134.13
 bundle-lang-common-de 11.1-2.2
 coreutils 6.12-29.10
 libselinux1 2.0.71-2.13
 glibc 2.8.90-14.2 [modified: /etc/ld.so.cache /etc/nsswitch.conf]
 libxcrypt 3.0.1-25.6
 libacl 2.2.47-25.5
 cracklib-dict-full 2.8.12-43.12
 pam 1.0.2-9.3 [modified: /etc/pam.d/common-account /etc/pam.d/common-auth /etc/pam.d/common-password /etc/pam.d/common-session]
 cracklib 2.8.12-46.12
 bundle-lang-common-en 11.1-2.2
 coreutils-lang 6.12-29.10
 libncurses5 5.6-88.18
 bundle-lang-common-ar 11.1-2.2
 bash 3.2-134.13
 info 4.12-1.54 [modified: /usr/share/info/dir]
 libbz2 1.0.4-20 [modified: /lib/libbz2.so.1.0.4]
 libzio 0.9-2.8
 filesystem 11.1-1.6
 libdb-4_5 4.5.20-77.49
 libbz2-1 1.0.5-20.81
 libattr 2.4.39-65.6
Disassembly:
 0xffffe430 <__kernel_vsyscall+16>:     pop    %ebp
 0xffffe431 <__kernel_vsyscall+17>:     pop    %edx
 0xffffe432 <__kernel_vsyscall+18>:     pop    %ecx
 0xffffe433 <__kernel_vsyscall+19>:     ret    
 0xffffe434:    add    %ch,(%esi)
 0xffffe436:    jae    0xffffe4a0
 0xffffe438:    jae    0xffffe4ae
 0xffffe43a:    jb     0xffffe4b0
 0xffffe43c:    popa   
 0xffffe43d:    bound  %eax,(%eax)
 0xffffe43f:    cs
 0xffffe440:    push   $0x687361
 0xffffe445:    cs
 0xffffe446:    fs
 0xffffe447:    jns    0xffffe4b7
 0xffffe449:    jae    0xffffe4c4
Package: coreutils 6.12-29.10
PackageArchitecture: i586
Registers:
 eax            0xfffffe00      -512
 ecx            0x8057000       134574080
 edx            0x400   1024
 ebx            0x0     0
 esp            0xbfe49098      0xbfe49098
 ebp            0xbfe490c8      0xbfe490c8
 esi            0x400   1024
 edi            0x400   1024
 eip            0xffffe430      0xffffe430 <__kernel_vsyscall+16>
 eflags         0x246   [ PF ZF IF ]
 cs             0x73    115
 ss             0x7b    123
 ds             0x7b    123
 es             0x7b    123
 fs             0x0     0
 gs             0x33    51
SourcePackage: coreutils-6.12-29.10.src.rpm
Stacktrace:
 #0  0xffffe430 in __kernel_vsyscall ()
 #1  0xb7f854e3 in __read_nocancel () from /lib/libc.so.6
 #2  0x0804cfbe in safe_read (fd=0, buf=0x8057000, count=1024)
     at /usr/include/bits/unistd.h:45
        result = 1024
 #3  0x080498cd in main (argc=1, argv=0x0) at cat.c:175
        outsize = 1024
        insize = 1024
        page_size = 4096
        inbuf = 0x80566d0 ""
        ok = true
        c = <value optimized out>
        argind = 1
        out_dev = 13259575829672755200
        out_ino = 0
        check_redirection = false
        have_read_stdin = true
        stat_buf = {st_dev = 11, __pad1 = 0, __st_ino = 3, st_mode = 8592, 
   st_nlink = 1, st_uid = 16484, st_gid = 5, st_rdev = 34817, __pad2 = 0, 
   st_size = 0, st_blksize = 1024, st_blocks = 0, st_atim = {
     tv_sec = 1224489308, tv_nsec = 683306179}, st_mtim = {tv_sec = 1224489308, 
     tv_nsec = 683306179}, st_ctim = {tv_sec = 1224489305, 
     tv_nsec = 795272136}, st_ino = 3}
        number = false
        number_nonblank = false
        squeeze_blank = false
        show_ends = false
        show_nonprinting = false
        show_tabs = false
        long_options = {{name = 0x804ffce "number-nonblank", has_arg = 0, 
     flag = 0x0, val = 98}, {name = 0x804ffde "number", has_arg = 0, 
     flag = 0x0, val = 110}, {name = 0x804ffe5 "squeeze-blank", has_arg = 0, 
     flag = 0x0, val = 115}, {name = 0x804fff3 "show-nonprinting", has_arg = 0, 
     flag = 0x0, val = 118}, {name = 0x8050004 "show-ends", has_arg = 0, 
     flag = 0x0, val = 69}, {name = 0x805000e "show-tabs", has_arg = 0, 
     flag = 0x0, val = 84}, {name = 0x8050018 "show-all", has_arg = 0, 
     flag = 0x0, val = 65}, {name = 0x8050021 "help", has_arg = 0, flag = 0x0, 
     val = -130}, {name = 0x8050026 "version", has_arg = 0, flag = 0x0, 
     val = -131}, {name = 0x0, has_arg = 0, flag = 0x0, val = 0}}
StacktraceTop:
 __kernel_vsyscall ()
 __read_nocancel () from /lib/libc.so.6
 safe_read (fd=0, buf=0x8057000, count=1024)
 main (argc=1, argv=0x0) at cat.c:175
ThreadStacktrace:
 .
 Thread 1 (Thread 2538):
 #0  0xffffe430 in __kernel_vsyscall ()
 #1  0xb7f854e3 in __read_nocancel () from /lib/libc.so.6
 #2  0x0804cfbe in safe_read (fd=0, buf=0x8057000, count=1024)
     at /usr/include/bits/unistd.h:45
        result = 1024
 #3  0x080498cd in main (argc=1, argv=0x0) at cat.c:175
        outsize = 1024
        insize = 1024
        page_size = 4096
        inbuf = 0x80566d0 ""
        ok = true
        c = <value optimized out>
        argind = 1
        out_dev = 13259575829672755200
        out_ino = 0
        check_redirection = false
        have_read_stdin = true
        stat_buf = {st_dev = 11, __pad1 = 0, __st_ino = 3, st_mode = 8592, 
   st_nlink = 1, st_uid = 16484, st_gid = 5, st_rdev = 34817, __pad2 = 0, 
   st_size = 0, st_blksize = 1024, st_blocks = 0, st_atim = {
     tv_sec = 1224489308, tv_nsec = 683306179}, st_mtim = {tv_sec = 1224489308, 
     tv_nsec = 683306179}, st_ctim = {tv_sec = 1224489305, 
     tv_nsec = 795272136}, st_ino = 3}
        number = false
        number_nonblank = false
        squeeze_blank = false
        show_ends = false
        show_nonprinting = false
        show_tabs = false
        long_options = {{name = 0x804ffce "number-nonblank", has_arg = 0, 
     flag = 0x0, val = 98}, {name = 0x804ffde "number", has_arg = 0, 
     flag = 0x0, val = 110}, {name = 0x804ffe5 "squeeze-blank", has_arg = 0, 
     flag = 0x0, val = 115}, {name = 0x804fff3 "show-nonprinting", has_arg = 0, 
     flag = 0x0, val = 118}, {name = 0x8050004 "show-ends", has_arg = 0, 
     flag = 0x0, val = 69}, {name = 0x805000e "show-tabs", has_arg = 0, 
     flag = 0x0, val = 84}, {name = 0x8050018 "show-all", has_arg = 0, 
     flag = 0x0, val = 65}, {name = 0x8050021 "help", has_arg = 0, flag = 0x0, 
     val = -130}, {name = 0x8050026 "version", has_arg = 0, flag = 0x0, 
     val = -131}, {name = 0x0, has_arg = 0, flag = 0x0, val = 0}}
Title: cat crashed with SIGSEGV in __kernel_vsyscall()

Stupid Server Implementation

<?php
//
// test page that accepts HTTP POST request only. for demo purpose
// accepts 'username' parameter, and records username and 
// browser user-agent to text files
//
//  curl -X POST -F 'username=@target.txt.txt' http://bolzano.suse.de/breakpad/target.php 
//

function uuid($prefix = '')
{
        $chars = uniqid(md5(rand()));
        $uuid  = substr($chars,0,8) . '-';
        $uuid .= substr($chars,8,4) . '-';
        $uuid .= substr($chars,12,4) . '-';
        $uuid .= substr($chars,16,4) . '-';
        $uuid .= substr($chars,20,12);

        return $prefix . $uuid;
}

$uploaddir = '/srv/www/apport-breakpad/';

if ($_SERVER['REQUEST_METHOD'] == 'POST')
{

        $useragent = $_SERVER['HTTP_USER_AGENT'];

        $uuid = uuid();
        $fname = $uploaddir . $uuid . ".log";

        //log any post request to a textfile
        $fh = fopen($fname, "a+");
        $text = "($useragent)\n";

        foreach($_POST as $key => $value)
        {
                if ($value != '')
                {
                        $text .= "$key: $value\n";
                }
        }

        fputs($fh,$text);
        fclose($fh);

        if (!empty($_FILES)) {
                foreach ($_FILES as $key => $value) {
                        if ($key == 'data') {
                                if (move_uploaded_file($value['tmp_name'], $uploaddir . $uuid )) {
                                        print "file is valid\n";
                                }
                        } else {
                                if (move_uploaded_file($value['tmp_name'], $uploaddir . $uuid . "-" . $value['name'])) {
                                        print "file is valid\n";
                                }
                        }
                }
        }

        // the positive response
//      print "data was submitted successfully\n";
        header("X-UUID: " . $uuid);
        header("X-Apport-Report-UUID: " . $uuid);
//      header("Location: http://bolzano.suse.de/breakpad/" . $uuid);
        /* Make sure that code below does not get executed when we redirect. */
//      exit;
} else {
        // the negative response
//      print "this page only accepts POST request\n";
        header("Location: http://bolzano.suse.de/");
        /* Make sure that code below does not get executed when we redirect. */
        exit;
}

?>

Passed QA check: Fsundermeyer 14:51, 15 June 2009 (UTC)