arrfab / rpms / abrt

Forked from rpms/abrt 5 years ago
Clone

Blame SOURCES/0067-koops-don-t-analyze-MCEs-like-standard-oopses.patch

baab13
From ac3121ac9b752d62d82b329b8bae520147ebe6a6 Mon Sep 17 00:00:00 2001
baab13
From: Jakub Filak <jfilak@redhat.com>
baab13
Date: Thu, 26 Jun 2014 11:29:17 +0200
baab13
Subject: [ABRT PATCH 67/68] koops: don't analyze MCEs like standard oopses
baab13
baab13
MCEs are not kernel oopses as we know them, MCEs do not have stacktrace
baab13
and ABRT drops oopses without meaningful stack trace frames for hashing.
baab13
The required files are generated by abrt-action-check-oops-for-hw-errror
baab13
because that executable understands the format of MCE data.
baab13
  - uuid    (sha1 of backtrace file)
baab13
  - duphash (sha1 of backtrace file)
baab13
  - kernel  (from dmesg)
baab13
baab13
Related to #1076820
baab13
baab13
Signed-off-by: Jakub Filak <jfilak@redhat.com>
baab13
---
baab13
 src/plugins/abrt-action-check-oops-for-hw-error.in | 19 ++++++++++++++
baab13
 src/plugins/koops_event.conf                       | 29 +++++++++++-----------
baab13
 2 files changed, 33 insertions(+), 15 deletions(-)
baab13
baab13
diff --git a/src/plugins/abrt-action-check-oops-for-hw-error.in b/src/plugins/abrt-action-check-oops-for-hw-error.in
baab13
index d74f89d..6bf37f5 100644
baab13
--- a/src/plugins/abrt-action-check-oops-for-hw-error.in
baab13
+++ b/src/plugins/abrt-action-check-oops-for-hw-error.in
baab13
@@ -4,6 +4,8 @@ import sys
baab13
 import os
baab13
 import locale
baab13
 import gettext
baab13
+import hashlib
baab13
+import re
baab13
 
baab13
 GETTEXT_PROGNAME = "abrt"
baab13
 
baab13
@@ -83,6 +85,23 @@ if __name__ == "__main__":
baab13
     ))
baab13
     f.close()
baab13
 
baab13
+    oops_hash = hashlib.sha1()
baab13
+    with open("backtrace", "r") as btfile:
baab13
+        for line in btfile:
baab13
+            oops_hash.update(line)
baab13
+
baab13
+    with open_or_die("uuid", "w") as f:
baab13
+        f.write(oops_hash.hexdigest())
baab13
+
baab13
+    with open_or_die("duphash", "w") as f:
baab13
+        f.write(oops_hash.hexdigest())
baab13
+
baab13
+    res = tail_with_search("dmesg", "Linux version", 1)
baab13
+    if res:
baab13
+        kernel = re.sub(r"^.*Linux version ([^ ]+) .*$", r"\1", res[0]);
baab13
+        with open_or_die("kernel", "w") as krnlfile:
baab13
+            krnlfile.write(kernel)
baab13
+
baab13
     # vmcore MCEs already have good backtrace element, nothing more to do
baab13
     if vmcore_mce:
baab13
         sys.exit(0)
baab13
diff --git a/src/plugins/koops_event.conf b/src/plugins/koops_event.conf
baab13
index b1472ce..1604acf 100644
baab13
--- a/src/plugins/koops_event.conf
baab13
+++ b/src/plugins/koops_event.conf
baab13
@@ -1,23 +1,22 @@
baab13
 # Analyze
baab13
 EVENT=post-create analyzer=Kerneloops
baab13
         # >> instead of > is due to bugzilla.redhat.com/show_bug.cgi?id=854266
baab13
-        abrt-action-analyze-oops &&
baab13
-        dmesg >>dmesg &&
baab13
-        {
baab13
-        # action-analyze-oops tries to save kernel version,
baab13
-        # but for some oopses it can't do that (e.g. MCEs).
baab13
-        # If it failed, try to extract version from dmesg:
baab13
-        test -f kernel ||
baab13
-            {
baab13
-            k=`sed -n '/Linux version/ s/.*Linux version \([^ ]*\) .*/\1/p' dmesg | tail -n1`
baab13
-            test "$k" != "" && printf "%s" "$k" >kernel
baab13
-            true   # ignore possible failures in previous command
baab13
-            }
baab13
-        } &&
baab13
-        abrt-action-save-kernel-data &&
baab13
+        # 'dmesg' file is required by check-oops-for-hw-error
baab13
+        dmesg >>dmesg
baab13
         # Do not fail the event (->do not delete problem dir)
baab13
         # if check-oops-for-hw-error exits nonzero:
baab13
-        { abrt-action-check-oops-for-hw-error || true; }
baab13
+        {
baab13
+        abrt-action-check-oops-for-hw-error || true
baab13
+        } &&
baab13
+        {
baab13
+        # run abrt-action-analyze-oops only if check-hw-error didn't create the
baab13
+        # required files
baab13
+        if test ! -f uuid -a ! -f duphash; then
baab13
+             abrt-action-analyze-oops || exit 1
baab13
+        fi
baab13
+        } &&
baab13
+        abrt-action-save-kernel-data
baab13
+
baab13
 
baab13
 # If you want behavior similar to one provided by kerneloops daemon
baab13
 # distributed by kerneloops.org - that is, if you want
baab13
-- 
baab13
1.8.3.1
baab13