コード例 #1
0
ファイル: util.c プロジェクト: balagopalraj/clearlinux
long get_directory_size(char *dir_path)
{
        long total_size = 0;
        DIR *dir;
        struct dirent *de;
        int ret;
        struct stat buf;
        char *file_path = NULL;

        dir = opendir(dir_path);
        if (!dir) {
                telem_perror("Error opening spool dir");
                return -1;
        }

        while ((de = readdir(dir)) != NULL) {
                ret = asprintf(&file_path, "%s/%s", dir_path, de->d_name);
                if (ret == -1) {
                        telem_log(LOG_CRIT, "Cannot allocate memory, exiting\n");
                        exit(EXIT_FAILURE);
                }

                ret = stat(file_path, &buf);
                if (ret < 0) {
                        telem_log(LOG_ERR, "Could not stat file %s:%s", file_path, strerror(errno));
                } else {
                        total_size += buf.st_size;
                }

                free(file_path);
        }
        closedir(dir);

        return total_size;
}
コード例 #2
0
END_TEST

START_TEST(sysctl2_payload)
{
        char *oopsfile = NULL;

        oopsfile = TESTOOPSDIR "/sysctl_check2.txt";
        setup_payload(oopsfile);

        telem_log(LOG_ERR, "sysctl2 backtrace: %s\n", pl->str);

        ck_assert(pl->len > 0);
        ck_assert_str_eq(reason, "sysctl table check failed: net/netfilter/nf_conntrack_max .3.19.1 Missing strategy");

        ck_assert(strstr(pl->str, "Kernel Version : 2.6.32.53-bigmem-5-openvz #28"));
        ck_assert(strstr(pl->str, "Tainted : P"));

        ck_assert(strstr(pl->str, "#1 ? set_fail"));
        ck_assert(strstr(pl->str, "#2 ? sysctl_check_table"));
        ck_assert(strstr(pl->str, "#3 ? sysctl_check_lookup"));
        ck_assert(strstr(pl->str, "#4 ? sysctl_check_table"));
        ck_assert(strstr(pl->str, "#5 ? sysctl_check_lookup"));
        ck_assert(strstr(pl->str, "#6 ? sysctl_check_table"));
        ck_assert(strstr(pl->str, "#7 ? __kmalloc"));
        ck_assert(strstr(pl->str, "#8 ? __register_sysctl_paths"));
        ck_assert(strstr(pl->str, "#9 ? proc_register"));
        ck_assert(strstr(pl->str, "#10 ? register_net_sysctl_table"));
        ck_assert(strstr(pl->str, "#11 ? nf_conntrack_net_init"));
        ck_assert(strstr(pl->str, "#12 ? setup_net"));
        ck_assert(strstr(pl->str, "#13 ? copy_net_ns"));
        ck_assert(strstr(pl->str, "#14 ? create_new_namespaces"));

        nc_string_free(pl);
}
コード例 #3
0
END_TEST

START_TEST(kernel_null_pointer_payload)
{
        char *oopsfile = NULL;

        oopsfile = TESTOOPSDIR "/kernel_null_pointer.txt";
        setup_payload(oopsfile);

        telem_log(LOG_ERR, "Kernel Null Pointer backtrace: %s\n", pl->str);

        ck_assert(pl->len > 0);
        ck_assert_str_eq(reason, "BUG: unable to handle kernel NULL pointer dereference at 0000000000000118");

        ck_assert(strstr(pl->str, "Kernel Version : 3.7.4-204.fc18.x86_64 #1 LENOVO 27672LG/27672LG"));
        ck_assert(strstr(pl->str, "Tainted : Not tainted"));

        ck_assert(strstr(pl->str, "Modules : vfat fat usb_storage ipt_MASQUERADE nf_conntrack_netbios_ns nf_conntrack_broadcast"));
        ck_assert(strstr(pl->str, "crc_itu_t yenta_socket i2c_algo_bit drm_kms_helper drm i2c_core wmi video"));

        ck_assert(strstr(pl->str, "#1 fat_detach"));
        ck_assert(strstr(pl->str, "#2 fat_evict_inode"));
        ck_assert(strstr(pl->str, "#3 evict"));
        ck_assert(strstr(pl->str, "#4 iput"));
        ck_assert(strstr(pl->str, "#5 fsnotify_destroy_mark"));
        ck_assert(strstr(pl->str, "#6 sys_inotify_rm_watch"));
        ck_assert(strstr(pl->str, "#7 system_call_fastpath"));

        nc_string_free(pl);
}
コード例 #4
0
END_TEST

