2014-02-21 08:30:57

by Xudong Zhang

[permalink] [raw]
Subject: [PATCH] There should have a warn/log when out-of-tree module is loaded

I can not get any hint when I found that my kernel is tainted (out of
tree module is loaded). And I checked all loaded and loadable modules
but it showed that all of them are intree modules.
I think we need a warn when out of tree module is loaded.

Signed-off-by: Xudong Zhang <[email protected]>
---
kernel/module.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/kernel/module.c b/kernel/module.c
index efa1e60..f80739f 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -2681,8 +2681,11 @@ 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")) {
add_taint_module(mod, TAINT_OOT_MODULE, LOCKDEP_STILL_OK);
+ pr_warn("%s: out-of-tree module is loaded, kernel tainted.\n",
+ mod->name);
+ }

if (get_modinfo(info, "staging")) {
add_taint_module(mod, TAINT_CRAP, LOCKDEP_STILL_OK);
--
1.8.4.5


2014-02-24 03:40:48

by Rusty Russell

[permalink] [raw]
Subject: Re: [PATCH] There should have a warn/log when out-of-tree module is loaded

Xudong Zhang <[email protected]> writes:
> I can not get any hint when I found that my kernel is tainted (out of
> tree module is loaded). And I checked all loaded and loadable modules
> but it showed that all of them are intree modules.
> I think we need a warn when out of tree module is loaded.
>
> Signed-off-by: Xudong Zhang <[email protected]>

This would be an escalation.

This taint only has an effect on oops messages, and
/proc/sys/kernel/tainted.

Cheers,
Rusty.