Signed-off-by: Nikola Pajkovsky npajkovs@redhat.com --- examples/taint/.gitignore | 1 + examples/taint/Makefile | 8 ++++++++ examples/taint/taint.c | 21 +++++++++++++++++++++ 3 files changed, 30 insertions(+), 0 deletions(-) create mode 100644 examples/taint/.gitignore create mode 100644 examples/taint/Makefile create mode 100644 examples/taint/taint.c
diff --git a/examples/taint/.gitignore b/examples/taint/.gitignore new file mode 100644 index 0000000..2460008 --- /dev/null +++ b/examples/taint/.gitignore @@ -0,0 +1 @@ +!Makefile diff --git a/examples/taint/Makefile b/examples/taint/Makefile new file mode 100644 index 0000000..a76c46b --- /dev/null +++ b/examples/taint/Makefile @@ -0,0 +1,8 @@ +obj-m += taint.o + +all: + make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules + +clean: + make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean + diff --git a/examples/taint/taint.c b/examples/taint/taint.c new file mode 100644 index 0000000..be6f0a2 --- /dev/null +++ b/examples/taint/taint.c @@ -0,0 +1,21 @@ +/* + * hello-1.c - The simplest kernel module. + */ +#include <linux/module.h> /* Needed by all modules */ +#include <linux/kernel.h> /* Needed for KERN_INFO */ + +int init_module(void) +{ + printk(KERN_INFO "Hello world\n"); + /* + * A non 0 return means init_module failed; module can't be loaded. + */ + return 0; +} + +void cleanup_module(void) +{ + printk(KERN_INFO "Goodbye world\n"); +} + +MODULE_LICENSE("TAINT");
Signed-off-by: Nikola Pajkovsky npajkovs@redhat.com --- lib/Plugins/Bugzilla.cpp | 28 ++++++++++++++++++++++++++++ 1 files changed, 28 insertions(+), 0 deletions(-)
diff --git a/lib/Plugins/Bugzilla.cpp b/lib/Plugins/Bugzilla.cpp index f3967cd..4b1d173 100644 --- a/lib/Plugins/Bugzilla.cpp +++ b/lib/Plugins/Bugzilla.cpp @@ -650,6 +650,34 @@ std::string CReporterBugzilla::Report(const map_crash_data_t& pCrashData, const map_plugin_settings_t& pSettings, const char *pArgs) { + const char *analyzer = get_crash_data_item_content_or_NULL(pCrashData, FILENAME_ANALYZER); + + /* hardcoded check for tainted kernel for kerneloops + * reported by bugzilla plugin */ + if (analyzer && strcmp(analyzer, "Kerneloops") == 0) + { + char taint = -1; + /* once tainted flag is set to 1, only restart can reset the flag to 0 */ + int taint_fd = open("/proc/sys/kernel/tainted", O_RDONLY); + if (taint_fd > 0) + { + /* contain only 0 or 1 */ + read(taint_fd, &taint, 1); + close(taint_fd); + if (taint == '1') + { + char* err_str = xasprintf("Kernel is TAINTED, kernelopps won't be reported"); + CABRTException e(EXCEP_PLUGIN, err_str); + free(err_str); + throw e; + } + + } + else + error_msg("/proc/sys/kernel/tainted does not exist"); + } + + xmlrpc_int32 bug_id = -1; std::string Login; std::string Password;
crash-catcher@lists.fedorahosted.org