module,bug: Add TAINT_OOT_MODULE flag for modules that weren't built in-tree

Also decode this new flag in the bug script.

svn path=/dists/trunk/linux-2.6/; revision=16914
This commit is contained in:
Ben Hutchings 2011-02-19 02:38:21 +00:00
parent f849dfc060
commit 99be663773
4 changed files with 104 additions and 0 deletions

2
debian/changelog vendored
View File

@ -7,6 +7,8 @@ linux-2.6 (2.6.38~rc5-1~experimental.1) UNRELEASED; urgency=low
does not support (Closes: #609371)
- [sh4] Export cpu_core_map to fix build failure with CONFIG_SFC=m.
- [armel] Support for Buffalo LS-CHL (Closes: #590105).
* module,bug: Add TAINT_OOT_MODULE flag for modules that weren't built
in-tree
[ maximilian attems ]
* [x86] linux-images suggest extlinux, s/grub/grub-pc/. (closes: #613909)

View File

@ -0,0 +1,99 @@
From 129d27b59502c85e9427f2c5299083818f77bad2 Mon Sep 17 00:00:00 2001
From: Ben Hutchings <ben@decadent.org.uk>
Date: Sun, 9 Jan 2011 06:41:52 +0000
Subject: [PATCH] module,bug: Add TAINT_OOT_MODULE flag for modules that weren't built in-tree
This makes it easier to spot out-of-tree modules. We have enough
bugs of our own to deal with, before supporting these.
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
include/linux/kernel.h | 1 +
kernel/module.c | 5 +++++
kernel/panic.c | 2 ++
scripts/mod/modpost.c | 7 +++++++
4 files changed, 15 insertions(+), 0 deletions(-)
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index b6de9a6..7d41307 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -250,6 +250,7 @@ extern enum system_states {
#define TAINT_WARN 9
#define TAINT_CRAP 10
#define TAINT_FIRMWARE_WORKAROUND 11
+#define TAINT_OOT_MODULE 12
extern const char hex_asc[];
#define hex_asc_lo(x) hex_asc[((x) & 0x0f)]
diff --git a/kernel/module.c b/kernel/module.c
index d190664..0549df3 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -2260,6 +2260,9 @@ static int check_modinfo(struct module *mod, struct load_info *info)
return -ENOEXEC;
}
+ if (!get_modinfo(info, "intree"))
+ add_taint_module(mod, TAINT_OOT_MODULE);
+
if (get_modinfo(info, "staging")) {
add_taint_module(mod, TAINT_CRAP);
printk(KERN_WARNING "%s: module is from the staging directory,"
@@ -3001,6 +3004,8 @@ static char *module_flags(struct module *mod, char *buf)
buf[bx++] = '(';
if (mod->taints & (1 << TAINT_PROPRIETARY_MODULE))
buf[bx++] = 'P';
+ else if (mod->taints & (1 << TAINT_OOT_MODULE))
+ buf[bx++] = 'O';
if (mod->taints & (1 << TAINT_FORCED_MODULE))
buf[bx++] = 'F';
if (mod->taints & (1 << TAINT_CRAP))
diff --git a/kernel/panic.c b/kernel/panic.c
index 4c13b1a..9385d25 100644
--- a/kernel/panic.c
+++ b/kernel/panic.c
@@ -174,6 +174,7 @@ static const struct tnt tnts[] = {
{ TAINT_WARN, 'W', ' ' },
{ TAINT_CRAP, 'C', ' ' },
{ TAINT_FIRMWARE_WORKAROUND, 'I', ' ' },
+ { TAINT_OOT_MODULE, 'O', ' ' },
};
/**
@@ -191,6 +192,7 @@ static const struct tnt tnts[] = {
* 'W' - Taint on warning.
* 'C' - modules from drivers/staging are loaded.
* 'I' - Working around severe firmware bug.
+ * 'O' - Out-of-tree module has been loaded.
*
* The string is overwritten by the next call to print_tainted().
*/
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 33122ca..d0cb92c 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -1818,6 +1818,12 @@ static void add_header(struct buffer *b, struct module *mod)
buf_printf(b, "};\n");
}
+static void add_intree_flag(struct buffer *b, int is_intree)
+{
+ if (is_intree)
+ buf_printf(b, "\nMODULE_INFO(intree, \"Y\");\n");
+}
+
static void add_staging_flag(struct buffer *b, const char *name)
{
static const char *staging_dir = "drivers/staging";
@@ -2138,6 +2144,7 @@ int main(int argc, char **argv)
buf.pos = 0;
add_header(&buf, mod);
+ add_intree_flag(&buf, !external_module);
add_staging_flag(&buf, mod->name);
err |= add_versions(&buf, mod);
add_depends(&buf, mod, modules);
--
1.7.4.1

View File

@ -25,6 +25,7 @@
+ features/all/i915-autoload-without-CONFIG_DRM_I915_KMS.patch
+ debian/sysrq-mask.patch
+ debian/module-bug-Add-TAINT_OOT_MODULE-flag.patch
+ debian/arch-sh4-fix-uimage-build.patch

View File

@ -10,6 +10,7 @@ TAINT_OVERRIDDEN_ACPI_TABLE=8
TAINT_WARN=9
TAINT_CRAP=10
TAINT_FIRMWARE_WORKAROUND=11
TAINT_OOT_MODULE=12
_check() {
if [ $(($tainted & 1<<$1)) -ne 0 ]; then
@ -34,6 +35,7 @@ add_1tainted() {
_check $TAINT_WARN 'W' 'Taint on warning.'
_check $TAINT_CRAP 'C' 'Module from drivers/staging has been loaded.'
_check $TAINT_FIRMWARE_WORKAROUND 'I' 'Working around severe firmware bug.'
_check $TAINT_OOT_MODULE 'O' 'Out-of-tree module has been loaded.'
echo "** Tainted: $result_short ($tainted)" >&3
printf "$result_long" >&3
else