START_TEST(kernel_bug_payload)
{
        char *oopsfile = NULL;

        oopsfile = TESTOOPSDIR "/kernel_bug_at_DONE.txt";
        setup_payload(oopsfile);

        telem_log(LOG_ERR, "Kernel bug at backtrace: %s\n", pl->str);

        ck_assert(pl->len > 0);
        ck_assert_str_eq(reason, "kernel BUG at mm/mmap.c:2156!");

        ck_assert(strstr(pl->str, "Kernel Version : 2.6.27.56-0.1-default #1"));
        ck_assert(strstr(pl->str, "Tainted : G"));

        ck_assert(strstr(pl->str, "Modules : ip6t_LOG xt_tcpudp xt_pkttype ipt_LOG xt_limit adi joydev snd_pcm_oss snd_mixer_oss"));
        ck_assert(strstr(pl->str, "ata_generic sata_sis pata_sis libata scsi_mod dock thermal processor thermal_sys hwmon"));

        ck_assert(strstr(pl->str, "#1 mmput"));
        ck_assert(strstr(pl->str, "#2 exit_mm"));
        ck_assert(strstr(pl->str, "#3 do_exit"));
        ck_assert(strstr(pl->str, "#4 do_group_exit"));
        ck_assert(strstr(pl->str, "#5 get_signal_to_deliver"));
        ck_assert(strstr(pl->str, "#6 do_signal"));
        ck_assert(strstr(pl->str, "#7 do_notify_resume"));
        ck_assert(strstr(pl->str, "#8 ptregscall_common"));
        ck_assert(strstr(pl->str, "#9 sysret_signal"));

        nc_string_free(pl);
}
コード例 #5
0
END_TEST

START_TEST(general_protection_fault_payload)
{
        char *oopsfile = NULL;

        oopsfile = TESTOOPSDIR "/general_protection_fault.txt";
        setup_payload(oopsfile);

        ck_assert(pl->len > 0);
        ck_assert_str_eq(reason, "general protection fault: 0000 [#1] SMP ");

        telem_log(LOG_ERR, "General protection fault backtrace: %s\n", pl->str);

        ck_assert(strstr(pl->str, "Kernel Version : 3.10.0-210.el7.x86_64"));
        ck_assert(strstr(pl->str, "Tainted : Not tainted"));

        ck_assert(strstr(pl->str, "Modules : tun 8021q garp mrp bridge stp llc bonding ipt_REJECT xt_comment xt_multiport"));
        ck_assert(strstr(pl->str, "lpc_ich iw_cm mfd_core nfsd auth_rpcgss wmi nfs_acl lockd ipmi_si ipmi_devintf"));

        ck_assert(strstr(pl->str, "#1 ? alloc_pipe_info"));
        ck_assert(strstr(pl->str, "#2 alloc_pipe_info"));
        ck_assert(strstr(pl->str, "#3 create_pipe_files"));
        ck_assert(strstr(pl->str, "#4 __do_pipe_flags"));
        ck_assert(strstr(pl->str, "#5 SyS_pipe2"));
        ck_assert(strstr(pl->str, "#6 ? __audit_syscall_exit"));
        ck_assert(strstr(pl->str, "#7 SyS_pipe"));
        ck_assert(strstr(pl->str, "#8 system_call_fastpath"));

        nc_string_free(pl);
}
コード例 #6
0
END_TEST

START_TEST(rtnl_payload)
{
        char *oopsfile = NULL;
        oopsfile = TESTOOPSDIR "/RTNL.txt";
        setup_payload(oopsfile);

        telem_log(LOG_ERR, "rtnl backtrace: %s\n", pl->str);

        ck_assert(pl->len > 0);
        ck_assert_str_eq(reason, "RTNL: assertion failed at drivers/net/bonding/bond_main.c");

        ck_assert(strstr(pl->str, "Kernel Version : 3.12-trunk-amd64 #1 Debian 3.12.3-1~exp1"));

        ck_assert(strstr(pl->str, "Tainted : Not tainted"));

        ck_assert(strstr(pl->str, "#1 ? dump_stack"));
        ck_assert(strstr(pl->str, "#2 ? bond_set_rx_mode"));
        ck_assert(strstr(pl->str, "#3 ? __dev_mc_add"));
        ck_assert(strstr(pl->str, "#4 ? igmp6_group_added"));
        ck_assert(strstr(pl->str, "#5 ? sock_def_readable"));
        ck_assert(strstr(pl->str, "#6 ? ipv6_dev_mc_inc"));
        ck_assert(strstr(pl->str, "#7 ? ipv6_sock_mc_join"));
        ck_assert(strstr(pl->str, "#8 ? do_ipv6_setsockopt.isra.6"));
        ck_assert(strstr(pl->str, "#9 ? pipe_write"));
        ck_assert(strstr(pl->str, "#10 ? SYSC_sendto"));
        ck_assert(strstr(pl->str, "#11 ? ipv6_setsockopt"));
        ck_assert(strstr(pl->str, "#12 ? SyS_setsockopt"));
        ck_assert(strstr(pl->str, "#13 ? system_call_fastpath"));

        nc_string_free(pl);
}
コード例 #7
0
ファイル: crash_probe.c プロジェクト: balagopalraj/clearlinux
/* This callback is invoked for every frame in a thread. From a Dwfl_Frame, we
 * are able to extract the program counter (PC), and from that, the procedure
 * name via a Dwfl_Module.
 */
