summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNikola Pajkovsky <npajkovs@redhat.com>2010-11-24 15:26:35 +0100
committerNikola Pajkovsky <npajkovs@redhat.com>2010-11-25 10:48:00 +0100
commitdcbb7fbe48c77998857e4ccd70d2fb29f41974f0 (patch)
tree48804b950203d0c0ba1d382a779d146a9cc0b24e
parent800d2cbb1d75c91bd45b162676ac9220a24588e2 (diff)
downloadabrt-dcbb7fbe48c77998857e4ccd70d2fb29f41974f0.tar.gz
abrt-dcbb7fbe48c77998857e4ccd70d2fb29f41974f0.tar.xz
abrt-dcbb7fbe48c77998857e4ccd70d2fb29f41974f0.zip
taint flag is decimal representation of a bitmask
Signed-off-by: Nikola Pajkovsky <npajkovs@redhat.com>
-rw-r--r--src/plugins/KerneloopsScanner.cpp18
-rw-r--r--src/plugins/abrt-action-bugzilla.cpp72
2 files changed, 76 insertions, 14 deletions
diff --git a/src/plugins/KerneloopsScanner.cpp b/src/plugins/KerneloopsScanner.cpp
index 39437969..93f37e07 100644
--- a/src/plugins/KerneloopsScanner.cpp
+++ b/src/plugins/KerneloopsScanner.cpp
@@ -121,16 +121,13 @@ int save_oops_to_debug_dump(GList **oopsList)
VERB1 log("Saving %u oopses as crash dump dirs", idx >= countdown ? countdown-1 : idx);
- char tainted[2] = {'x', '\0'};
+ char *tainted_str = NULL;
/* once tainted flag is set to 1, only restart can reset the flag to 0 */
- int tainted_fd = open("/proc/sys/kernel/tainted", O_RDONLY);
- if (tainted_fd >= 0)
+ FILE *tainted_fd = fopen("/proc/sys/kernel/tainted", "r");
+ if (tainted_fd)
{
- /* contain only 0 or 1 */
- if (read(tainted_fd, &tainted, 1) != 1)
- error_msg("Unable to read one byte from /proc/sys/kernel/tainted");
-
- close(tainted_fd);
+ tainted_str = xmalloc_fgetline(tainted_fd);
+ fclose(tainted_fd);
}
else
error_msg("/proc/sys/kernel/tainted does not exist");
@@ -158,9 +155,10 @@ int save_oops_to_debug_dump(GList **oopsList)
strchrnul(second_line, '\n')[0] = '\0';
dd_save_text(dd, FILENAME_REASON, second_line);
- if (tainted[0] == '1')
- dd_save_text(dd, FILENAME_TAINTED, tainted);
+ if (tainted_str && tainted_str[0] != '0')
+ dd_save_text(dd, FILENAME_TAINTED, tainted_str);
+ free(tainted_str);
dd_close(dd);
}
else
diff --git a/src/plugins/abrt-action-bugzilla.cpp b/src/plugins/abrt-action-bugzilla.cpp
index 073d5340..62d3bd63 100644
--- a/src/plugins/abrt-action-bugzilla.cpp
+++ b/src/plugins/abrt-action-bugzilla.cpp
@@ -382,6 +382,68 @@ int ctx::add_comment(xmlrpc_int32 bug_id, const char* comment, bool is_private)
return result ? 0 : -1;
}
+/* From RHEL6 kernel/panic.c:
+ * { TAINT_PROPRIETARY_MODULE, 'P', 'G' },
+ * { TAINT_FORCED_MODULE, 'F', ' ' },
+ * { TAINT_UNSAFE_SMP, 'S', ' ' },
+ * { TAINT_FORCED_RMMOD, 'R', ' ' },
+ * { TAINT_MACHINE_CHECK, 'M', ' ' },
+ * { TAINT_BAD_PAGE, 'B', ' ' },
+ * { TAINT_USER, 'U', ' ' },
+ * { TAINT_DIE, 'D', ' ' },
+ * { TAINT_OVERRIDDEN_ACPI_TABLE, 'A', ' ' },
+ * { TAINT_WARN, 'W', ' ' },
+ * { TAINT_CRAP, 'C', ' ' },
+ * { TAINT_FIRMWARE_WORKAROUND, 'I', ' ' },
+ * entries 12 - 27 are unused
+ * { TAINT_HARDWARE_UNSUPPORTED, 'H', ' ' },
+ * entries 29 - 31 are unused
+ */
+
+static const char * const taint_warnings[] = {
+ "Proprietary Module",
+ "Forced Module",
+ "Unsafe SMP",
+ "Forced rmmod",
+ "Machine Check",
+ "Bad Page",
+ "User",
+ "Die",
+ "Overriden ACPI Table",
+ "Warning Issued",
+ "Experimental Module Loaded",
+ "Firmware Workaround",
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ "Hardware Unsupported",
+ NULL,
+ NULL,
+};
+
+static const char *tainted_string(unsigned tainted)
+{
+ unsigned idx = 0;
+ while ((tainted >>= 1) != 0)
+ idx++;
+
+ return taint_warnings[idx];
+}
+
xmlrpc_int32 ctx::new_bug(const map_crash_data_t& pCrashData, int depend_on_bugno)
{
const char *package = get_crash_data_item_content_or_NULL(pCrashData, FILENAME_PACKAGE);
@@ -392,7 +454,7 @@ xmlrpc_int32 ctx::new_bug(const map_crash_data_t& pCrashData, int depend_on_bugn
const char *reason = get_crash_data_item_content_or_NULL(pCrashData, FILENAME_REASON);
const char *function = get_crash_data_item_content_or_NULL(pCrashData, FILENAME_CRASH_FUNCTION);
const char *analyzer = get_crash_data_item_content_or_NULL(pCrashData, FILENAME_ANALYZER);
- const char *tainted = get_crash_data_item_content_or_NULL(pCrashData, FILENAME_TAINTED);
+ const char *tainted_str = get_crash_data_item_content_or_NULL(pCrashData, FILENAME_TAINTED);
struct strbuf *buf_summary = strbuf_new();
strbuf_append_strf(buf_summary, "[abrt] %s", package);
@@ -403,11 +465,13 @@ xmlrpc_int32 ctx::new_bug(const map_crash_data_t& pCrashData, int depend_on_bugn
if (reason != NULL)
strbuf_append_strf(buf_summary, ": %s", reason);
- if (tainted && analyzer
- && (tainted[0] == '1')
+ if (tainted_str && analyzer
&& (strcmp(analyzer, "Kerneloops") == 0)
) {
- strbuf_append_str(buf_summary, ": TAINTED");
+ unsigned long tainted = xatoi_u(tainted_str);
+ const char *tainted_warning = tainted_string(tainted);
+ if (tainted_warning)
+ strbuf_append_strf(buf_summary, ": TAINTED %s", tainted_warning);
}
char *status_whiteboard = xasprintf("abrt_hash:%s", duphash);