aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/linux/module.h2
-rw-r--r--kernel/module.c37
2 files changed, 36 insertions, 3 deletions
diff --git a/include/linux/module.h b/include/linux/module.h
index 2c599175c583..4b2d8091a410 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -320,6 +320,8 @@ struct module
320 /* Am I GPL-compatible */ 320 /* Am I GPL-compatible */
321 int license_gplok; 321 int license_gplok;
322 322
323 unsigned int taints; /* same bits as kernel:tainted */
324
323#ifdef CONFIG_MODULE_UNLOAD 325#ifdef CONFIG_MODULE_UNLOAD
324 /* Reference counts */ 326 /* Reference counts */
325 struct module_ref ref[NR_CPUS]; 327 struct module_ref ref[NR_CPUS];
diff --git a/kernel/module.c b/kernel/module.c
index 05625d5dc758..7c77a0a9275c 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -851,6 +851,7 @@ static int check_version(Elf_Shdr *sechdrs,
851 printk("%s: no version for \"%s\" found: kernel tainted.\n", 851 printk("%s: no version for \"%s\" found: kernel tainted.\n",
852 mod->name, symname); 852 mod->name, symname);
853 add_taint(TAINT_FORCED_MODULE); 853 add_taint(TAINT_FORCED_MODULE);
854 mod->taints |= TAINT_FORCED_MODULE;
854 } 855 }
855 return 1; 856 return 1;
856} 857}
@@ -1339,6 +1340,7 @@ static void set_license(struct module *mod, const char *license)
1339 printk(KERN_WARNING "%s: module license '%s' taints kernel.\n", 1340 printk(KERN_WARNING "%s: module license '%s' taints kernel.\n",
1340 mod->name, license); 1341 mod->name, license);
1341 add_taint(TAINT_PROPRIETARY_MODULE); 1342 add_taint(TAINT_PROPRIETARY_MODULE);
1343 mod->taints |= TAINT_PROPRIETARY_MODULE;
1342 } 1344 }
1343} 1345}
1344 1346
@@ -1618,6 +1620,7 @@ static struct module *load_module(void __user *umod,
1618 /* This is allowed: modprobe --force will invalidate it. */ 1620 /* This is allowed: modprobe --force will invalidate it. */
1619 if (!modmagic) { 1621 if (!modmagic) {
1620 add_taint(TAINT_FORCED_MODULE); 1622 add_taint(TAINT_FORCED_MODULE);
1623 mod->taints |= TAINT_FORCED_MODULE;
1621 printk(KERN_WARNING "%s: no version magic, tainting kernel.\n", 1624 printk(KERN_WARNING "%s: no version magic, tainting kernel.\n",
1622 mod->name); 1625 mod->name);
1623 } else if (!same_magic(modmagic, vermagic)) { 1626 } else if (!same_magic(modmagic, vermagic)) {
@@ -1711,10 +1714,14 @@ static struct module *load_module(void __user *umod,
1711 /* Set up license info based on the info section */ 1714 /* Set up license info based on the info section */
1712 set_license(mod, get_modinfo(sechdrs, infoindex, "license")); 1715 set_license(mod, get_modinfo(sechdrs, infoindex, "license"));
1713 1716
1714 if (strcmp(mod->name, "ndiswrapper") == 0) 1717 if (strcmp(mod->name, "ndiswrapper") == 0) {
1715 add_taint(TAINT_PROPRIETARY_MODULE); 1718 add_taint(TAINT_PROPRIETARY_MODULE);
1716 if (strcmp(mod->name, "driverloader") == 0) 1719 mod->taints |= TAINT_PROPRIETARY_MODULE;
1720 }
1721 if (strcmp(mod->name, "driverloader") == 0) {
1717 add_taint(TAINT_PROPRIETARY_MODULE); 1722 add_taint(TAINT_PROPRIETARY_MODULE);
1723 mod->taints |= TAINT_PROPRIETARY_MODULE;
1724 }
1718 1725
1719 /* Set up MODINFO_ATTR fields */ 1726 /* Set up MODINFO_ATTR fields */
1720 setup_modinfo(mod, sechdrs, infoindex); 1727 setup_modinfo(mod, sechdrs, infoindex);
@@ -1760,6 +1767,7 @@ static struct module *load_module(void __user *umod,
1760 printk(KERN_WARNING "%s: No versions for exported symbols." 1767 printk(KERN_WARNING "%s: No versions for exported symbols."
1761 " Tainting kernel.\n", mod->name); 1768 " Tainting kernel.\n", mod->name);
1762 add_taint(TAINT_FORCED_MODULE); 1769 add_taint(TAINT_FORCED_MODULE);
1770 mod->taints |= TAINT_FORCED_MODULE;
1763 } 1771 }
1764#endif 1772#endif
1765 1773
@@ -2226,14 +2234,37 @@ struct module *module_text_address(unsigned long addr)
2226 return mod; 2234 return mod;
2227} 2235}
2228 2236
2237static char *taint_flags(unsigned int taints, char *buf)
2238{
2239 *buf = '\0';
2240 if (taints) {
2241 int bx;
2242
2243 buf[0] = '(';
2244 bx = 1;
2245 if (taints & TAINT_PROPRIETARY_MODULE)
2246 buf[bx++] = 'P';
2247 if (taints & TAINT_FORCED_MODULE)
2248 buf[bx++] = 'F';
2249 /*
2250 * TAINT_FORCED_RMMOD: could be added.
2251 * TAINT_UNSAFE_SMP, TAINT_MACHINE_CHECK, TAINT_BAD_PAGE don't
2252 * apply to modules.
2253 */
2254 buf[bx] = ')';
2255 }
2256 return buf;
2257}
2258
2229/* Don't grab lock, we're oopsing. */ 2259/* Don't grab lock, we're oopsing. */
2230void print_modules(void) 2260void print_modules(void)
2231{ 2261{
2232 struct module *mod; 2262 struct module *mod;
2263 char buf[8];
2233 2264
2234 printk("Modules linked in:"); 2265 printk("Modules linked in:");
2235 list_for_each_entry(mod, &modules, list) 2266 list_for_each_entry(mod, &modules, list)
2236 printk(" %s", mod->name); 2267 printk(" %s%s", mod->name, taint_flags(mod->taints, buf));
2237 printk("\n"); 2268 printk("\n");
2238} 2269}
2239 2270