static int frame_cb(Dwfl_Frame *frame, void *userdata)
{
        Dwarf_Addr pc;
        Dwarf_Addr pc_adjusted;
        Dwfl_Module *module;
        const char *procname;
        const char *modname;
        bool activation;
        GString **bt = (GString **)userdata;

        if (!dwfl_frame_pc(frame, &pc, &activation)) {
                tm_dwfl_err("Failed to find program counter for current frame");
                return DWARF_CB_ABORT;
        }

        // The return address may be beyond the calling address, putting the
        // current PC in a different context. Subtracting 1 from PC in this
        // case generally puts it back in the same context, thus fixing the
        // virtual unwind for this frame. See the DWARF standard for details.
        if (!activation) {
                pc_adjusted = pc - 1;
        } else {
                pc_adjusted = pc;
        }

        module = dwfl_addrmodule(d_core, pc_adjusted);

        if (!module) {
                // TODO: decide if it's worth creating a record in this
                // situation, since there are likely no symbols available for a
                // backtrace...
                telem_log(LOG_ERR,
                          "Failed to find module from dwfl_addrmodule"
                          " (process '%s', PID %u)\n",
                          proc_name, (unsigned int)core_for_pid);
                return DWARF_CB_ABORT;
        }

        modname = dwfl_module_info(module, NULL, NULL, NULL, NULL, NULL, NULL,
                                   NULL);
        procname = dwfl_module_addrname(module, pc_adjusted);

        if (procname && modname) {
                g_string_append_printf(*bt, "#%u %s() - [%s]\n",
                                       frame_counter++, procname, modname);
        } else if (modname) {
                g_string_append_printf(*bt, "#%u ??? - [%s]\n",
                                       frame_counter++, modname);
        } else {
                // TODO: decide on "no symbol" representation
                g_string_append_printf(*bt, "#%u (no symbols)\n",
                                       frame_counter++);
        }

        return DWARF_CB_OK;
}
コード例 #8
0
static void drop_privs(void)
{
        uid_t euid;

        euid = geteuid();
        if (euid != 0) {
                telem_log(LOG_DEBUG, "Not root; skipping privilege drop\n");
                return;
        }

        struct passwd *pw;

        pw = getpwnam("telemetry");
        if (!pw) {
                telem_log(LOG_ERR, "telemetry user not found\n");
                exit(EXIT_FAILURE);
        }

        if (chdir(LOCALSTATEDIR "/lib/telemetry") != 0) {
                telem_perror("Not able to change working directory");
                exit(EXIT_FAILURE);
        }

        // The order is important here:
        // change supplemental groups, our gid, and then our uid
        if (initgroups(pw->pw_name, pw->pw_gid) != 0) {
                telem_perror("Failed to set supplemental group list");
                exit(EXIT_FAILURE);
        }
        if (setgid(pw->pw_gid) != 0) {
                telem_perror("Failed to set GID");
                exit(EXIT_FAILURE);
        }
        if (setuid(pw->pw_uid) != 0) {
                telem_perror("Failed to set UID");
                exit(EXIT_FAILURE);
        }

        assert(getuid() == pw->pw_uid);
        assert(geteuid() == pw->pw_uid);
        assert(getgid() == pw->pw_gid);
        assert(getegid() == pw->pw_gid);
}
コード例 #9
0
ファイル: post.c プロジェクト: clearlinux/telemetrics-client
int main(int argc, char **argv)
{

        int c;
        int opt_index = 0;
        TelemPostDaemon daemon;

        struct option opts[] = {
                { "config_file", 1, NULL, 'f' },
                { "help", 0, NULL, 'h' },
                { "version", 0, NULL, 'V' },
                { NULL, 0, NULL, 0 }
        };

        while ((c = getopt_long(argc, argv, "f:hV", opts, &opt_index)) != -1) {
                switch (c) {
                        case 'f':
                                if (tm_set_config_file(optarg) != 0) {
                                    telem_log(LOG_ERR, "Configuration file"
                                                  " path not valid\n");
                                    exit(EXIT_FAILURE);
                                }
                                break;
                        case 'V':
                                printf(PACKAGE_VERSION "\n");
                                exit(EXIT_SUCCESS);
                        case 'h':
                                print_usage(argv[0]);
                                exit(EXIT_SUCCESS);
                        case '?':
                                print_usage(argv[0]);
                                exit(EXIT_FAILURE);
                }
        }

        initialize_daemon(&daemon);

        daemon.current_spool_size = get_spool_dir_size();

        /* When path activated this will process
         * the activating message or previously
         * spooled data */
        staging_records_loop(&daemon);

        /* This function is blocking, it will
        * block until a signal is received */
        run_daemon(&daemon);

        close_daemon(&daemon);

        return 0;
}
コード例 #10
0
END_TEST

