FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Redhat > Device-mapper Development

 
 
LinkBack Thread Tools
 
Old 03-08-2011, 05:55 AM
"Brian C. Lane"
 
Default Check blacklist= for the module name before loading it (#569883)

Prevent loader from loading blacklisted modules. Pass blacklist=modname
to the kernel, one module per blacklist= entry.

Related: rhbz#569883
---
loader2/modules.c | 20 ++++++++++++++++++--
1 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/loader2/modules.c b/loader2/modules.c
index 4b59777..b79eb50 100644
--- a/loader2/modules.c
+++ b/loader2/modules.c
@@ -43,6 +43,10 @@
/* boot flags */
extern uint64_t flags;

+/* parsed /proc/cmdline */
+extern char **cmdline_argv;
+extern int cmdline_argc;
+
static int writeModulesConf(moduleList list, char *conf);
static struct extractedModule * extractModules (char * const * modNames,
struct extractedModule * oldPaths,
@@ -246,6 +250,18 @@ int mlModuleInList(const char * modName, moduleList list) {
return 0;
}

+int mlModuleInBlacklist(const char * modName) {
+ int i;
+
+ for (i=0; i < cmdline_argc; i++) {
+ if (!strncasecmp(cmdline_argv[i], "blacklist=", 10))
+ if (!strcmp(cmdline_argv[i] + 10, modName))
+ return 1;
+ }
+
+ return 0;
+}
+
static struct loadedModuleInfo * getLoadedModuleInfo(moduleList modLoaded,
const char * modName) {
int i = 0;
@@ -270,7 +286,7 @@ static int loadModule(const char * modName, struct extractedModule * path,
static int usbWasLoaded = 0;

/* don't need to load a module that's already loaded */
- if (mlModuleInList(modName, modLoaded))
+ if (mlModuleInList(modName, modLoaded) || mlModuleInBlacklist(modName))
return 0;

if (modInfo && (mi = findModuleInfo(modInfo, modName))) {
@@ -479,7 +495,7 @@ static int doLoadModules(const char * origModNames, moduleList modLoaded,
next++;
}

- if (mlModuleInList(start, modLoaded)) {
+ if (mlModuleInList(start, modLoaded) || mlModuleInBlacklist(start)) {
/* already loaded, we don't need to load it again */
start = next;
continue;
--
1.7.4

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 

Thread Tools




All times are GMT. The time now is 05:45 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org