Commit 2449b8ba0745327c5fa49a8d9acffe03b2eded69
Committed by
Rusty Russell
1 parent
1cd0d6c302
Exists in
master
and in
6 other branches
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)
Showing 5 changed files with 17 additions and 0 deletions Side-by-side Diff
Documentation/oops-tracing.txt
... | ... | @@ -263,6 +263,8 @@ |
263 | 263 | 12: 'I' if the kernel is working around a severe bug in the platform |
264 | 264 | firmware (BIOS or similar). |
265 | 265 | |
266 | + 13: 'O' if an externally-built ("out-of-tree") module has been loaded. | |
267 | + | |
266 | 268 | The primary reason for the 'Tainted: ' string is to tell kernel |
267 | 269 | debuggers if this is a clean kernel or if anything unusual has |
268 | 270 | occurred. Tainting is permanent: even if an offending module is |
include/linux/kernel.h
kernel/module.c
... | ... | @@ -2487,6 +2487,9 @@ |
2487 | 2487 | return -ENOEXEC; |
2488 | 2488 | } |
2489 | 2489 | |
2490 | + if (!get_modinfo(info, "intree")) | |
2491 | + add_taint_module(mod, TAINT_OOT_MODULE); | |
2492 | + | |
2490 | 2493 | if (get_modinfo(info, "staging")) { |
2491 | 2494 | add_taint_module(mod, TAINT_CRAP); |
2492 | 2495 | printk(KERN_WARNING "%s: module is from the staging directory," |
... | ... | @@ -3255,6 +3258,8 @@ |
3255 | 3258 | buf[bx++] = '('; |
3256 | 3259 | if (mod->taints & (1 << TAINT_PROPRIETARY_MODULE)) |
3257 | 3260 | buf[bx++] = 'P'; |
3261 | + else if (mod->taints & (1 << TAINT_OOT_MODULE)) | |
3262 | + buf[bx++] = 'O'; | |
3258 | 3263 | if (mod->taints & (1 << TAINT_FORCED_MODULE)) |
3259 | 3264 | buf[bx++] = 'F'; |
3260 | 3265 | if (mod->taints & (1 << TAINT_CRAP)) |
kernel/panic.c
... | ... | @@ -177,6 +177,7 @@ |
177 | 177 | { TAINT_WARN, 'W', ' ' }, |
178 | 178 | { TAINT_CRAP, 'C', ' ' }, |
179 | 179 | { TAINT_FIRMWARE_WORKAROUND, 'I', ' ' }, |
180 | + { TAINT_OOT_MODULE, 'O', ' ' }, | |
180 | 181 | }; |
181 | 182 | |
182 | 183 | /** |
... | ... | @@ -194,6 +195,7 @@ |
194 | 195 | * 'W' - Taint on warning. |
195 | 196 | * 'C' - modules from drivers/staging are loaded. |
196 | 197 | * 'I' - Working around severe firmware bug. |
198 | + * 'O' - Out-of-tree module has been loaded. | |
197 | 199 | * |
198 | 200 | * The string is overwritten by the next call to print_tainted(). |
199 | 201 | */ |
scripts/mod/modpost.c
... | ... | @@ -1849,6 +1849,12 @@ |
1849 | 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 | 1858 | static void add_staging_flag(struct buffer *b, const char *name) |
1853 | 1859 | { |
1854 | 1860 | static const char *staging_dir = "drivers/staging"; |
... | ... | @@ -2169,6 +2175,7 @@ |
2169 | 2175 | buf.pos = 0; |
2170 | 2176 | |
2171 | 2177 | add_header(&buf, mod); |
2178 | + add_intree_flag(&buf, !external_module); | |
2172 | 2179 | add_staging_flag(&buf, mod->name); |
2173 | 2180 | err |= add_versions(&buf, mod); |
2174 | 2181 | add_depends(&buf, mod, modules); |