START_TEST(bug_kernel_handle_payload_new_format)
{
        char *oopsfile = NULL;

        oopsfile = TESTOOPSDIR "/bug_kernel_handle_new.txt";
        setup_payload(oopsfile);

        telem_log(LOG_ERR, "Bug kernel handle backtrace: %s\n", pl->str);

        ck_assert(pl->len > 0);
        ck_assert_str_eq(reason, "BUG: unable to handle kernel paging request at 0000000000002658");

        ck_assert(strstr(pl->str, "Kernel Version : 3.7.9-201.fc18.x86_64 #1 Apple Inc. MacBookPro6,2/Mac-F22586C8"));
        ck_assert(strstr(pl->str, "Tainted : PF"));

        ck_assert(strstr(pl->str, "Modules : nf_conntrack_netbios_ns nf_conntrack_broadcast ipt_MASQUERADE be2iscsi"));
        ck_assert(strstr(pl->str, "drm_kms_helper firewire_ohci drm firewire_core tg3 crc_itu_t i2c_core video usb_storage sunrpc"));

        ck_assert(strstr(pl->str, "#1 ? _nv007312rm"));
        ck_assert(strstr(pl->str, "#2 ? _nv007847rm"));
        ck_assert(strstr(pl->str, "#3 ? _nv004049rm"));
        ck_assert(strstr(pl->str, "#4 ? _nv004049rm"));
        ck_assert(strstr(pl->str, "#5 ? _nv010019rm"));
        ck_assert(strstr(pl->str, "#6 ? _nv014983rm"));
        ck_assert(strstr(pl->str, "#7 ? _nv001097rm"));
        ck_assert(strstr(pl->str, "#8 ? rm_init_adapter"));
        ck_assert(strstr(pl->str, "#9 nv_kern_open"));
        ck_assert(strstr(pl->str, "#10 ? chrdev_open"));
        ck_assert(strstr(pl->str, "#11 ? do_dentry_open"));
        ck_assert(strstr(pl->str, "#12 ? cdev_put"));
        ck_assert(strstr(pl->str, "#13 ? finish_open"));
        ck_assert(strstr(pl->str, "#14 ? do_last"));
        ck_assert(strstr(pl->str, "#15 ? inode_permission"));
        ck_assert(strstr(pl->str, "#16 link_path_walk"));
        ck_assert(strstr(pl->str, "#17 path_openat"));
        ck_assert(strstr(pl->str, "#18 ? do_filp_open"));
        ck_assert(strstr(pl->str, "#19 ? __alloc_fd"));
        ck_assert(strstr(pl->str, "#20 ? do_sys_open"));
        ck_assert(strstr(pl->str, "#21 ? __audit_syscall_entry"));
        ck_assert(strstr(pl->str, "#22 ? sys_open"));
        ck_assert(strstr(pl->str, "#23 ? system_call_fastpath"));

        nc_string_free(pl);

}
コード例 #11
0
END_TEST

START_TEST(sysctl1_payload)
{
        char *oopsfile = NULL;

        oopsfile = TESTOOPSDIR "/sysctl_check1.txt";
        setup_payload(oopsfile);

        telem_log(LOG_ERR, "sysctl1 backtrace: %s\n", pl->str);

        ck_assert(pl->len > 0);
        ck_assert_str_eq(reason, "sysctl table check failed: net/ath1/%parent  Sysctl already exists");

        ck_assert(strstr(pl->str, "Kernel Version : 2.6.26-2-686 #1"));
        ck_assert(strstr(pl->str, "Tainted : P"));

        ck_assert(strstr(pl->str, "#1 set_fail"));
        ck_assert(strstr(pl->str, "#2 sysctl_check_table"));
        ck_assert(strstr(pl->str, "#3 sysctl_check_table"));
        ck_assert(strstr(pl->str, "#4 sysctl_check_table"));
        ck_assert(strstr(pl->str, "#5 __register_sysctl_paths"));
        ck_assert(strstr(pl->str, "#6 register_sysctl_paths"));
        ck_assert(strstr(pl->str, "#7 ieee80211_sysctl_vattach"));
        ck_assert(strstr(pl->str, "#8 ieee80211_vap_setup"));
        ck_assert(strstr(pl->str, "#9 ath_vap_create"));
        ck_assert(strstr(pl->str, "#10 ieee80211_ioctl_create_vap"));
        ck_assert(strstr(pl->str, "#11 ath_ioctl"));
        ck_assert(strstr(pl->str, "#12 __dev_get_by_name"));
        ck_assert(strstr(pl->str, "#13 ath_ioctl"));
        ck_assert(strstr(pl->str, "#14 dev_ifsioc"));
        ck_assert(strstr(pl->str, "#15 dev_ioctl"));
        ck_assert(strstr(pl->str, "#16 sk_alloc"));
        ck_assert(strstr(pl->str, "#17 d_alloc"));
        ck_assert(strstr(pl->str, "#18 inotify_d_instantiate"));
        ck_assert(strstr(pl->str, "#19 fd_install"));
        ck_assert(strstr(pl->str, "#20 sock_ioctl"));
        ck_assert(strstr(pl->str, "#21 vfs_ioctl"));
        ck_assert(strstr(pl->str, "#22 do_vfs_ioctl"));
        ck_assert(strstr(pl->str, "#23 sys_socketcall"));
        ck_assert(strstr(pl->str, "#24 sys_ioctl"));
        ck_assert(strstr(pl->str, "#25 sysenter_past_esp"));
        ck_assert(strstr(pl->str, "#26 quirk_ali7101_acpi"));
}
コード例 #12
0
END_TEST

