Commit 71814918 authored by Libor Pechacek's avatar Libor Pechacek Committed by Kleber Sacilotto de Souza

module: Issue warnings when tainting kernel

BugLink: http://bugs.launchpad.net/bugs/1745263

commit 3205c36c upstream.

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: default avatarLibor Pechacek <lpechacek@suse.com>
Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarKhalid Elmously <khalid.elmously@canonical.com>
Signed-off-by: default avatarStefan Bader <stefan.bader@canonical.com>
parent 43c8ff21
...@@ -2870,8 +2870,12 @@ static int check_modinfo(struct module *mod, struct load_info *info, int flags) ...@@ -2870,8 +2870,12 @@ static int check_modinfo(struct module *mod, struct load_info *info, int flags)
return -ENOEXEC; 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); add_taint_module(mod, TAINT_OOT_MODULE, LOCKDEP_STILL_OK);
}
if (get_modinfo(info, "staging")) { if (get_modinfo(info, "staging")) {
add_taint_module(mod, TAINT_CRAP, LOCKDEP_STILL_OK); add_taint_module(mod, TAINT_CRAP, LOCKDEP_STILL_OK);
...@@ -3036,6 +3040,8 @@ static int move_module(struct module *mod, struct load_info *info) ...@@ -3036,6 +3040,8 @@ static int move_module(struct module *mod, struct load_info *info)
static int check_module_license_and_versions(struct module *mod) 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. * ndiswrapper is under GPL by itself, but loads proprietary modules.
* Don't use add_taint_module(), as it would prevent ndiswrapper from * Don't use add_taint_module(), as it would prevent ndiswrapper from
...@@ -3054,6 +3060,9 @@ static int check_module_license_and_versions(struct module *mod) ...@@ -3054,6 +3060,9 @@ static int check_module_license_and_versions(struct module *mod)
add_taint_module(mod, TAINT_PROPRIETARY_MODULE, add_taint_module(mod, TAINT_PROPRIETARY_MODULE,
LOCKDEP_NOW_UNRELIABLE); LOCKDEP_NOW_UNRELIABLE);
if (!prev_taint && test_taint(TAINT_PROPRIETARY_MODULE))
pr_warn("%s: module license taints kernel.\n", mod->name);
#ifdef CONFIG_MODVERSIONS #ifdef CONFIG_MODVERSIONS
if ((mod->num_syms && !mod->crcs) if ((mod->num_syms && !mod->crcs)
|| (mod->num_gpl_syms && !mod->gpl_crcs) || (mod->num_gpl_syms && !mod->gpl_crcs)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment