[abrt/f16] don't file bugs when kernel is tainted

Nikola Pajkovsky npajkovs at fedoraproject.org
Fri Oct 7 11:56:36 UTC 2011


commit 384effe0dfffce1e9bdaa9e062db154b6aef3089
Author: Nikola Pajkovsky <npajkovs at redhat.com>
Date:   Fri Oct 7 13:56:35 2011 +0200

    don't file bugs when kernel is tainted
    
    Signed-off-by: Nikola Pajkovsky <npajkovs at redhat.com>

 ...-don-t-file-kernel-bugs-if-tainted-B-is-s.patch |  192 ++++++++++++++++++++
 ...bz-718097-don-t-file-bugs-about-BIOS-bugs.patch |   35 ++++
 abrt.spec                                          |   12 +-
 3 files changed, 238 insertions(+), 1 deletions(-)
---
diff --git a/0001-rhbz-724838-don-t-file-kernel-bugs-if-tainted-B-is-s.patch b/0001-rhbz-724838-don-t-file-kernel-bugs-if-tainted-B-is-s.patch
new file mode 100644
index 0000000..e4198ef
--- /dev/null
+++ b/0001-rhbz-724838-don-t-file-kernel-bugs-if-tainted-B-is-s.patch
@@ -0,0 +1,192 @@
+From 82b27dca87ef5a4f1cbb29377524bbdee26b1d64 Mon Sep 17 00:00:00 2001
+Message-Id: <82b27dca87ef5a4f1cbb29377524bbdee26b1d64.1317979766.git.npajkovs at redhat.com>
+From: Nikola Pajkovsky <npajkovs at redhat.com>
+Date: Wed, 5 Oct 2011 15:13:23 +0200
+Subject: [PATCH 1/2] rhbz#724838 - don't file kernel bugs if "tainted: B" is
+ set
+
+Kernel maintainers are not much happy that we filling bugs when kernel
+is tainted.
+
+Dave Jones said
+---
+If something has corrupted memory, we typically see a whole bunch of things
+start crashing. This leads to situations where abrt files a lot of bugs, even
+though most of them are just fallout from the first.
+
+an example: bugs 710925 710930 710932 710933 710935 710942 710948 710955 710956
+are all the same crash. The traces and addresses are different, but 'something
+scribbled over memory' is the root cause here. Sadly out of all those bugs, we
+actually somehow missed the first crash which is the most relevant one. (That
+one would have not had the 'Tainted: G B' text)
+---
+
+First part of the patch is that we won't relay on /proc/sys/kernel/tainted and
+we will parse the kernel bt manually, because of reading that file after an oops
+is ALWAYS going to show it as tainted.
+
+Second part of the patch is that whenever you want to prohibit reporting, put a
+file with name *not-reportable* into <dump-dir>. That file could be empty or with
+reasonable message why are you trying to prohibit reporting.
+
+All 3 reporters plugins will be respect that file and it won't try to report anything.
+Reporters will show only the messages from *not-reportable* and *reason*.
+
+Signed-off-by: Nikola Pajkovsky <npajkovs at redhat.com>
+---
+ src/gui-gtk/main.c           |   16 ++++++++--
+ src/plugins/abrt-dump-oops.c |   65 +++++++++++++++++++++++------------------
+ 2 files changed, 49 insertions(+), 32 deletions(-)
+
+diff --git a/src/gui-gtk/main.c b/src/gui-gtk/main.c
+index 8172951..d11bf57 100644
+--- a/src/gui-gtk/main.c
++++ b/src/gui-gtk/main.c
+@@ -100,7 +100,14 @@ static void add_directory_to_dirlist(const char *dirname)
+     }
+     free(time_str);
+ 
+-    char *reason = dd_load_text(dd, FILENAME_REASON);
++
++    char *not_reportable_reason = dd_load_text_ext(dd, FILENAME_NOT_REPORTABLE, 0
++                                                   | DD_LOAD_TEXT_RETURN_NULL_ON_FAILURE
++                                                   | DD_FAIL_QUIETLY_ENOENT
++                                                   | DD_FAIL_QUIETLY_EACCES);
++    char *reason = NULL;
++    if (!not_reportable_reason)
++        reason = dd_load_text(dd, FILENAME_REASON);
+ 
+     /* the source of the problem:
+      * - first we try to load component, as we use it on Fedora
+@@ -142,7 +149,7 @@ static void add_directory_to_dirlist(const char *dirname)
+     gtk_list_store_append(list_store, &iter);
+     gtk_list_store_set(list_store, &iter,
+                           COLUMN_SOURCE, source,
+-                          COLUMN_REASON, reason,
++                          COLUMN_REASON, not_reportable_reason? :reason,
+                           //OPTION: time format
+                           COLUMN_LATEST_CRASH_STR, time_buf,
+                           COLUMN_LATEST_CRASH, t,
+@@ -150,6 +157,7 @@ static void add_directory_to_dirlist(const char *dirname)
+                           COLUMN_REPORTED_TO, msg ? subm_status : NULL,
+                           -1);
+     /* this is safe, subm_status is either null or malloced string from get_last_line */
++    free(not_reportable_reason);
+     free(subm_status);
+     free(msg);
+     free(reason);
+@@ -243,7 +251,9 @@ static void on_row_activated_cb(GtkTreeView *treeview, GtkTreePath *path, GtkTre
+             gtk_tree_model_get_value(store, &iter, COLUMN_DUMP_DIR, &d_dir);
+ 
+             const char *dirname = g_value_get_string(&d_dir);
+-            report_problem_in_dir(dirname, LIBREPORT_ANALYZE | LIBREPORT_NOWAIT | LIBREPORT_GETPID);
++
++            report_problem_in_dir(dirname,
++                                  LIBREPORT_ANALYZE | LIBREPORT_NOWAIT | LIBREPORT_GETPID);
+         }
+     }
+ }
+diff --git a/src/plugins/abrt-dump-oops.c b/src/plugins/abrt-dump-oops.c
+index 76c699d..58af506 100644
+--- a/src/plugins/abrt-dump-oops.c
++++ b/src/plugins/abrt-dump-oops.c
+@@ -480,16 +480,6 @@ static unsigned save_oops_to_dump_dir(GList *oops_list, unsigned oops_cnt)
+ 
+     VERB1 log("Saving %u oopses as dump dirs", idx >= countdown ? countdown-1 : idx);
+ 
+-    char *tainted_str = NULL;
+-    FILE *tainted_fp = fopen("/proc/sys/kernel/tainted", "r");
+-    if (tainted_fp)
+-    {
+-        tainted_str = xmalloc_fgetline(tainted_fp);
+-        fclose(tainted_fp);
+-    }
+-    else
+-        perror_msg("Can't open '%s'", "/proc/sys/kernel/tainted");
+-
+     char *cmdline_str = NULL;
+     FILE *cmdline_fp = fopen("/proc/cmdline", "r");
+     if (cmdline_fp)
+@@ -536,35 +526,44 @@ static unsigned save_oops_to_dump_dir(GList *oops_list, unsigned oops_cnt)
+             if (cmdline_str)
+                 dd_save_text(dd, FILENAME_CMDLINE, cmdline_str);
+             dd_save_text(dd, FILENAME_BACKTRACE, second_line);
+-// TODO: add "Kernel oops: " prefix, so that all oopses have recognizable FILENAME_REASON?
+-// kernel oops 1st line may look quite puzzling otherwise...
+-            strchrnul(second_line, '\n')[0] = '\0';
+-            dd_save_text(dd, FILENAME_REASON, second_line);
+ 
+-            if (tainted_str && tainted_str[0] != '0')
++            char *tainted_short = kernel_tainted_short(second_line);
++            if (tainted_short)
+             {
+-                unsigned long tainted = xatoi_positive(tainted_str);
+-                char *tainted_short = kernel_tainted_short(tainted);
+-                GList *tainted_long = kernel_tainted_long(tainted);
+-
+-                struct strbuf *tnt_long = strbuf_new();
+-                for (GList *li = tainted_long; li; li = li->next)
+-                    strbuf_append_strf(tnt_long, "%s\n", (char*) li->data);
+-
+-                dd_save_text(dd, FILENAME_TAINTED, tainted_str);
++                VERB1 log("Kernel is tainted '%s'", tainted_short);
+                 dd_save_text(dd, FILENAME_TAINTED_SHORT, tainted_short);
+-                dd_save_text(dd, FILENAME_TAINTED_LONG, tnt_long->buf);
+-                strbuf_free(tnt_long);
+-                list_free_with_free(tainted_long);
++                char *reason = xasprintf("Your kernel is tainted by flags '%s'. "
++                                         "Kernel maintainers are not interesting about "
++                                         "tainted kernel, because the trace might not be showing "
++                                         "the root problem."
++                                         , tainted_short);
++                dd_save_text(dd, FILENAME_NOT_REPORTABLE, reason);
++                free(reason);
+             }
++// TODO: add "Kernel oops: " prefix, so that all oopses have recognizable FILENAME_REASON?
++// kernel oops 1st line may look quite puzzling otherwise...
++            strchrnul(second_line, '\n')[0] = '\0';
++            dd_save_text(dd, FILENAME_REASON, second_line);
+ 
++/*
++            GList *tainted_long = kernel_tainted_long(tainted);
++
++            struct strbuf *tnt_long = strbuf_new();
++            for (GList *li = tainted_long; li; li = li->next)
++                strbuf_append_strf(tnt_long, "%s\n", (char*) li->data);
++
++            dd_save_text(dd, FILENAME_TAINTED, tainted_str);
++            dd_save_text(dd, FILENAME_TAINTED_SHORT, tainted_short);
++            dd_save_text(dd, FILENAME_TAINTED_LONG, tnt_long->buf);
++            strbuf_free(tnt_long);
++            list_free_with_free(tainted_long);
++*/
+             dd_close(dd);
+         }
+         else
+             errors++;
+     }
+ 
+-    free(tainted_str);
+     free(cmdline_str);
+ 
+     return errors;
+@@ -718,7 +717,15 @@ int main(int argc, char **argv)
+             {
+                 int i = 0;
+                 while (i < oops_cnt)
+-                    printf("\nVersion: %s", (char*)g_list_nth_data(oops_list, i++));
++                {
++                    char *kernel_bt = (char*)g_list_nth_data(oops_list, i++);
++                    char *tainted_short = kernel_tainted_short(kernel_bt);
++                    if (tainted_short)
++                        log("Kernel is tainted '%s'", tainted_short);
++
++                    free(tainted_short);
++                    printf("\nVersion: %s", kernel_bt);
++                }
+             }
+             if ((opts & OPT_d) || (opts & OPT_D))
+             {
+-- 
+1.7.7.rc0.70.g82660
+
diff --git a/0002-rhbz-718097-don-t-file-bugs-about-BIOS-bugs.patch b/0002-rhbz-718097-don-t-file-bugs-about-BIOS-bugs.patch
new file mode 100644
index 0000000..ae62890
--- /dev/null
+++ b/0002-rhbz-718097-don-t-file-bugs-about-BIOS-bugs.patch
@@ -0,0 +1,35 @@
+From e965fb7a7c768889cdd4a59859d28dc83b3daf09 Mon Sep 17 00:00:00 2001
+Message-Id: <e965fb7a7c768889cdd4a59859d28dc83b3daf09.1317979766.git.npajkovs at redhat.com>
+In-Reply-To: <82b27dca87ef5a4f1cbb29377524bbdee26b1d64.1317979766.git.npajkovs at redhat.com>
+References: <82b27dca87ef5a4f1cbb29377524bbdee26b1d64.1317979766.git.npajkovs at redhat.com>
+From: Nikola Pajkovsky <npajkovs at redhat.com>
+Date: Wed, 5 Oct 2011 17:23:22 +0200
+Subject: [PATCH 2/2] rhbz#718097 - don't file bugs about BIOS bugs
+
+Signed-off-by: Nikola Pajkovsky <npajkovs at redhat.com>
+---
+ src/plugins/abrt-dump-oops.c |    7 ++++++-
+ 1 files changed, 6 insertions(+), 1 deletions(-)
+
+diff --git a/src/plugins/abrt-dump-oops.c b/src/plugins/abrt-dump-oops.c
+index 58af506..3bfc617 100644
+--- a/src/plugins/abrt-dump-oops.c
++++ b/src/plugins/abrt-dump-oops.c
+@@ -527,8 +527,13 @@ static unsigned save_oops_to_dump_dir(GList *oops_list, unsigned oops_cnt)
+                 dd_save_text(dd, FILENAME_CMDLINE, cmdline_str);
+             dd_save_text(dd, FILENAME_BACKTRACE, second_line);
+ 
++            /* check if trace doesn't have line: 'Your BIOS is broken' */
++            char *broken_bios = strstr(second_line, "Your BIOS is broken");
++            if (broken_bios)
++                dd_save_text(dd, FILENAME_NOT_REPORTABLE, "Your BIOS is broken");
++
+             char *tainted_short = kernel_tainted_short(second_line);
+-            if (tainted_short)
++            if (tainted_short && !broken_bios)
+             {
+                 VERB1 log("Kernel is tainted '%s'", tainted_short);
+                 dd_save_text(dd, FILENAME_TAINTED_SHORT, tainted_short);
+-- 
+1.7.7.rc0.70.g82660
+
diff --git a/abrt.spec b/abrt.spec
index 1145628..34345d6 100644
--- a/abrt.spec
+++ b/abrt.spec
@@ -16,7 +16,7 @@
 Summary: Automatic bug detection and reporting tool
 Name: abrt
 Version: 2.0.4.981
-Release: 2%{?dist}
+Release: 3%{?dist}
 License: GPLv2+
 Group: Applications/System
 URL: https://fedorahosted.org/abrt/
@@ -27,6 +27,8 @@ Source3: abrt-oops.init
 Source4: abrt-vmcore.init
 Source5: abrt1_to_abrt2
 Patch0: blacklist.patch
+Patch1: 0001-rhbz-724838-don-t-file-kernel-bugs-if-tainted-B-is-s.patch
+Patch2: 0002-rhbz-718097-don-t-file-bugs-about-BIOS-bugs.patch
 BuildRequires: dbus-devel
 BuildRequires: gtk2-devel
 BuildRequires: rpm-devel >= 4.6
@@ -194,6 +196,8 @@ Virtual package to make easy default installation on desktop environments.
 # Fedora specific
 %patch0 -p1 -b .blacklist
 # general fixes
+%patch1 -p1
+%patch2 -p1
 
 %build
 autoconf
@@ -556,6 +560,12 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
 %defattr(-,root,root,-)
 
 %changelog
+* Fri Oct 07 2011 Nikola Pajkovsky <npajkovs at redhat.com> - 2.0.4.981-3
+- don't file kernel bugs if "tainted: B" is set.
+- don't file bugs about BIOS bugs.
+- incorrect TAINTED description in bugs.
+- Resoves: #718097 #708534 724838
+
 * Mon Oct 3  2011 Jiri Moskovcak <jmoskovc at redhat.com> - 2.0.4-981-2
 - added abrt-retrace-client as a dependency
 


More information about the scm-commits mailing list