Blob Blame History Raw
From 31e54ec8ea43d246e745a3a58fc5f07bfce4dfa0 Mon Sep 17 00:00:00 2001
From: Jakub Filak <jfilak@redhat.com>
Date: Mon, 18 May 2015 08:43:29 +0200
Subject: [PATCH] koops: don't save dmesg if kernel.dmesg_restrict=1

Also don't run abrt-action-check-oops-for-hw-error if the file dmesg
does not exist as the program searches MCE related strings there.

Related: rhbz#1128400
Requires: rhbz#1227661

Signed-off-by: Jakub Filak <jfilak@redhat.com>
---
 src/plugins/koops_event.conf | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/src/plugins/koops_event.conf b/src/plugins/koops_event.conf
index eea1055..0e413a8 100644
--- a/src/plugins/koops_event.conf
+++ b/src/plugins/koops_event.conf
@@ -1,13 +1,12 @@
 # Analyze
 EVENT=post-create analyzer=Kerneloops
-        # >> instead of > is due to bugzilla.redhat.com/show_bug.cgi?id=854266
-        # 'dmesg' file is required by check-oops-for-hw-error
-        dmesg >>dmesg
-        # Do not fail the event (->do not delete problem dir)
-        # if check-oops-for-hw-error exits nonzero:
-        {
-        abrt-action-check-oops-for-hw-error || true
-        } &&
+        # Honor dmesg_restrict -> bugzilla.redhat.com/1128400
+        if [ "$(cat /proc/sys/kernel/dmesg_restrict)" == "0" ]; then
+            # >> instead of > is due to bugzilla.redhat.com/854266
+            # 'dmesg' file is required by check-oops-for-hw-error
+            dmesg >>dmesg
+            abrt-action-check-oops-for-hw-error
+        fi
         {
         # run abrt-action-analyze-oops only if check-hw-error didn't create the
         # required files
-- 
2.1.0