lkml.org 
[lkml]   [2002]   [Jun]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[RFC][TRIVIAL] Print a KERN_INFO after a module gets loaded
Hi all,

After some thinking (nothing serious) I came up with the idea of print a
KERN_INFO after a module got loaded, why? Think about this, some guy
inserts a LKM rootkit, obviously that module (think adore or knark)
doesn't say anything when it gets loaded. In this cases is useful to have
this feature, another example can be simply now the order of a group of
pre-requisite modules when you load something using modprobe(8).

Before doing this I searched the web, readed some docs and asked on
#kernelnewbies, it seems there's no standard way to log the insertion of a
module.

I'm not sure if this is the right way to do this, I'm just adding a printk
after the module gets initialized, perhaps it must be done somewhere else,
comments/flames are welcome.

This is pretty useful, at least for me 8) (the printk, not the flames)

Best Regards

PS: Oops, I forgot, this applies happily against 2.4.18 and 2.5.21

diff -Nrua linux/kernel/module.c linux-info/kernel/module.c
--- linux/kernel/module.c Sat Jun 15 01:00:24 2002
+++ linux-info/kernel/module.c Sat Jun 15 01:02:37 2002
@@ -560,6 +560,7 @@

/* And set it running. */
mod->flags = (mod->flags | MOD_RUNNING) & ~MOD_INITIALIZING;
+ printk(KERN_INFO "module: %s loaded\n", mod->name);
error = 0;
goto err0;

--
Robinson Maureira Castillo
Asesor DAI
INACAP
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:26    [from the cache]
©2003-2011 Jasper Spaans