diff options
author | Ben Hutchings <ben@decadent.org.uk> | 2011-10-24 09:12:28 -0400 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2011-11-06 16:24:42 -0500 |
commit | 2449b8ba0745327c5fa49a8d9acffe03b2eded69 (patch) | |
tree | 48e11288635dcfc8cdb342f3ba00fa2a2a650aa8 | |
parent | 1cd0d6c3021c8d76641b37203f504634b87fbabc (diff) |
module,bug: Add TAINT_OOT_MODULE flag for modules not built in-tree
Use of the GPL or a compatible licence doesn't necessarily make the code
any good. We already consider staging modules to be suspect, and this
should also be true for out-of-tree modules which may receive very
little review.
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Reviewed-by: Dave Jones <davej@redhat.com>
Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (patched oops-tracing.txt)
-rw-r--r-- | Documentation/oops-tracing.txt | 2 | ||||
-rw-r--r-- | include/linux/kernel.h | 1 | ||||
-rw-r--r-- | kernel/module.c | 5 | ||||
-rw-r--r-- | kernel/panic.c | 2 | ||||
-rw-r--r-- | scripts/mod/modpost.c | 7 |
5 files changed, 17 insertions, 0 deletions
diff --git a/Documentation/oops-tracing.txt b/Documentation/oops-tracing.txt index 6fe9001b9263..13032c0140d4 100644 --- a/Documentation/oops-tracing.txt +++ b/Documentation/oops-tracing.txt | |||
@@ -263,6 +263,8 @@ characters, each representing a particular tainted value. | |||
263 | 12: 'I' if the kernel is working around a severe bug in the platform | 263 | 12: 'I' if the kernel is working around a severe bug in the platform |
264 | firmware (BIOS or similar). | 264 | firmware (BIOS or similar). |
265 | 265 | ||
266 | 13: 'O' if an externally-built ("out-of-tree") module has been loaded. | ||
267 | |||
266 | The primary reason for the 'Tainted: ' string is to tell kernel | 268 | The primary reason for the 'Tainted: ' string is to tell kernel |
267 | debuggers if this is a clean kernel or if anything unusual has | 269 | debuggers if this is a clean kernel or if anything unusual has |
268 | occurred. Tainting is permanent: even if an offending module is | 270 | occurred. Tainting is permanent: even if an offending module is |
diff --git a/include/linux/kernel.h b/include/linux/kernel.h index 4c0d3b2fd5fc..e8b1597b5cf2 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h | |||
@@ -371,6 +371,7 @@ extern enum system_states { | |||
371 | #define TAINT_WARN 9 | 371 | #define TAINT_WARN 9 |
372 | #define TAINT_CRAP 10 | 372 | #define TAINT_CRAP 10 |
373 | #define TAINT_FIRMWARE_WORKAROUND 11 | 373 | #define TAINT_FIRMWARE_WORKAROUND 11 |
374 | #define TAINT_OOT_MODULE 12 | ||
374 | 375 | ||
375 | extern const char hex_asc[]; | 376 | extern const char hex_asc[]; |
376 | #define hex_asc_lo(x) hex_asc[((x) & 0x0f)] | 377 | #define hex_asc_lo(x) hex_asc[((x) & 0x0f)] |
diff --git a/kernel/module.c b/kernel/module.c index 3c5509642847..ef8cb70c6996 100644 --- a/kernel/module.c +++ b/kernel/module.c | |||
@@ -2487,6 +2487,9 @@ static int check_modinfo(struct module *mod, struct load_info *info) | |||
2487 | return -ENOEXEC; | 2487 | return -ENOEXEC; |
2488 | } | 2488 | } |
2489 | 2489 | ||
2490 | if (!get_modinfo(info, "intree")) | ||
2491 | add_taint_module(mod, TAINT_OOT_MODULE); | ||
2492 | |||
2490 | if (get_modinfo(info, "staging")) { | 2493 | if (get_modinfo(info, "staging")) { |
2491 | add_taint_module(mod, TAINT_CRAP); | 2494 | add_taint_module(mod, TAINT_CRAP); |
2492 | printk(KERN_WARNING "%s: module is from the staging directory," | 2495 | printk(KERN_WARNING "%s: module is from the staging directory," |
@@ -3255,6 +3258,8 @@ static char *module_flags(struct module *mod, char *buf) | |||
3255 | buf[bx++] = '('; | 3258 | buf[bx++] = '('; |
3256 | if (mod->taints & (1 << TAINT_PROPRIETARY_MODULE)) | 3259 | if (mod->taints & (1 << TAINT_PROPRIETARY_MODULE)) |
3257 | buf[bx++] = 'P'; | 3260 | buf[bx++] = 'P'; |
3261 | else if (mod->taints & (1 << TAINT_OOT_MODULE)) | ||
3262 | buf[bx++] = 'O'; | ||
3258 | if (mod->taints & (1 << TAINT_FORCED_MODULE)) | 3263 | if (mod->taints & (1 << TAINT_FORCED_MODULE)) |
3259 | buf[bx++] = 'F'; | 3264 | buf[bx++] = 'F'; |
3260 | if (mod->taints & (1 << TAINT_CRAP)) | 3265 | if (mod->taints & (1 << TAINT_CRAP)) |
diff --git a/kernel/panic.c b/kernel/panic.c index d7bb6974efb5..b26593604214 100644 --- a/kernel/panic.c +++ b/kernel/panic.c | |||
@@ -177,6 +177,7 @@ static const struct tnt tnts[] = { | |||
177 | { TAINT_WARN, 'W', ' ' }, | 177 | { TAINT_WARN, 'W', ' ' }, |
178 | { TAINT_CRAP, 'C', ' ' }, | 178 | { TAINT_CRAP, 'C', ' ' }, |
179 | { TAINT_FIRMWARE_WORKAROUND, 'I', ' ' }, | 179 | { TAINT_FIRMWARE_WORKAROUND, 'I', ' ' }, |
180 | { TAINT_OOT_MODULE, 'O', ' ' }, | ||
180 | }; | 181 | }; |
181 | 182 | ||
182 | /** | 183 | /** |
@@ -194,6 +195,7 @@ static const struct tnt tnts[] = { | |||
194 | * 'W' - Taint on warning. | 195 | * 'W' - Taint on warning. |
195 | * 'C' - modules from drivers/staging are loaded. | 196 | * 'C' - modules from drivers/staging are loaded. |
196 | * 'I' - Working around severe firmware bug. | 197 | * 'I' - Working around severe firmware bug. |
198 | * 'O' - Out-of-tree module has been loaded. | ||
197 | * | 199 | * |
198 | * The string is overwritten by the next call to print_tainted(). | 200 | * The string is overwritten by the next call to print_tainted(). |
199 | */ | 201 | */ |
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index a509ff8f32fa..2bd594e6d1b4 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c | |||
@@ -1849,6 +1849,12 @@ static void add_header(struct buffer *b, struct module *mod) | |||
1849 | buf_printf(b, "};\n"); | 1849 | buf_printf(b, "};\n"); |
1850 | } | 1850 | } |
1851 | 1851 | ||
1852 | static void add_intree_flag(struct buffer *b, int is_intree) | ||
1853 | { | ||
1854 | if (is_intree) | ||
1855 | buf_printf(b, "\nMODULE_INFO(intree, \"Y\");\n"); | ||
1856 | } | ||
1857 | |||
1852 | static void add_staging_flag(struct buffer *b, const char *name) | 1858 | static void add_staging_flag(struct buffer *b, const char *name) |
1853 | { | 1859 | { |
1854 | static const char *staging_dir = "drivers/staging"; | 1860 | static const char *staging_dir = "drivers/staging"; |
@@ -2169,6 +2175,7 @@ int main(int argc, char **argv) | |||
2169 | buf.pos = 0; | 2175 | buf.pos = 0; |
2170 | 2176 | ||
2171 | add_header(&buf, mod); | 2177 | add_header(&buf, mod); |
2178 | add_intree_flag(&buf, !external_module); | ||
2172 | add_staging_flag(&buf, mod->name); | 2179 | add_staging_flag(&buf, mod->name); |
2173 | err |= add_versions(&buf, mod); | 2180 | err |= add_versions(&buf, mod); |
2174 | add_depends(&buf, mod, modules); | 2181 | add_depends(&buf, mod, modules); |