START_TEST(bad_page_map_payload)
{
        char *oopsfile = NULL;

        oopsfile = TESTOOPSDIR "/bad_page_map.txt";
        setup_payload(oopsfile);

        telem_log(LOG_ERR, "Bad page map backtrace: %s\n", pl->str);

        ck_assert(pl->len > 0);
        ck_assert_str_eq(reason, "BUG: Bad page map in process nemo  pte:00010000 pmd:6ade7067");

        ck_assert(strstr(pl->str, "Kernel Version : 3.12-1-amd64 #1 Debian 3.12.9-1"));
        ck_assert(strstr(pl->str, "Tainted : Not tainted"));

        nc_string_free(pl);

}
コード例 #13
0
void setup(char *oopsfile)
{
        char *buf = NULL;
        int buflen = 0;

        oops_parser_cleanup();

        buf = readfile(oopsfile);
        buflen = (int)getbuflen();

        oops_parser_init(write_oops_to_file);

        // Allocate space to write the oops file to
        if (allocate_filespace() < 0) {
                telem_log(LOG_ERR, "%s\n", strerror(errno));
                exit(EXIT_FAILURE);
        }

        split_buf_by_line(buf, buflen);
}
コード例 #14
0
static int thread_cb(Dwfl_Thread *thread, void *userdata)
{
        int ret;
        GString **bt = (GString **)userdata;
        pid_t tid;

        tid = dwfl_thread_tid(thread);

        g_string_append_printf(*bt, "\nBacktrace (TID %u):\n",
                               (unsigned int)tid);

        ret = dwfl_thread_getframes(thread, frame_cb, userdata);

        switch (ret) {
                case -1:
                        errorstr = g_strdup_printf("Error while iterating"
                                                   " through frames for thread"
                                                   " %u: %s\n",
                                                   (unsigned int)tid,
                                                   dwfl_errmsg(-1));
                        return DWARF_CB_ABORT;
                case DWARF_CB_ABORT:
                        /* already set the error string in frame_cb */
                        return DWARF_CB_ABORT;
                case DWARF_CB_OK:
                        break;
                default:
                        telem_log(LOG_ERR, "Unrecognized return code\n");
                        return DWARF_CB_ABORT;
        }

        // New threads (if any), will require a fresh frame counter
        frame_counter = 0;

#if 0
        g_string_append_printf(*bt, "\nRegisters (TID %u):\nTODO\n", current,
                               (unsigned int)tid);
#endif

        return DWARF_CB_OK;
}
コード例 #15
0
END_TEST

START_TEST(warn_on_payload)
{
        char *oopsfile = NULL;

        oopsfile = TESTOOPSDIR "/warn_on.txt";
        setup_payload(oopsfile);

        telem_log(LOG_ERR, "Warn_on backtrace: %s\n", pl->str);
        ck_assert(pl->len > 0);
        ck_assert_str_eq(reason, "WARNING: CPU: 3 PID: 0 at net/sched/sch_generic.c:303 dev_watchdog+0x254/0x260");

        ck_assert(strstr(pl->str, "Kernel Version : 4.0.5-300.fc22.x86_64 #1"));

        ck_assert(strstr(pl->str, "Tainted : Not tainted"));

        ck_assert(strstr(pl->str, "Modules : rfcomm xt_multiport xt_CHECKSUM tun ipt_MASQUERADE nf_nat_masquerade_ipv4"));
        ck_assert(strstr(pl->str, "snd_hda_codec_generic snd_hda_intel snd_hda_controller snd_hda_codec k10temp snd_hwdep"));

        ck_assert(strstr(pl->str, "#1 dump_stack"));
        ck_assert(strstr(pl->str, "#2 warn_slowpath_common"));
        ck_assert(strstr(pl->str, "#3 warn_slowpath_fmt"));
        ck_assert(strstr(pl->str, "#4 dev_watchdog"));
        ck_assert(strstr(pl->str, "#5 ? qdisc_rcu_free"));
        ck_assert(strstr(pl->str, "#6 call_timer_fn"));
        ck_assert(strstr(pl->str, "#7 ? qdisc_rcu_free"));
        ck_assert(strstr(pl->str, "#8 run_timer_softirq"));
        ck_assert(strstr(pl->str, "#9 __do_softirq"));
        ck_assert(strstr(pl->str, "#10 irq_exit"));
        ck_assert(strstr(pl->str, "#11 smp_apic_timer_interrupt"));
        ck_assert(strstr(pl->str, "#12 apic_timer_interrupt"));
        ck_assert(strstr(pl->str, "#13 ? cpuidle_enter_state"));
        ck_assert(strstr(pl->str, "#14 ? cpuidle_enter_state"));
        ck_assert(strstr(pl->str, "#15 cpuidle_enter"));
        ck_assert(strstr(pl->str, "#16 cpu_startup_entry"));
        ck_assert(strstr(pl->str, "#17 start_secondary"));

        nc_string_free(pl);
}
コード例 #16
0
END_TEST

