|
|
baab13 |
From 0ec7f45a005a5faeb3d013710572d7b09fada376 Mon Sep 17 00:00:00 2001
|
|
|
baab13 |
From: Jakub Filak <jfilak@redhat.com>
|
|
|
baab13 |
Date: Fri, 21 Mar 2014 15:36:58 +0100
|
|
|
baab13 |
Subject: [ABRT PATCH 49/66] koops: add an option controlling MCE detection
|
|
|
baab13 |
|
|
|
baab13 |
It is necessary to be able to turn off the detection of Non-fatal MCEs
|
|
|
baab13 |
on a certain machine.
|
|
|
baab13 |
|
|
|
baab13 |
Related to #807
|
|
|
baab13 |
Resolves: rhbz#1076820
|
|
|
baab13 |
|
|
|
baab13 |
Signed-off-by: Jakub Filak <jfilak@redhat.com>
|
|
|
baab13 |
|
|
|
baab13 |
Conflicts:
|
|
|
baab13 |
src/hooks/Makefile.am
|
|
|
baab13 |
---
|
|
|
baab13 |
doc/abrt-dump-oops.txt | 5 ++++
|
|
|
baab13 |
doc/dbus-configuration/Makefile.am | 1 +
|
|
|
baab13 |
.../com.redhat.problems.configuration.oops.xml.in | 11 ++++++++
|
|
|
baab13 |
src/hooks/Makefile.am | 3 ++-
|
|
|
baab13 |
src/hooks/oops.conf | 7 ++++++
|
|
|
baab13 |
src/include/libabrt.h | 10 ++++++++
|
|
|
baab13 |
src/lib/kernel.c | 29 +++++++++++++++++++++-
|
|
|
baab13 |
src/plugins/abrt-dump-oops.c | 25 ++++++++++++++++++-
|
|
|
baab13 |
8 files changed, 88 insertions(+), 3 deletions(-)
|
|
|
baab13 |
create mode 100644 doc/dbus-configuration/com.redhat.problems.configuration.oops.xml.in
|
|
|
baab13 |
create mode 100644 src/hooks/oops.conf
|
|
|
baab13 |
|
|
|
baab13 |
diff --git a/doc/abrt-dump-oops.txt b/doc/abrt-dump-oops.txt
|
|
|
baab13 |
index cdb985c..5aa6bca 100644
|
|
|
baab13 |
--- a/doc/abrt-dump-oops.txt
|
|
|
baab13 |
+++ b/doc/abrt-dump-oops.txt
|
|
|
baab13 |
@@ -14,6 +14,11 @@ DESCRIPTION
|
|
|
baab13 |
This tool creates problem directory from, updates problem directory with or
|
|
|
baab13 |
prints oops extracted from FILE or standard input.
|
|
|
baab13 |
|
|
|
baab13 |
+FILES
|
|
|
baab13 |
+-----
|
|
|
baab13 |
+/etc/abrt/plugins/oops.conf::
|
|
|
baab13 |
+ Configuration file where user can disable detection of non-fatal MCEs
|
|
|
baab13 |
+
|
|
|
baab13 |
OPTIONS
|
|
|
baab13 |
-------
|
|
|
baab13 |
-v, --verbose::
|
|
|
baab13 |
diff --git a/doc/dbus-configuration/Makefile.am b/doc/dbus-configuration/Makefile.am
|
|
|
baab13 |
index 2a3889d..15173de 100644
|
|
|
baab13 |
--- a/doc/dbus-configuration/Makefile.am
|
|
|
baab13 |
+++ b/doc/dbus-configuration/Makefile.am
|
|
|
baab13 |
@@ -8,6 +8,7 @@ dist_dbusabrtinterfaces_DATA = \
|
|
|
baab13 |
com.redhat.problems.configuration.xml \
|
|
|
baab13 |
com.redhat.problems.configuration.abrt.xml \
|
|
|
baab13 |
com.redhat.problems.configuration.ccpp.xml \
|
|
|
baab13 |
+ com.redhat.problems.configuration.oops.xml \
|
|
|
baab13 |
com.redhat.problems.configuration.python.xml \
|
|
|
baab13 |
com.redhat.problems.configuration.vmcore.xml \
|
|
|
baab13 |
com.redhat.problems.configuration.xorg.xml
|
|
|
baab13 |
diff --git a/doc/dbus-configuration/com.redhat.problems.configuration.oops.xml.in b/doc/dbus-configuration/com.redhat.problems.configuration.oops.xml.in
|
|
|
baab13 |
new file mode 100644
|
|
|
baab13 |
index 0000000..22bd166
|
|
|
baab13 |
--- /dev/null
|
|
|
baab13 |
+++ b/doc/dbus-configuration/com.redhat.problems.configuration.oops.xml.in
|
|
|
baab13 |
@@ -0,0 +1,11 @@
|
|
|
baab13 |
+
|
|
|
baab13 |
+ "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
|
|
|
baab13 |
+
|
|
|
baab13 |
+<node name="/com/redhat/problems/configuration/oops">
|
|
|
baab13 |
+ <annotation name="com.redhat.problems.ConfFile" value="/etc/abrt/plugins/oops.conf" />
|
|
|
baab13 |
+ <annotation name="com.redhat.problems.DefaultConfFile" value="/usr/share/abrt/conf.d/plugins/oops.conf" />
|
|
|
baab13 |
+
|
|
|
baab13 |
+ <interface name="com.redhat.problems.configuration.oops">
|
|
|
baab13 |
+ <property name="OnlyFatalMCE" type="b" access="readwrite" />
|
|
|
baab13 |
+ </interface>
|
|
|
baab13 |
+</node>
|
|
|
baab13 |
diff --git a/src/hooks/Makefile.am b/src/hooks/Makefile.am
|
|
|
baab13 |
index 1cce3d7..e536089 100644
|
|
|
baab13 |
--- a/src/hooks/Makefile.am
|
|
|
baab13 |
+++ b/src/hooks/Makefile.am
|
|
|
baab13 |
@@ -6,7 +6,8 @@ pluginsconfdir = $(PLUGINS_CONF_DIR)
|
|
|
baab13 |
dist_pluginsconf_DATA = \
|
|
|
baab13 |
CCpp.conf \
|
|
|
baab13 |
python.conf \
|
|
|
baab13 |
- vmcore.conf
|
|
|
baab13 |
+ vmcore.conf \
|
|
|
baab13 |
+ oops.conf
|
|
|
baab13 |
|
|
|
baab13 |
defaultpluginsconfdir = $(DEFAULT_PLUGINS_CONF_DIR)
|
|
|
baab13 |
dist_defaultpluginsconf_DATA = $(dist_pluginsconf_DATA)
|
|
|
baab13 |
diff --git a/src/hooks/oops.conf b/src/hooks/oops.conf
|
|
|
baab13 |
new file mode 100644
|
|
|
baab13 |
index 0000000..0e35a68
|
|
|
baab13 |
--- /dev/null
|
|
|
baab13 |
+++ b/src/hooks/oops.conf
|
|
|
baab13 |
@@ -0,0 +1,7 @@
|
|
|
baab13 |
+# Lot of Machine Check Exceptions are correctable and thus not interesting to
|
|
|
baab13 |
+# users. Moreover some hardware may produce plenty of MCEs by design.
|
|
|
baab13 |
+#
|
|
|
baab13 |
+# Setting the following option to 'yes' will configure ABRT to detect only
|
|
|
baab13 |
+# the fatal MCEs.
|
|
|
baab13 |
+#
|
|
|
baab13 |
+OnlyFatalMCE = no
|
|
|
baab13 |
diff --git a/src/include/libabrt.h b/src/include/libabrt.h
|
|
|
baab13 |
index 3e42a09..85a5a5c 100644
|
|
|
baab13 |
--- a/src/include/libabrt.h
|
|
|
baab13 |
+++ b/src/include/libabrt.h
|
|
|
baab13 |
@@ -9,6 +9,8 @@
|
|
|
baab13 |
#ifndef LIBABRT_H_
|
|
|
baab13 |
#define LIBABRT_H_
|
|
|
baab13 |
|
|
|
baab13 |
+#include <regex.h>
|
|
|
baab13 |
+
|
|
|
baab13 |
#include <gio/gio.h> /* dbus */
|
|
|
baab13 |
#include "abrt-dbus.h"
|
|
|
baab13 |
/* libreport's internal functions we use: */
|
|
|
baab13 |
@@ -109,6 +111,14 @@ int koops_hash_str(char hash_str[SHA1_RESULT_LEN*2 + 1], const char *oops_buf);
|
|
|
baab13 |
void koops_extract_oopses(GList **oops_list, char *buffer, size_t buflen);
|
|
|
baab13 |
#define koops_print_suspicious_strings abrt_koops_print_suspicious_strings
|
|
|
baab13 |
void koops_print_suspicious_strings(void);
|
|
|
baab13 |
+/**
|
|
|
baab13 |
+ * Prints all suspicious strings that do not match any of the regular
|
|
|
baab13 |
+ * expression in NULL terminated list.
|
|
|
baab13 |
+ *
|
|
|
baab13 |
+ * The regular expression should be compiled with REG_NOSUB flag.
|
|
|
baab13 |
+ */
|
|
|
baab13 |
+#define koops_print_suspicious_strings_filtered abrt_koops_print_suspicious_strings_filtered
|
|
|
baab13 |
+void koops_print_suspicious_strings_filtered(const regex_t **filterout);
|
|
|
baab13 |
|
|
|
baab13 |
/* dbus client api */
|
|
|
baab13 |
|
|
|
baab13 |
diff --git a/src/lib/kernel.c b/src/lib/kernel.c
|
|
|
baab13 |
index ad20c65..799463d 100644
|
|
|
baab13 |
--- a/src/lib/kernel.c
|
|
|
baab13 |
+++ b/src/lib/kernel.c
|
|
|
baab13 |
@@ -158,8 +158,35 @@ static const char *const s_koops_suspicious_strings[] = {
|
|
|
baab13 |
|
|
|
baab13 |
void koops_print_suspicious_strings(void)
|
|
|
baab13 |
{
|
|
|
baab13 |
+ koops_print_suspicious_strings_filtered(NULL);
|
|
|
baab13 |
+}
|
|
|
baab13 |
+
|
|
|
baab13 |
+static bool match_any(const regex_t **res, const char *str)
|
|
|
baab13 |
+{
|
|
|
baab13 |
+ for (const regex_t **r = res; *r != NULL; ++r)
|
|
|
baab13 |
+ {
|
|
|
baab13 |
+ /* Regular expressions compiled with REG_NOSUB */
|
|
|
baab13 |
+ const int reti = regexec(*r, str, 0, NULL, 0);
|
|
|
baab13 |
+ if (reti == 0)
|
|
|
baab13 |
+ return true;
|
|
|
baab13 |
+ else if (reti != REG_NOMATCH)
|
|
|
baab13 |
+ {
|
|
|
baab13 |
+ char msgbuf[100];
|
|
|
baab13 |
+ regerror(reti, *r, msgbuf, sizeof(msgbuf));
|
|
|
baab13 |
+ error_msg_and_die("Regex match failed: %s", msgbuf);
|
|
|
baab13 |
+ }
|
|
|
baab13 |
+ }
|
|
|
baab13 |
+
|
|
|
baab13 |
+ return false;
|
|
|
baab13 |
+}
|
|
|
baab13 |
+
|
|
|
baab13 |
+void koops_print_suspicious_strings_filtered(const regex_t **filterout)
|
|
|
baab13 |
+{
|
|
|
baab13 |
for (const char *const *str = s_koops_suspicious_strings; *str; ++str)
|
|
|
baab13 |
- puts(*str);
|
|
|
baab13 |
+ {
|
|
|
baab13 |
+ if (filterout == NULL || !match_any(filterout, *str))
|
|
|
baab13 |
+ puts(*str);
|
|
|
baab13 |
+ }
|
|
|
baab13 |
}
|
|
|
baab13 |
|
|
|
baab13 |
void koops_extract_oopses(GList **oops_list, char *buffer, size_t buflen)
|
|
|
baab13 |
diff --git a/src/plugins/abrt-dump-oops.c b/src/plugins/abrt-dump-oops.c
|
|
|
baab13 |
index 12291be..9f0dc87 100644
|
|
|
baab13 |
--- a/src/plugins/abrt-dump-oops.c
|
|
|
baab13 |
+++ b/src/plugins/abrt-dump-oops.c
|
|
|
baab13 |
@@ -295,7 +295,30 @@ int main(int argc, char **argv)
|
|
|
baab13 |
|
|
|
baab13 |
if (opts & OPT_m)
|
|
|
baab13 |
{
|
|
|
baab13 |
- koops_print_suspicious_strings();
|
|
|
baab13 |
+ map_string_t *settings = new_map_string();
|
|
|
baab13 |
+
|
|
|
baab13 |
+ load_abrt_plugin_conf_file("oops.conf", settings);
|
|
|
baab13 |
+
|
|
|
baab13 |
+ int only_fatal_mce = 1;
|
|
|
baab13 |
+ try_get_map_string_item_as_bool(settings, "OnlyFatalMCE", &only_fatal_mce);
|
|
|
baab13 |
+
|
|
|
baab13 |
+ free_map_string(settings);
|
|
|
baab13 |
+
|
|
|
baab13 |
+ if (only_fatal_mce)
|
|
|
baab13 |
+ {
|
|
|
baab13 |
+ regex_t mce_re;
|
|
|
baab13 |
+ if (regcomp(&mce_re, "^Machine .*$", REG_NOSUB) != 0)
|
|
|
baab13 |
+ perror_msg_and_die(_("Failed to compile regex"));
|
|
|
baab13 |
+
|
|
|
baab13 |
+ const regex_t *filter[] = { &mce_re, NULL };
|
|
|
baab13 |
+
|
|
|
baab13 |
+ koops_print_suspicious_strings_filtered(filter);
|
|
|
baab13 |
+
|
|
|
baab13 |
+ regfree(&mce_re);
|
|
|
baab13 |
+ }
|
|
|
baab13 |
+ else
|
|
|
baab13 |
+ koops_print_suspicious_strings();
|
|
|
baab13 |
+
|
|
|
baab13 |
return 1;
|
|
|
baab13 |
}
|
|
|
baab13 |
|
|
|
baab13 |
--
|
|
|
baab13 |
1.8.3.1
|
|
|
baab13 |
|