100 lines
3.2 KiB
Diff
100 lines
3.2 KiB
Diff
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
|
|
|