START_TEST(double_fault_payload)
{
        char *oopsfile = NULL;

        oopsfile = TESTOOPSDIR "/double_fault.txt";
        setup_payload(oopsfile);

        telem_log(LOG_ERR, "Double fault backtrace: %s\n", pl->str);

        ck_assert(pl->len > 0);
        ck_assert_str_eq(reason, "double fault: 0000 [#3] SMP ");

        ck_assert(strstr(pl->str, "Kernel Version : 2.6.31.5-127.fc12.x86_64 #1 Latitude E6430"));
        ck_assert(strstr(pl->str, "Tainted : P      D  "));

        ck_assert(strstr(pl->str, "Modules : nls_utf8 vfat fat sit tunnel4 ext2 fuse ip6table_filter ip6_tables ebtable_nat"));
        ck_assert(strstr(pl->str, "joydev sdhci_pci sdhci usb_storage mmc_core video output [last unloaded: speedstep_lib]"));

        nc_string_free(pl);
}
コード例 #17
0
END_TEST

START_TEST(warning_payload)
{
        char *oopsfile = NULL;

        oopsfile = TESTOOPSDIR "/warning.txt";
        setup_payload(oopsfile);

        telem_log(LOG_ERR, "Warning backtrace: %s\n", pl->str);

        ck_assert(pl->len > 0);
        ck_assert_str_eq(reason, "WARNING: CPU: 1 PID: 796 at kernel/sched/core.c:2342 preempt_notifier_register+0x30/0x70");
        ck_assert(strstr(pl->str, "Kernel Version : 4.2.0-rc2-satori #1"));

        ck_assert(strstr(pl->str, "Tainted : G        W  OE"));

        ck_assert(strstr(pl->str, \
                         "Modules : vboxpci(OE) vboxnetadp(OE) vboxnetflt(OE) vboxdrv(OE) joydev pci_stub"));
        ck_assert(strstr(pl->str, \
                         "drm_kms_helper e1000e 8139too drm r8169 8139cp ptp mii pps_core wmi video"));

        ck_assert(strstr(pl->str, "#1 dump_stack"));
        ck_assert(strstr(pl->str, "#2 warn_slowpath_common"));
        ck_assert(strstr(pl->str, "#3 warn_slowpath_fmt"));
        ck_assert(strstr(pl->str, "#4 preempt_notifier_register"));
        ck_assert(strstr(pl->str, "#5 VBoxHost_RTThreadCtxHooksRegister"));
        ck_assert(strstr(pl->str, "#6 ? update_curr"));
        ck_assert(strstr(pl->str, "#7 ? supdrvIOCtlFast"));
        ck_assert(strstr(pl->str, "#8 ? VBoxDrvLinuxIOCtl_4_3_28"));
        ck_assert(strstr(pl->str, "#9 ? put_prev_entity"));
        ck_assert(strstr(pl->str, "#10 ? do_vfs_ioctl"));
        ck_assert(strstr(pl->str, "#11 ? pick_next_task_rt"));
        ck_assert(strstr(pl->str, "#12 ? SyS_ioctl"));
        ck_assert(strstr(pl->str, "#13 ? entry_SYSCALL_64_fastpath"));

        nc_string_free(pl);
}
コード例 #18
0
END_TEST

START_TEST(softlockup_payload)
{
        char *oopsfile = NULL;

        oopsfile = TESTOOPSDIR "/soft_lockup.txt";
        setup_payload(oopsfile);

        telem_log(LOG_ERR, "Softlockup backtrace: %s\n", pl->str);

        ck_assert(pl->len > 0);
        ck_assert_str_eq(reason, "BUG: soft lockup - CPU#8 stuck for 22s! [ceph-osd:12347]");

        ck_assert(strstr(pl->str, "Kernel Version : 3.16.6-200.el7.x86_64 #1"));

        ck_assert(strstr(pl->str, "Tainted : Not tainted"));

        ck_assert(strstr(pl->str, "Modules : vhost_net vhost macvtap macvlan tun nf_conntrack_ipv6 nf_defrag_ipv6 ip6table_filter"));
        ck_assert(strstr(pl->str, "it drm_kms_helper ttm uas tg3 drm ptp usb_storage pps_core i2c_core hpsa"));

        ck_assert(strstr(pl->str, "#1 _raw_read_lock"));
        ck_assert(strstr(pl->str, "#2 btrfs_tree_read_lock"));
        ck_assert(strstr(pl->str, "#3 btrfs_read_lock_root_node"));
        ck_assert(strstr(pl->str, "#4 btrfs_search_slot"));
        ck_assert(strstr(pl->str, "#5 ? crypto_shash_update"));
        ck_assert(strstr(pl->str, "#6 btrfs_lookup_xattr"));
        ck_assert(strstr(pl->str, "#7 __btrfs_getxattr"));
        ck_assert(strstr(pl->str, "#8 btrfs_getxattr"));
        ck_assert(strstr(pl->str, "#9 get_vfs_caps_from_disk"));
        ck_assert(strstr(pl->str, "#10 audit_copy_inode"));
        ck_assert(strstr(pl->str, "#11 __audit_inode"));
        ck_assert(strstr(pl->str, "#12 SyS_fgetxattr"));
        ck_assert(strstr(pl->str, "#13 system_call_fastpath"));

        nc_string_free(pl);
}
コード例 #19
0
END_TEST

