On Fri, 2010-11-19 at 12:32 +0100, Nikola Pajkovsky wrote:
Save tainted flag from /proc/sys/kernel/tainted. When flag is set to
1
TAINED string is added to bugzilla summary.
...
--- a/src/plugins/KerneloopsScanner.cpp
+++ b/src/plugins/KerneloopsScanner.cpp
@@ -121,6 +121,20 @@ int save_oops_to_debug_dump(GList **oopsList)
VERB1 log("Saving %u oopses as crash dump dirs", idx >= countdown ?
countdown-1 : idx);
+ char tainted[1] = {'x'};
+ /* 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)
+ {
+ /* 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);
+ }
+ else
+ error_msg("/proc/sys/kernel/tainted does not exist");
+
int errors = 0;
while (idx != 0 && --countdown != 0)
@@ -143,6 +157,10 @@ int save_oops_to_debug_dump(GList **oopsList)
/* Optional, makes generated bz more informative */
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);
This will try to save a string which is kept in tainted[] array.
But tainted[] is one char long. It has no place for terminating NUL,
since we know for sure that 0th byte is '1'.
dd_save_text() will access the stack past the end of tainted[]
in search for NUL char and will write "1<garbage>" to FILENAME_TAINTED.
--
vda