diff options
author | Libor Pechacek <lpechacek@suse.com> | 2016-04-13 11:06:12 +0930 |
---|---|---|
committer | Sasha Levin <alexander.levin@microsoft.com> | 2018-02-28 19:32:21 -0500 |
commit | b193849242f888e3be10d8817158790d0e9a53bd (patch) | |
tree | d39767799a7e0f227e01d792b27dc3ced42d7b24 /kernel | |
parent | 488428b52bcdb3c2cb5a9fafce4fee9327093b83 (diff) |
module: Issue warnings when tainting kernel
[ Upstream commit 3205c36cf7d96024626f92d65f560035df1abcb2 ]
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>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/module.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/kernel/module.c b/kernel/module.c index 6fbc430e59db..c38bf6e486a4 100644 --- a/kernel/module.c +++ b/kernel/module.c @@ -2733,8 +2733,12 @@ static int check_modinfo(struct module *mod, struct load_info *info, int flags) return -ENOEXEC; } - if (!get_modinfo(info, "intree")) + if (!get_modinfo(info, "intree")) { + if (!test_taint(TAINT_OOT_MODULE)) + pr_warn("%s: loading out-of-tree module taints kernel.\n", + mod->name); add_taint_module(mod, TAINT_OOT_MODULE, LOCKDEP_STILL_OK); + } if (get_modinfo(info, "staging")) { add_taint_module(mod, TAINT_CRAP, LOCKDEP_STILL_OK); @@ -2899,6 +2903,8 @@ static int move_module(struct module *mod, struct load_info *info) static int check_module_license_and_versions(struct module *mod) { + int prev_taint = test_taint(TAINT_PROPRIETARY_MODULE); + /* * ndiswrapper is under GPL by itself, but loads proprietary modules. * Don't use add_taint_module(), as it would prevent ndiswrapper from @@ -2917,6 +2923,9 @@ static int check_module_license_and_versions(struct module *mod) add_taint_module(mod, TAINT_PROPRIETARY_MODULE, LOCKDEP_NOW_UNRELIABLE); + if (!prev_taint && test_taint(TAINT_PROPRIETARY_MODULE)) + pr_warn("%s: module license taints kernel.\n", mod->name); + #ifdef CONFIG_MODVERSIONS if ((mod->num_syms && !mod->crcs) || (mod->num_gpl_syms && !mod->gpl_crcs) |