START_TEST(alsa_bug_payload)
{
        char *oopsfile = NULL;

        oopsfile = TESTOOPSDIR "/ALSA.txt";
        setup_payload(oopsfile);

        printf("ALSA payload: %s\n", pl->str);
        telem_log(LOG_ERR, "AlSA bug backtrace: %s\n", pl->str);

        ck_assert(pl->len > 0);
        ck_assert_str_eq(reason, "ALSA sound/core/pcm_lib.c:154: BUG: stream = 1, pos = 0x1138, buffer size = 0x1138, period size = 0x44e");
        ck_assert(strstr(pl->str, "Kernel Version : 2.6.25-14.fc9.i686 #1"));

        ck_assert(strstr(pl->str, "Tainted : Not tainted"));

        ck_assert(strstr(pl->str, "#1 warn_on_slowpath"));
        ck_assert(strstr(pl->str, "#2 ? vsnprintf"));
        ck_assert(strstr(pl->str, "#3 ? _spin_unlock_irqrestore"));
        ck_assert(strstr(pl->str, "#10 start_kernel"));
        nc_string_free(pl);
}
コード例 #20
0
ファイル: crash_probe.c プロジェクト: balagopalraj/clearlinux
static inline void tm_dwfl_err(const char *msg)
{
        telem_log(LOG_ERR, "%s: %s\n", msg, dwfl_errmsg(-1));
}
コード例 #21
0
static inline void tm_journal_match_err(int ret)
{
        telem_log(LOG_ERR, "sd_journal_add_match() failed: %s\n", strerror(-ret));
}
コード例 #22
0
END_TEST

START_TEST(irq_payload)
{
        char *oopsfile = NULL;

        oopsfile = TESTOOPSDIR "/irq.txt";
        setup_payload(oopsfile);

        telem_log(LOG_ERR, "IRQ backtrace: %s\n", pl->str);

        ck_assert(pl->len > 0);
        ck_assert_str_eq(reason, "irq 11: nobody cared");

        ck_assert(strstr(pl->str, "Kernel Version : 3.10.7-100.fc18.i686.PAE #1"));
        ck_assert(strstr(pl->str, "Tainted : Not tainted"));

        ck_assert(strstr(pl->str, "#1 dump_stack"));
        ck_assert(strstr(pl->str, "#2 __report_bad_irq"));
        ck_assert(strstr(pl->str, "#3 note_interrupt"));
        ck_assert(strstr(pl->str, "#4 __do_softirq"));
        ck_assert(strstr(pl->str, "#5 handle_irq_event_percpu"));
        ck_assert(strstr(pl->str, "#6 handle_irq_event"));
        ck_assert(strstr(pl->str, "#7 handle_nested_irq"));
        ck_assert(strstr(pl->str, "#8 handle_level_irq"));
        ck_assert(strstr(pl->str, "#9 do_IRQ"));
        ck_assert(strstr(pl->str, "#10 common_interrupt"));
        ck_assert(strstr(pl->str, "#11 __do_softirq"));
        ck_assert(strstr(pl->str, "#12 handle_irq"));
        ck_assert(strstr(pl->str, "#13 irq_exit"));
        ck_assert(strstr(pl->str, "#14 do_IRQ"));
        ck_assert(strstr(pl->str, "#15 pci_write"));
        ck_assert(strstr(pl->str, "#16 common_interrupt"));
        ck_assert(strstr(pl->str, "#17 audit_make_tree"));
        ck_assert(strstr(pl->str, "#18 usbdev_ioctl"));
        ck_assert(strstr(pl->str, "#19 _raw_spin_unlock_irqrestore"));
        ck_assert(strstr(pl->str, "#20 __setup_irq"));
        ck_assert(strstr(pl->str, "#21 kmem_cache_alloc_trace"));
        ck_assert(strstr(pl->str, "#22 vsnprintf"));
        ck_assert(strstr(pl->str, "#23 request_threaded_irq"));
        ck_assert(strstr(pl->str, "#24 usb_hcd_platform_shutdown"));
        ck_assert(strstr(pl->str, "#25 request_threaded_irq"));
        ck_assert(strstr(pl->str, "#26 usb_add_hcd"));
        ck_assert(strstr(pl->str, "#27 usb_hcd_pci_probe"));
        ck_assert(strstr(pl->str, "#28 rpm_resume"));
        ck_assert(strstr(pl->str, "#29 pci_device_probe"));
        ck_assert(strstr(pl->str, "#30 driver_probe_device"));
        ck_assert(strstr(pl->str, "#31 pci_match_device"));
        ck_assert(strstr(pl->str, "#32 __driver_attach"));
        ck_assert(strstr(pl->str, "#33 driver_probe_device"));
        ck_assert(strstr(pl->str, "#34 bus_for_each_dev"));
        ck_assert(strstr(pl->str, "#35 driver_attach"));
        ck_assert(strstr(pl->str, "#36 driver_probe_device"));
        ck_assert(strstr(pl->str, "#37 bus_add_driver"));
        ck_assert(strstr(pl->str, "#38 pci_match_id"));
        ck_assert(strstr(pl->str, "#39 driver_register"));
        ck_assert(strstr(pl->str, "#40 ohci_hcd_mod_init"));
        ck_assert(strstr(pl->str, "#41 ohci_hcd_mod_init"));
        ck_assert(strstr(pl->str, "#42 __pci_register_driver"));
        ck_assert(strstr(pl->str, "#43 uhci_hcd_init"));
        ck_assert(strstr(pl->str, "#44 do_one_initcall"));
        ck_assert(strstr(pl->str, "#45 kernel_init_freeable"));
        ck_assert(strstr(pl->str, "#46 do_early_param"));

        g_string_free(pl, true);

}
コード例 #23
0
static inline void tm_journal_err(const char *msg, int ret)
{
        telem_log(LOG_ERR, "%s: %s\n", msg, strerror(-ret));
}
コード例 #24
0
END_TEST

START_TEST(irq_payload)
{
        char *oopsfile = NULL;

        oopsfile = TESTOOPSDIR "/irq.txt";
        setup_payload(oopsfile);

        telem_log(LOG_ERR, "IRQ backtrace: %s\n", pl->str);

        ck_assert(pl->len > 0);
        ck_assert_str_eq(reason, "irq 11: nobody cared");

        ck_assert(strstr(pl->str, "Kernel Version : 3.10.7-100.fc18.i686.PAE #1"));
        ck_assert(strstr(pl->str, "Tainted : Not tainted"));

        ck_assert(strstr(pl->str, "#1 dump_stack"));
        ck_assert(strstr(pl->str, "#2 __report_bad_irq"));
        ck_assert(strstr(pl->str, "#3 note_interrupt"));
        ck_assert(strstr(pl->str, "#4 ? __do_softirq"));
        ck_assert(strstr(pl->str, "#5 handle_irq_event_percpu"));
        ck_assert(strstr(pl->str, "#6 handle_irq_event"));
        ck_assert(strstr(pl->str, "#7 ? handle_nested_irq"));
        ck_assert(strstr(pl->str, "#8 handle_level_irq"));
        ck_assert(strstr(pl->str, "#9 ? do_IRQ"));
        ck_assert(strstr(pl->str, "#10 ? common_interrupt"));
        ck_assert(strstr(pl->str, "#11 ? __do_softirq"));
        ck_assert(strstr(pl->str, "#12 ? handle_irq"));
        ck_assert(strstr(pl->str, "#13 ? irq_exit"));
        ck_assert(strstr(pl->str, "#14 ? do_IRQ"));
        ck_assert(strstr(pl->str, "#15 ? pci_write"));
        ck_assert(strstr(pl->str, "#16 ? common_interrupt"));
        ck_assert(strstr(pl->str, "#17 ? audit_make_tree"));
        ck_assert(strstr(pl->str, "#18 ? usbdev_ioctl"));
        ck_assert(strstr(pl->str, "#19 ? _raw_spin_unlock_irqrestore"));
        ck_assert(strstr(pl->str, "#20 ? __setup_irq"));
        ck_assert(strstr(pl->str, "#21 ? kmem_cache_alloc_trace"));
        ck_assert(strstr(pl->str, "#22 ? vsnprintf"));
        ck_assert(strstr(pl->str, "#23 ? request_threaded_irq"));
        ck_assert(strstr(pl->str, "#24 ? usb_hcd_platform_shutdown"));
        ck_assert(strstr(pl->str, "#25 ? request_threaded_irq"));
        ck_assert(strstr(pl->str, "#26 ? usb_add_hcd"));
        ck_assert(strstr(pl->str, "#27 ? usb_hcd_pci_probe"));
        ck_assert(strstr(pl->str, "#28 ? rpm_resume"));
        ck_assert(strstr(pl->str, "#29 ? pci_device_probe"));
        ck_assert(strstr(pl->str, "#30 ? driver_probe_device"));
        ck_assert(strstr(pl->str, "#31 ? pci_match_device"));
        ck_assert(strstr(pl->str, "#32 ? __driver_attach"));
        ck_assert(strstr(pl->str, "#33 ? driver_probe_device"));
        ck_assert(strstr(pl->str, "#34 ? bus_for_each_dev"));
        ck_assert(strstr(pl->str, "#35 ? driver_attach"));
        ck_assert(strstr(pl->str, "#36 ? driver_probe_device"));
        ck_assert(strstr(pl->str, "#37 ? bus_add_driver"));
        ck_assert(strstr(pl->str, "#38 ? pci_match_id"));
        ck_assert(strstr(pl->str, "#39 ? driver_register"));
        ck_assert(strstr(pl->str, "#40 ? ohci_hcd_mod_init"));
        ck_assert(strstr(pl->str, "#41 ? ohci_hcd_mod_init"));
        ck_assert(strstr(pl->str, "#42 ? __pci_register_driver"));
        ck_assert(strstr(pl->str, "#43 ? uhci_hcd_init"));
        ck_assert(strstr(pl->str, "#44 ? do_one_initcall"));
        ck_assert(strstr(pl->str, "#45 ? kernel_init_freeable"));
        ck_assert(strstr(pl->str, "#46 ? do_early_param"));

        nc_string_free(pl);

}