aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibor Pechacek <lpechacek@suse.com>2016-04-12 21:36:12 -0400
committerRusty Russell <rusty@rustcorp.com.au>2016-07-26 23:08:00 -0400
commit3205c36cf7d96024626f92d65f560035df1abcb2 (patch)
tree1dfb596c2a4ebc8e7f6958f86fecc5236e7ecd77
parentc75b590d60ffa3e31bcb9608b68006a8bab9e0ed (diff)
module: Issue warnings when tainting kernel
While most of the locations where a kernel taint bit is set are accompanied with a warning message, there are two which set their bits silently. If the tainting module gets unloaded later on, it is almost impossible to tell what was the reason for setting the flag. Signed-off-by: Libor Pechacek <lpechacek@suse.com> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
-rw-r--r--kernel/module.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/kernel/module.c b/kernel/module.c
index 9e04a4210a4a..0b4f3a85d4fc 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -2919,8 +2919,12 @@ static int check_modinfo(struct module *mod, struct load_info *info, int flags)
2919 return -ENOEXEC; 2919 return -ENOEXEC;
2920 } 2920 }
2921 2921
2922 if (!get_modinfo(info, "intree")) 2922 if (!get_modinfo(info, "intree")) {
2923 if (!test_taint(TAINT_OOT_MODULE))
2924 pr_warn("%s: loading out-of-tree module taints kernel.\n",
2925 mod->name);
2923 add_taint_module(mod, TAINT_OOT_MODULE, LOCKDEP_STILL_OK); 2926 add_taint_module(mod, TAINT_OOT_MODULE, LOCKDEP_STILL_OK);
2927 }
2924 2928
2925 if (get_modinfo(info, "staging")) { 2929 if (get_modinfo(info, "staging")) {
2926 add_taint_module(mod, TAINT_CRAP, LOCKDEP_STILL_OK); 2930 add_taint_module(mod, TAINT_CRAP, LOCKDEP_STILL_OK);
@@ -3089,6 +3093,8 @@ static int move_module(struct module *mod, struct load_info *info)
3089 3093
3090static int check_module_license_and_versions(struct module *mod) 3094static int check_module_license_and_versions(struct module *mod)
3091{ 3095{
3096 int prev_taint = test_taint(TAINT_PROPRIETARY_MODULE);
3097
3092 /* 3098 /*
3093 * ndiswrapper is under GPL by itself, but loads proprietary modules. 3099 * ndiswrapper is under GPL by itself, but loads proprietary modules.
3094 * Don't use add_taint_module(), as it would prevent ndiswrapper from 3100 * Don't use add_taint_module(), as it would prevent ndiswrapper from
@@ -3107,6 +3113,9 @@ static int check_module_license_and_versions(struct module *mod)
3107 add_taint_module(mod, TAINT_PROPRIETARY_MODULE, 3113 add_taint_module(mod, TAINT_PROPRIETARY_MODULE,
3108 LOCKDEP_NOW_UNRELIABLE); 3114 LOCKDEP_NOW_UNRELIABLE);
3109 3115
3116 if (!prev_taint && test_taint(TAINT_PROPRIETARY_MODULE))
3117 pr_warn("%s: module license taints kernel.\n", mod->name);
3118
3110#ifdef CONFIG_MODVERSIONS 3119#ifdef CONFIG_MODVERSIONS
3111 if ((mod->num_syms && !mod->crcs) 3120 if ((mod->num_syms && !mod->crcs)
3112 || (mod->num_gpl_syms && !mod->gpl_crcs) 3121 || (mod->num_gpl_syms && !mod->gpl_crcs)