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