diff options
author | Nikola Pajkovsky <npajkovs@redhat.com> | 2011-05-16 14:02:10 +0200 |
---|---|---|
committer | Nikola Pajkovsky <npajkovs@redhat.com> | 2011-05-19 09:59:52 +0200 |
commit | 1edb8cb72e7fe7912b94c12d35ea0d5a1a4bb86c (patch) | |
tree | e810c600c6361f98051450d401b882f595e00323 /src/lib | |
parent | bff5a712e09174b055fa1ed57ffbc4f08629cb25 (diff) | |
download | abrt-1edb8cb72e7fe7912b94c12d35ea0d5a1a4bb86c.tar.gz abrt-1edb8cb72e7fe7912b94c12d35ea0d5a1a4bb86c.tar.xz abrt-1edb8cb72e7fe7912b94c12d35ea0d5a1a4bb86c.zip |
reenable kernel taint
abrt-dump-oops stores two new files into dump dir. kernel_tainted_short which is
representation of kernel tainted value (P----T). kernel_tainted_long contains human
readable strings of short version
Signed-off-by: Nikola Pajkovsky <npajkovs@redhat.com>
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/Makefile.am | 1 | ||||
-rw-r--r-- | src/lib/kernel-tainted.c | 143 | ||||
-rw-r--r-- | src/lib/make_descr.c | 1 |
3 files changed, 145 insertions, 0 deletions
diff --git a/src/lib/Makefile.am b/src/lib/Makefile.am index 14220c99..86210d4e 100644 --- a/src/lib/Makefile.am +++ b/src/lib/Makefile.am @@ -11,6 +11,7 @@ lib_LTLIBRARIES = \ # xconnect.cpp libreport_la_SOURCES = \ + kernel-tainted.c \ xfuncs.c \ is_in_string_list.c \ encbase64.c \ diff --git a/src/lib/kernel-tainted.c b/src/lib/kernel-tainted.c new file mode 100644 index 00000000..115e44e0 --- /dev/null +++ b/src/lib/kernel-tainted.c @@ -0,0 +1,143 @@ +/* + Copyright (C) 2011 ABRT team + Copyright (C) 2011 RedHat Inc + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +*/ + +#include "abrtlib.h" + +/* From RHEL6 kernel/panic.c: */ +static const int tnts_short[] = { + 'P' , + 'F' , + 'S' , + 'R' , + 'M' , + 'B' , + 'U' , + 'D' , + 'A' , + 'W' , + 'C' , + 'I' , + '-' , + '-' , + '-' , + '-' , + '-' , + '-' , + '-' , + '-' , + '-' , + '-' , + '-' , + '-' , + '-' , + '-' , + '-' , + '-' , + 'H' , + 'T' , +}; + +/** + * print_tainted - return a string to represent the kernel taint state. + * + * 'P' - Proprietary module has been loaded. + * 'F' - Module has been forcibly loaded. + * 'S' - SMP with CPUs not designed for SMP. + * 'R' - User forced a module unload. + * 'M' - System experienced a machine check exception. + * 'B' - System has hit bad_page. + * 'U' - Userspace-defined naughtiness. + * 'D' - Kernel has oopsed before + * 'A' - ACPI table overridden. + * 'W' - Taint on warning. + * 'C' - modules from drivers/staging are loaded. + * 'I' - Working around severe firmware bug. + * 'H' - Hardware is unsupported. + * T - Tech_preview + */ + + +static const char *const tnts_long[] = { + "Proprietary module has been loaded.", + "Module has been forcibly loaded.", + "SMP with CPUs not designed for SMP.", + "User forced a module unload.", + "System experienced a machine check exception.", + "System has hit bad_page.", + "Userspace-defined naughtiness.", + "Kernel has oopsed before.", + "ACPI table overridden.", + "Taint on warning.", + "Modules from drivers/staging are loaded.", + "Working around severe firmware bug.", + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + "Hardware is unsupported.", + "Tech_preview", +}; + +char *kernel_tainted_short(unsigned tainted) +{ + char *tnt = xzalloc(ARRAY_SIZE(tnts_short) + 1); + int i = 0; + while (tainted) + { + if (0x1 & tainted) + tnt[i] = tnts_short[i]; + else + tnt[i] = '-'; + + ++i; + tainted >>= 1; + } + + return tnt; +} + +GList *kernel_tainted_long(unsigned tainted) +{ + int i = 0; + GList *tnt = NULL; + + while (tainted) + { + if (0x1 & tainted && tnts_long[i]) + tnt = g_list_append(tnt, xstrdup(tnts_long[i])); + + ++i; + tainted >>= 1; + } + + return tnt; +} diff --git a/src/lib/make_descr.c b/src/lib/make_descr.c index fe629d2b..036d7770 100644 --- a/src/lib/make_descr.c +++ b/src/lib/make_descr.c @@ -237,6 +237,7 @@ static const char *const blacklisted_items[] = { FILENAME_DUPHASH , FILENAME_UUID , FILENAME_COUNT , + FILENAME_TAINTED_SHORT, NULL }; |