aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/module
diff options
context:
space:
mode:
authorLuis Chamberlain <mcgrof@kernel.org>2023-03-19 14:27:43 -0700
committerLuis Chamberlain <mcgrof@kernel.org>2023-03-24 11:33:08 -0700
commita12b94511cf36855cd731c16005bd535e2007552 (patch)
tree7a1914b490d1d93c2552fb76137e0de6b369d3c4 /kernel/module
parent437c1f9cc61fd37829eaf12d8ae2f7dcc5dddce0 (diff)
downloadlinux-a12b94511cf36855cd731c16005bd535e2007552.tar.gz
module: move tainting until after a module hits our linked list
It is silly to have taints spread out all over, we can just compromise and add them if the module ever hit our linked list. Our sanity checkers should just prevent crappy drivers / bogus ELF modules / etc and kconfig options should be enough to let you *not* load things you don't want. Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
Diffstat (limited to 'kernel/module')
-rw-r--r--kernel/module/main.c22
1 files changed, 10 insertions, 12 deletions
diff --git a/kernel/module/main.c b/kernel/module/main.c
index a3953ca180905e..1aa71f82aca28c 100644
--- a/kernel/module/main.c
+++ b/kernel/module/main.c
@@ -2009,18 +2009,6 @@ static int check_modinfo(struct module *mod, struct load_info *info, int flags)
if (err)
return err;
- /*
- * We are tainting your kernel *even* if you try to load
- * modules with possible taints and we fail to load these
- * modules for other reasons.
- *
- * We have a descrepancy though, see the other taints for
- * signature and those in check_module_license_and_versions().
- *
- * We should compromise and converge.
- */
- module_augment_kernel_taints(mod, info);
-
return 0;
}
@@ -2772,6 +2760,16 @@ static int load_module(struct load_info *info, const char __user *uargs,
if (err)
goto free_module;
+ /*
+ * We are tainting your kernel if your module gets into
+ * the modules linked list somehow.
+ *
+ * We have a descrepancy though, see the other taints for
+ * signature and those in check_module_license_and_versions().
+ *
+ * We should compromise and converge.
+ */
+ module_augment_kernel_taints(mod, info);
#ifdef CONFIG_MODULE_SIG
mod->sig_ok = info->sig_ok;
if (!mod->sig_ok) {