summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--abrt.spec3
-rw-r--r--examples/not_oops2.test1
-rw-r--r--src/hooks/Makefile.am22
-rw-r--r--src/hooks/dumpoops.cpp130
-rw-r--r--src/plugins/Kerneloops.conf6
-rw-r--r--src/plugins/KerneloopsScanner.cpp229
-rw-r--r--src/plugins/KerneloopsScanner.h42
-rw-r--r--src/plugins/KerneloopsSysLog.c391
-rw-r--r--src/plugins/KerneloopsSysLog.h43
-rw-r--r--src/plugins/Makefile.am19
-rw-r--r--src/plugins/abrt-KerneloopsScanner.746
-rw-r--r--src/plugins/abrt-plugins.71
13 files changed, 1 insertions, 933 deletions
diff --git a/.gitignore b/.gitignore
index 67b52062..d9334957 100644
--- a/.gitignore
+++ b/.gitignore
@@ -53,7 +53,6 @@ src/cli/abrt-cli
src/daemon/abrtd
src/gui/abrt.desktop
src/hooks/abrt_exception_handler.py
-src/hooks/dumpoops
src/hooks/abrt-hook-ccpp
stamp-h1
x86_64/
diff --git a/abrt.spec b/abrt.spec
index 469a9e04..52172bec 100644
--- a/abrt.spec
+++ b/abrt.spec
@@ -423,9 +423,6 @@ fi
%files addon-kerneloops
%defattr(-,root,root,-)
%config(noreplace) %{_sysconfdir}/%{name}/plugins/Kerneloops.conf
-%{_bindir}/dumpoops
-%{_libdir}/%{name}/libKerneloopsScanner.so*
-%{_mandir}/man7/abrt-KerneloopsScanner.7.gz
%{_libdir}/%{name}/KerneloopsReporter.glade
%{_mandir}/man7/abrt-KerneloopsReporter.7.gz
%{_bindir}/abrt-dump-oops
diff --git a/examples/not_oops2.test b/examples/not_oops2.test
index da0f35c1..0373079d 100644
--- a/examples/not_oops2.test
+++ b/examples/not_oops2.test
@@ -39,7 +39,6 @@ Jan 12 19:08:41 kids1 kernel: =======================
Jan 12 19:08:41 kids1 kernel: Code: 66 31 d2 09 c2 89 d8 e8 fc e7 ff ff 8b 83 cc 00 00 00 8b 53 34 03 10 8b 86 70 02 00 00 2b 50 44
Jan 12 19:08:41 kids1 kernel: EIP: [<f88dec25>] radeon_cp_init_ring_buffer+0x90/0x302 [radeon] SS:ESP 0068:f0a0cf08
Jan 12 19:08:41 kids1 kernel: ---[ end trace 81e3cf9431f7af0c ]---
-Nov 9 15:43:47 abrtd: Activating plugin: KerneloopsScanner
Nov 9 15:43:47 abrtd: Scanning syslog...
Nov 9 15:43:47 abrtd: Locked '/var/spool/abrt/kerneloops-1257777827-1.lock'
Nov 9 15:43:47 abrtd: UnLocked '/var/spool/abrt/kerneloops-1257777827-1.lock'
diff --git a/src/hooks/Makefile.am b/src/hooks/Makefile.am
index 34cd942e..6ebf3628 100644
--- a/src/hooks/Makefile.am
+++ b/src/hooks/Makefile.am
@@ -1,7 +1,5 @@
libexec_PROGRAMS = abrt-hook-ccpp
-bin_PROGRAMS = dumpoops
-
# abrt-hook-ccpp
abrt_hook_ccpp_SOURCES = \
abrt-hook-ccpp.c
@@ -17,26 +15,6 @@ abrt_hook_ccpp_CPPFLAGS = \
abrt_hook_ccpp_LDADD = \
../lib/libreport.la
-# dumpoops
-dumpoops_SOURCES = \
- dumpoops.cpp
-dumpoops_CPPFLAGS = \
- -I$(srcdir)/../include/report -I$(srcdir)/../include \
- -I$(srcdir)/../lib \
- -I$(srcdir)/../plugins \
- -DDEBUG_DUMPS_DIR=\"$(DEBUG_DUMPS_DIR)\" \
- -DPLUGINS_LIB_DIR=\"$(PLUGINS_LIB_DIR)\" \
- -DPLUGINS_CONF_DIR=\"$(PLUGINS_CONF_DIR)\" \
- -DCONF_DIR=\"$(CONF_DIR)\" \
- -DVAR_RUN=\"$(VAR_RUN)\" \
- $(GLIB_CFLAGS) \
- -Wall -Werror \
- -D_GNU_SOURCE
-# build will succeed without it, but at runtime plugins do need libabrt_daemon
-dumpoops_LDADD = \
- ../lib/libabrt_daemon.la \
- ../lib/libreport.la
-
python_PYTHON = abrt.pth abrt_exception_handler.py
EXTRA_DIST = abrt_exception_handler.py.in $(man_MANS)
diff --git a/src/hooks/dumpoops.cpp b/src/hooks/dumpoops.cpp
deleted file mode 100644
index cb89a75d..00000000
--- a/src/hooks/dumpoops.cpp
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- Copyright (C) 2010 ABRT team
- Copyright (C) 2010 RedHat Inc
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License along
- with this program; if not, write to the Free Software Foundation, Inc.,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-
- Authors:
- Denys Vlasenko <dvlasenk@redhat.com>
- Zdenek Prikryl <zprikryl@redhat.com>
-*/
-
-#include "abrtlib.h"
-#include "KerneloopsScanner.h"
-#include <dlfcn.h>
-#include <glib.h>
-
-#define LOADSYM(fp, name) \
-do { \
- fp = (typeof(fp)) (dlsym(handle, name)); \
- if (!fp) \
- perror_msg_and_die(PLUGINS_LIB_DIR"/libKerneloopsScanner.so has no %s", name); \
-} while (0)
-
-
-int main(int argc, char **argv)
-{
- char *program_name = strrchr(argv[0], '/');
- program_name = program_name ? program_name + 1 : argv[0];
-
- /* Parse options */
- bool opt_d = 0, opt_s = 0;
- int opt;
- while ((opt = getopt(argc, argv, "dsv")) != -1) {
- switch (opt) {
- case 'd':
- opt_d = 1;
- break;
- case 's':
- opt_s = 1;
- break;
- case 'v':
- /* Kerneloops code uses VERB3, thus: */
- g_verbose = 3;
- break;
- default:
-usage:
- error_msg_and_die(
- "Usage: %s [-dsv] FILE\n\n"
- "Options:\n"
- "\t-d\tCreate ABRT dump for every oops found\n"
- "\t-s\tPrint found oopses on standard output\n"
- "\t-v\tBe verbose\n"
- , program_name
- );
- }
- }
- argv += optind;
- if (!argv[0])
- goto usage;
-
- msg_prefix = program_name;
-
- /* Load KerneloopsScanner plugin */
- // const plugin_info_t *plugin_info;
- CPlugin* (*plugin_newf)(void);
- int (*scan_syslog_file)(GList **oopsList, const char *filename, time_t *last_changed_p);
- int (*save_oops_to_debug_dump)(GList **oopsList);
- void *handle;
-
- errno = 0;
- //TODO: use it directly, not via dlopen?
- handle = dlopen(PLUGINS_LIB_DIR"/libKerneloopsScanner.so", RTLD_NOW);
- if (!handle)
- perror_msg_and_die("can't load %s", PLUGINS_LIB_DIR"/libKerneloopsScanner.so");
-
- // LOADSYM(plugin_info, "plugin_info");
- LOADSYM(plugin_newf, "plugin_new");
- LOADSYM(scan_syslog_file, "scan_syslog_file");
- LOADSYM(save_oops_to_debug_dump, "save_oops_to_debug_dump");
-
- // CKerneloopsScanner* scanner = (CKerneloopsScanner*) plugin_newf();
- // scanner->Init();
- // scanner->LoadSettings(path);
-
- /* Use it: parse and dump the oops */
- GList *oopsList = NULL;
- int cnt = scan_syslog_file(&oopsList, argv[0], NULL);
- log("found oopses: %d", cnt);
-
- if (cnt > 0) {
- if (opt_s) {
- int i = 0;
- int length = g_list_length(oopsList);
- while (i < length) {
- printf("\nVersion: %s", (char*)g_list_nth_data(oopsList, i));
- i++;
- }
- }
- if (opt_d) {
- log("dumping oopses");
- int errors = save_oops_to_debug_dump(&oopsList);
- if (errors > 0)
- {
- log("%d errors while dumping oopses", errors);
- return 1;
- }
- }
- }
-
- for (GList *li = oopsList; li != NULL; li = g_list_next(li))
- free((char*)li->data);
-
- g_list_free(oopsList);
- /*dlclose(handle); - why bother?
- * cos we are handsome and good lookin' guys :D
- */
- return 0;
-}
diff --git a/src/plugins/Kerneloops.conf b/src/plugins/Kerneloops.conf
index 67ad07b9..e65e176f 100644
--- a/src/plugins/Kerneloops.conf
+++ b/src/plugins/Kerneloops.conf
@@ -4,10 +4,4 @@ Enabled = yes
# Set to "yes" for compatibility with kerneloops.org tool.
InformAllUsers = yes
-# Kerneloops Scanner configuration
-##################################
-SysLogFile = /var/log/messages
-
-# KerneloopsReporter configuration
-##################################
SubmitURL = http://submit.kerneloops.org/submitoops.php
diff --git a/src/plugins/KerneloopsScanner.cpp b/src/plugins/KerneloopsScanner.cpp
deleted file mode 100644
index f4a637eb..00000000
--- a/src/plugins/KerneloopsScanner.cpp
+++ /dev/null
@@ -1,229 +0,0 @@
-/*
- Copyright (C) 2010 ABRT team
- Copyright (C) 2010 RedHat Inc
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License along
- with this program; if not, write to the Free Software Foundation, Inc.,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-
- Authors:
- Anton Arapov <anton@redhat.com>
- Arjan van de Ven <arjan@linux.intel.com>
-*/
-#include <syslog.h>
-#include <asm/unistd.h> /* __NR_syslog */
-#include <glib.h>
-#include "abrtlib.h"
-#include "comm_layer_inner.h"
-#include "KerneloopsSysLog.h"
-#include "KerneloopsScanner.h"
-
-// TODO: https://fedorahosted.org/abrt/ticket/78
-
-static int scan_dmesg(GList **oopsList)
-{
- VERB1 log("Scanning dmesg");
-
- /* syslog(3) - read the last len bytes from the log buffer
- * (non-destructively), but dont read more than was written
- * into the buffer since the last"clear ring buffer" cmd.
- * Returns the number of bytes read.
- */
- char *buffer = (char*)xzalloc(16*1024);
- syscall(__NR_syslog, 3, buffer, 16*1024 - 1); /* always NUL terminated */
- int cnt_FoundOopses = extract_oopses(oopsList, buffer, strlen(buffer));
- free(buffer);
-
- return cnt_FoundOopses;
-}
-
-
-/* "dumpoops" tool uses these two functions too */
-extern "C" {
-
-int scan_syslog_file(GList **oopsList, const char *filename, time_t *last_changed_p)
-{
- VERB1 log("Scanning syslog file '%s'", filename);
-
- char *buffer;
- struct stat statb;
- int fd;
- int cnt_FoundOopses;
- ssize_t sz;
- fd = open(filename, O_RDONLY);
- if (fd < 0)
- return 0;
- statb.st_size = 0; /* paranoia */
- if (fstat(fd, &statb) != 0 || statb.st_size < 1)
- {
- close(fd);
- return 0;
- }
-
- if (last_changed_p != NULL)
- {
- if (*last_changed_p == statb.st_mtime)
- {
- VERB1 log("Syslog file '%s' hasn't changed since last scan, skipping", filename);
- close(fd);
- return 0;
- }
- *last_changed_p = statb.st_mtime;
- }
-
- /*
- * In theory we have a race here, since someone could spew
- * to /var/log/messages before we read it in... we try to
- * deal with it by reading at most 10kbytes extra. If there's
- * more than that.. any oops will be in dmesg anyway.
- * Do not try to allocate an absurd amount of memory; ignore
- * older log messages because they are unlikely to have
- * sufficiently recent data to be useful. 32MB is more
- * than enough; it's not worth looping through more log
- * if the log is larger than that.
- */
- sz = statb.st_size + 10*1024;
- if (statb.st_size > (32*1024*1024 - 10*1024))
- {
- xlseek(fd, statb.st_size - (32*1024*1024 - 10*1024), SEEK_SET);
- sz = 32*1024*1024;
- }
- buffer = (char*)xzalloc(sz);
- sz = full_read(fd, buffer, sz);
- close(fd);
-
- cnt_FoundOopses = 0;
- if (sz > 0)
- cnt_FoundOopses = extract_oopses(oopsList, buffer, sz);
- free(buffer);
-
- return cnt_FoundOopses;
-}
-
-/* returns number of errors */
-int save_oops_to_debug_dump(GList **oopsList)
-{
- unsigned countdown = 16; /* do not report hundreds of oopses */
- unsigned idx = g_list_length(*oopsList);
- time_t t = time(NULL);
- pid_t my_pid = getpid();
-
- VERB1 log("Saving %u oopses as crash dump dirs", idx >= countdown ? countdown-1 : idx);
-
- char *tainted_str = NULL;
- /* once tainted flag is set to 1, only restart can reset the flag to 0 */
- FILE *tainted_fd = fopen("/proc/sys/kernel/tainted", "r");
- if (tainted_fd)
- {
- tainted_str = xmalloc_fgetline(tainted_fd);
- fclose(tainted_fd);
- }
- else
- error_msg("/proc/sys/kernel/tainted does not exist");
-
- int errors = 0;
-
- while (idx != 0 && --countdown != 0)
- {
- char path[sizeof(DEBUG_DUMPS_DIR"/kerneloops-%lu-%lu-%lu") + 3 * sizeof(long)*3];
- sprintf(path, DEBUG_DUMPS_DIR"/kerneloops-%lu-%lu-%lu", (long)t, (long)my_pid, (long)idx);
-
- char *first_line = (char*)g_list_nth_data(*oopsList,--idx);
- char *second_line = (char*)strchr(first_line, '\n'); /* never NULL */
- *second_line++ = '\0';
-
- struct dump_dir *dd = dd_create(path, /*uid:*/ 0);
- if (dd)
- {
- dd_save_text(dd, FILENAME_ANALYZER, "Kerneloops");
- dd_save_text(dd, FILENAME_EXECUTABLE, "kernel");
- dd_save_text(dd, FILENAME_KERNEL, first_line);
- dd_save_text(dd, FILENAME_CMDLINE, "not_applicable");
- dd_save_text(dd, FILENAME_BACKTRACE, second_line);
- /* Optional, makes generated bz more informative */
- strchrnul(second_line, '\n')[0] = '\0';
- dd_save_text(dd, FILENAME_REASON, second_line);
-
- if (tainted_str && tainted_str[0] != '0')
- dd_save_text(dd, FILENAME_TAINTED, tainted_str);
-
- free(tainted_str);
- dd_close(dd);
- }
- else
- errors++;
- }
-
- return errors;
-}
-
-} /* extern "C" */
-
-
-CKerneloopsScanner::CKerneloopsScanner()
-{
- int cnt_FoundOopses;
- m_syslog_last_change = 0;
-
- /* Scan dmesg, on first call only */
- GList *oopsList = NULL;
- cnt_FoundOopses = scan_dmesg(&oopsList);
- if (cnt_FoundOopses > 0)
- {
- int errors = save_oops_to_debug_dump(&oopsList);
- if (errors > 0)
- log("%d errors while dumping oopses", errors);
- }
-}
-
-void CKerneloopsScanner::Run(const char *pActionDir, const char *pArgs, int force)
-{
- const char *syslog_file = "/var/log/messages";
- map_plugin_settings_t::const_iterator it = m_pSettings.find("SysLogFile");
- if (it != m_pSettings.end())
- syslog_file = it->second.c_str();
-
- GList *oopsList = NULL;
- int cnt_FoundOopses = scan_syslog_file(&oopsList, syslog_file, &m_syslog_last_change);
- if (cnt_FoundOopses > 0)
- {
- int errors = save_oops_to_debug_dump(&oopsList);
- if (errors > 0)
- log("%d errors while dumping oopses", errors);
- /*
- * This marker in syslog file prevents us from
- * re-parsing old oopses (any oops before it is
- * ignored by scan_syslog_file()). The only problem
- * is that we can't be sure here that syslog_file
- * is the file where syslog(xxx) stuff ends up.
- */
- openlog("abrt", 0, LOG_KERN);
- syslog(LOG_WARNING,
- "Kerneloops: Reported %u kernel oopses to Abrt",
- cnt_FoundOopses);
- closelog();
- }
-
- for (GList *li = oopsList; li != NULL; li = g_list_next(li))
- free((char*)li->data);
- g_list_free(oopsList);
-}
-
-PLUGIN_INFO(ACTION,
- CKerneloopsScanner,
- "KerneloopsScanner",
- "0.0.1",
- _("Periodically scans for and saves kernel oopses"),
- "anton@redhat.com",
- "http://people.redhat.com/aarapov",
- "");
diff --git a/src/plugins/KerneloopsScanner.h b/src/plugins/KerneloopsScanner.h
deleted file mode 100644
index 2bddb0f4..00000000
--- a/src/plugins/KerneloopsScanner.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright 2007, Intel Corporation
- * Copyright 2009, Red Hat Inc.
- *
- * This file is part of Abrt.
- *
- * This program file is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; version 2 of the License.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program in a file named COPYING; if not, write to the
- * Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301 USA
- *
- * Authors:
- * Anton Arapov <anton@redhat.com>
- * Arjan van de Ven <arjan@linux.intel.com>
- */
-#ifndef KERNELOOPSSCANNER_H_
-#define KERNELOOPSSCANNER_H_
-
-#include "abrt_types.h"
-#include "plugin.h"
-#include "action.h"
-
-class CKerneloopsScanner : public CAction
-{
- private:
- time_t m_syslog_last_change;
- public:
- CKerneloopsScanner();
- virtual void Run(const char *pActionDir, const char *pArgs, int force);
-};
-
-#endif
diff --git a/src/plugins/KerneloopsSysLog.c b/src/plugins/KerneloopsSysLog.c
deleted file mode 100644
index 162fd977..00000000
--- a/src/plugins/KerneloopsSysLog.c
+++ /dev/null
@@ -1,391 +0,0 @@
-/*
- Copyright (C) 2010 ABRT team
- Copyright (C) 2010 RedHat Inc
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- Authors:
- Anton Arapov <anton@redhat.com>
- Arjan van de Ven <arjan@linux.intel.com>
- */
-#include "abrtlib.h"
-#include "KerneloopsSysLog.h"
-#include <glib.h>
-
-static void queue_oops(GList **vec, const char *data, const char *version)
-{
- char *ver_data = xasprintf("%s\n%s", version, data);
- *vec = g_list_append(*vec, ver_data);
-}
-
-/*
- * extract_version tries to find the kernel version in given data
- */
-static char *extract_version(const char *linepointer)
-{
- if (strstr(linepointer, "Pid")
- || strstr(linepointer, "comm")
- || strstr(linepointer, "CPU")
- || strstr(linepointer, "REGS")
- || strstr(linepointer, "EFLAGS")
- ) {
- char* start;
- char* end;
-
- start = strstr((char*)linepointer, "2.6.");
- if (start)
- {
- end = strchr(start, ')');
- if (!end)
- end = strchrnul(start, ' ');
- return xstrndup(start, end-start);
- }
- }
-
- return NULL;
-}
-
-/*
- * extract_oops tries to find oops signatures in a log
- */
-struct line_info {
- char *ptr;
- char level;
-};
-
-static int record_oops(GList **oopses, struct line_info* lines_info, int oopsstart, int oopsend)
-{
- int q;
- int len;
- char *oops;
- char *version;
-
- len = 2;
- for (q = oopsstart; q <= oopsend; q++)
- len += strlen(lines_info[q].ptr) + 1;
-
- oops = (char*)xzalloc(len);
-
- version = NULL;
- for (q = oopsstart; q <= oopsend; q++)
- {
- if (!version)
- version = extract_version(lines_info[q].ptr);
-
- if (lines_info[q].ptr[0])
- {
- strcat(oops, lines_info[q].ptr);
- strcat(oops, "\n");
- }
- }
- int rv = 1;
- /* too short oopses are invalid */
- if (strlen(oops) > 100)
- queue_oops(oopses, oops, version ? version : "undefined");
- else
- {
- VERB3 log("Dropped oops: too short");
- rv = 0;
- }
- free(oops);
- free(version);
- return rv;
-}
-#define REALLOC_CHUNK 1000
-int extract_oopses(GList **oopses, char *buffer, size_t buflen)
-{
- char *c;
- int linecount = 0;
- int lines_info_alloc = 0;
- struct line_info *lines_info = NULL;
-
- /* Split buffer into lines */
-
- if (buflen != 0)
- buffer[buflen - 1] = '\n'; /* the buffer usually ends with \n, but let's make sure */
- c = buffer;
- while (c < buffer + buflen)
- {
- char linelevel;
- char *c9;
- char *colon;
-
- c9 = (char*)memchr(c, '\n', buffer + buflen - c); /* a \n will always be found */
- assert(c9);
- *c9 = '\0'; /* turn the \n into a string termination */
- if (c9 == c)
- goto next_line;
-
- /* Is it a syslog file (/var/log/messages or similar)?
- * Even though _usually_ it looks like "Nov 19 12:34:38 localhost kernel: xxx",
- * some users run syslog in non-C locale:
- * "2010-02-22T09:24:08.156534-08:00 gnu-4 gnome-session[2048]: blah blah"
- * ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ !!!
- * We detect it by checking for N:NN:NN pattern in first 15 chars
- * (and this still is not good enough... false positive: "pci 0000:15:00.0: PME# disabled")
- */
- colon = strchr(c, ':');
- if (colon && colon > c && colon < c + 15
- && isdigit(colon[-1]) /* N:... */
- && isdigit(colon[1]) /* ...N:NN:... */
- && isdigit(colon[2])
- && colon[3] == ':'
- && isdigit(colon[4]) /* ...N:NN:NN... */
- && isdigit(colon[5])
- ) {
- /* It's syslog file, not a bare dmesg */
-
- /* Skip non-kernel lines */
- char *kernel_str = strstr(c, "kernel: ");
- if (kernel_str == NULL)
- {
- /* if we see our own marker:
- * "hostname abrt: Kerneloops: Reported 1 kernel oopses to Abrt"
- * we know we submitted everything upto here already */
- if (strstr(c, "abrt:") && strstr(c, "Abrt"))
- {
- VERB3 log("Found our marker at line %d, restarting line count from 0", linecount);
- linecount = 0;
- lines_info_alloc = 0;
- free(lines_info);
- lines_info = NULL;
- }
- goto next_line;
- }
- c = kernel_str + sizeof("kernel: ")-1;
- }
-
- linelevel = 0;
- /* store and remove kernel log level */
- if (*c == '<' && c[1] && c[2] == '>')
- {
- linelevel = c[1];
- c += 3;
- }
- /* remove jiffies time stamp counter if present */
- if (*c == '[')
- {
- char *c2 = strchr(c, '.');
- char *c3 = strchr(c, ']');
- if (c2 && c3 && (c2 < c3) && (c3-c) < 14 && (c2-c) < 8)
- {
- c = c3 + 1;
- if (*c == ' ')
- c++;
- }
- }
- if (linecount >= lines_info_alloc)
- {
- lines_info_alloc += REALLOC_CHUNK;
- lines_info = (struct line_info*)xrealloc(lines_info,
- lines_info_alloc * sizeof(lines_info[0]));
- }
- lines_info[linecount].ptr = c;
- lines_info[linecount].level = linelevel;
- linecount++;
-next_line:
- c = c9 + 1;
- }
-
- /* Analyze lines */
-
- int i;
- char prevlevel = 0;
- int oopsstart = -1;
- int inbacktrace = 0;
- int oopsesfound = 0;
-
- i = 0;
- while (i < linecount)
- {
- char *curline = lines_info[i].ptr;
-
- if (curline == NULL)
- {
- i++;
- continue;
- }
- while (*curline == ' ')
- curline++;
-
- if (oopsstart < 0)
- {
- /* Find start-of-oops markers */
- /* In some comparisons, we skip 1st letter, to avoid dealing with
- * changes in capitalization in kernel. For example, I see that
- * current kernel git (at 2011-01-01) has both "kernel BUG at ..."
- * and "Kernel BUG at ..." messages, and I don't want to change
- * the code below whenever kernel is changed to use "K" (or "k")
- * uniformly.
- */
- if (strstr(curline, /*g*/ "eneral protection fault:"))
- oopsstart = i;
- else if (strstr(curline, "BUG:"))
- oopsstart = i;
- else if (strstr(curline, /*k*/ "ernel BUG at"))
- oopsstart = i;
- else if (strstr(curline, "do_IRQ: stack overflow:"))
- oopsstart = i;
- else if (strstr(curline, "RTNL: assertion failed"))
- oopsstart = i;
- else if (strstr(curline, /*e*/ "eek! page_mapcount(page) went negative!"))
- oopsstart = i;
- else if (strstr(curline, /*n*/ "ear stack overflow (cur:"))
- oopsstart = i;
- else if (strstr(curline, /*d*/ "ouble fault:"))
- oopsstart = i;
- else if (strstr(curline, /*b*/ "adness at"))
- oopsstart = i;
- else if (strstr(curline, "NETDEV WATCHDOG"))
- oopsstart = i;
- else if (strstr(curline, "WARNING: at ")) /* WARN_ON() generated message */
- oopsstart = i;
- else if (strstr(curline, /*u*/ "nable to handle kernel"))
- oopsstart = i;
- else if (strstr(curline, /*s*/ "ysctl table check failed"))
- oopsstart = i;
- else if (strstr(curline, "INFO: possible recursive locking detected"))
- oopsstart = i;
- // Not needed: "--[ cut here ]--" is always followed
- // by "Badness at", "kernel BUG at", or "WARNING: at" string
- //else if (strstr(curline, "------------[ cut here ]------------"))
- // oopsstart = i;
- else if (strstr(curline, "list_del corruption"))
- oopsstart = i;
- else if (strstr(curline, "list_add corruption"))
- oopsstart = i;
-
- if (i >= 3 && strstr(curline, "Oops:"))
- oopsstart = i-3;
-
- if (oopsstart >= 0)
- {
- /* debug information */
- VERB3 {
- log("Found oops at line %d: '%s'", oopsstart, lines_info[oopsstart].ptr);
- if (oopsstart != i)
- log("Trigger line is %d: '%s'", i, c);
- }
- /* try to find the end marker */
- int i2 = i + 1;
- while (i2 < linecount && i2 < (i+50))
- {
- if (strstr(lines_info[i2].ptr, "---[ end trace"))
- {
- inbacktrace = 1;
- i = i2;
- break;
- }
- i2++;
- }
- }
- }
-
- /* Are we entering a call trace part? */
- /* a call trace starts with "Call Trace:" or with the " [<.......>] function+0xFF/0xAA" pattern */
- if (oopsstart >= 0 && !inbacktrace)
- {
- if (strstr(curline, "Call Trace:"))
- inbacktrace = 1;
- else
- if (strnlen(curline, 9) > 8
- && curline[0] == '[' && curline[1] == '<'
- && strstr(curline, ">]")
- && strstr(curline, "+0x")
- && strstr(curline, "/0x")
- ) {
- inbacktrace = 1;
- }
- }
-
- /* Are we at the end of an oops? */
- else if (oopsstart >= 0 && inbacktrace)
- {
- int oopsend = INT_MAX;
-
- /* line needs to start with " [" or have "] [" if it is still a call trace */
- /* example: "[<ffffffffa006c156>] radeon_get_ring_head+0x16/0x41 [radeon]" */
- if (curline[0] != '['
- && !strstr(curline, "] [")
- && !strstr(curline, "--- Exception")
- && !strstr(curline, "LR =")
- && !strstr(curline, "<#DF>")
- && !strstr(curline, "<IRQ>")
- && !strstr(curline, "<EOI>")
- && !strstr(curline, "<<EOE>>")
- && strncmp(curline, "Code: ", 6) != 0
- && strncmp(curline, "RIP ", 4) != 0
- && strncmp(curline, "RSP ", 4) != 0
- ) {
- oopsend = i-1; /* not a call trace line */
- }
- /* oops lines are always more than 8 chars long */
- else if (strnlen(curline, 8) < 8)
- oopsend = i-1;
- /* single oopses are of the same loglevel */
- else if (lines_info[i].level != prevlevel)
- oopsend = i-1;
- else if (strstr(curline, "Instruction dump:"))
- oopsend = i;
- /* if a new oops starts, this one has ended */
- else if (strstr(curline, "WARNING: at ") && oopsstart != i) /* WARN_ON() generated message */
- oopsend = i-1;
- else if (strstr(curline, "Unable to handle") && oopsstart != i)
- oopsend = i-1;
- /* kernel end-of-oops marker (not including marker itself) */
- else if (strstr(curline, "---[ end trace"))
- oopsend = i-1;
-
- if (oopsend <= i)
- {
- VERB3 log("End of oops at line %d (%d): '%s'", oopsend, i, lines_info[oopsend].ptr);
- if (record_oops(oopses, lines_info, oopsstart, oopsend))
- oopsesfound++;
- oopsstart = -1;
- inbacktrace = 0;
- }
- }
-
- prevlevel = lines_info[i].level;
- i++;
-
- if (oopsstart >= 0)
- {
- /* Do we have a suspiciously long oops? Cancel it */
- if (i-oopsstart > 60)
- {
- inbacktrace = 0;
- oopsstart = -1;
- VERB3 log("Dropped oops, too long");
- continue;
- }
- if (!inbacktrace && i-oopsstart > 40)
- {
- /*inbacktrace = 0; - already is */
- oopsstart = -1;
- VERB3 log("Dropped oops, too long");
- continue;
- }
- }
- } /* while (i < linecount) */
-
- /* process last oops if we have one */
- if (oopsstart >= 0 && inbacktrace)
- {
- int oopsend = i-1;
- VERB3 log("End of oops at line %d (end of file): '%s'", oopsend, lines_info[oopsend].ptr);
- if (record_oops(oopses, lines_info, oopsstart, oopsend))
- oopsesfound++;
- }
-
- free(lines_info);
- return oopsesfound;
-}
diff --git a/src/plugins/KerneloopsSysLog.h b/src/plugins/KerneloopsSysLog.h
deleted file mode 100644
index eeaaed6b..00000000
--- a/src/plugins/KerneloopsSysLog.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright 2007, Intel Corporation
- * Copyright 2009, Red Hat Inc.
- *
- * This file is part of Abrt.
- *
- * This program file is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; version 2 of the License.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program in a file named COPYING; if not, write to the
- * Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301 USA
- *
- * Authors:
- * Anton Arapov <anton@redhat.com>
- * Arjan van de Ven <arjan@linux.intel.com>
- */
-
-#ifndef __INCLUDE_GUARD_KERNELOOPSSYSLOG_H_
-#define __INCLUDE_GUARD_KERNELOOPSSYSLOG_H_
-
-#include "abrt_types.h"
-#include <glib.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-int extract_oopses(GList **oopses, char *buffer, size_t buflen);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/src/plugins/Makefile.am b/src/plugins/Makefile.am
index 5d3b5890..f70198be 100644
--- a/src/plugins/Makefile.am
+++ b/src/plugins/Makefile.am
@@ -17,8 +17,7 @@ bin_PROGRAMS = \
abrt-action-print
pluginslib_LTLIBRARIES = \
- libCCpp.la \
- libKerneloopsScanner.la
+ libCCpp.la
dist_pluginslib_DATA = \
Logger.glade \
@@ -42,7 +41,6 @@ dist_pluginsconf_DATA = \
man_MANS = \
abrt-Bugzilla.7 \
- abrt-KerneloopsScanner.7 \
abrt-KerneloopsReporter.7 \
abrt-Logger.7 \
abrt-Mailx.7 \
@@ -76,21 +74,6 @@ libCCpp_la_CPPFLAGS = \
libCCpp_la_LDFLAGS = \
-avoid-version
-# KerneloopsScanner
-libKerneloopsScanner_la_SOURCES = \
- KerneloopsScanner.cpp KerneloopsScanner.h \
- KerneloopsSysLog.c KerneloopsSysLog.h
-libKerneloopsScanner_la_CPPFLAGS = \
- -I$(srcdir)/../include/report -I$(srcdir)/../include \
- -I$(srcdir)/../lib \
- -DDEBUG_DUMPS_DIR=\"$(DEBUG_DUMPS_DIR)\" \
- $(GLIB_CFLAGS) \
- -D_GNU_SOURCE \
- -Wall -Werror
-libKerneloopsScanner_la_LDFLAGS = \
- -avoid-version \
- $(GLIB_LIBS)
-
abrt_dump_oops_SOURCES = \
abrt-dump-oops.c
abrt_dump_oops_CPPFLAGS = \
diff --git a/src/plugins/abrt-KerneloopsScanner.7 b/src/plugins/abrt-KerneloopsScanner.7
deleted file mode 100644
index ff094847..00000000
--- a/src/plugins/abrt-KerneloopsScanner.7
+++ /dev/null
@@ -1,46 +0,0 @@
-.TH abrt "7" "1 Jun 2009" ""
-.SH NAME
-KerneloopsScanner plugin for abrt(8)
-.SH DESCRIPTION
-.P
-.I abrt
-is a daemon that watches for application crashes. When a crash occurs,
-it collects the crash data and takes action according to
-its configuration. This manual page describes the \fIKerneloopsScanner\fP
-plugin for \fIabrt\fP.
-.P
-This plugin reads the system log file (default /var/log/messages)
-and stores the kernel oops crashes, which were not already
-reported, to abrt's debug dump directory.
-.P
-To distinguish between new crashes and crashes
-that were already reported, the plugin makes its own entry
-in the log file, which acts as a separator.
-.SH INVOCATION
-The plugin is invoked in the \fIabrt.conf\fP configuration file.
-No parameters are necessary.
-.SH CONFIGURATION
-The \fIKerneloopsScanner.conf\fP configuration file contains one entry:
-.SS SysLogFile
-The file to scan. The default is
-.br
-SysLogFile = /var/log/messages
-.SH EXAMPLES
-.P
-This is a snippet from the \fIabrt.conf\fP configuration file.
-Every 10 seconds look if there were any kernel crashes:
-.P
-[common]
-.br
-ActionsAndReporters = Kerneloops, KerneloopsScanner
-.br
-[cron]
-.br
-10 = KerneloopsScanner
-.SH "SEE ALSO"
-.IR abrt (8),
-.IR abrt.conf (5),
-.IR abrt-plugins (7)
-.SH AUTHOR
-Written by Anton Arapov <anton@redhat.com>. Manual
-page by Daniel Novotny <dnovotny@redhat.com>.
diff --git a/src/plugins/abrt-plugins.7 b/src/plugins/abrt-plugins.7
index 28de8f02..d8027057 100644
--- a/src/plugins/abrt-plugins.7
+++ b/src/plugins/abrt-plugins.7
@@ -33,7 +33,6 @@ stored in the \fI/etc/abrt/plugins\fP directory.
.IR abrt-Bugzilla (7),
.IR abrt-Upload (7),
.IR abrt-KerneloopsReporter (7),
-.IR abrt-KerneloopsScanner (7),
.IR abrt-Logger (7),
.IR abrt-Mailx (7),
.SH AUTHOR