Skip to contentSkip to conversation

add kernel param to force disable module load

PATCH In review Dave Young 2 participants 2 messages Feb 1, 2012 – Feb 3, 2012 Documentation

lore
Share & tools
lore

Dave Young

author
#0 lore raw

PATCH 2/2 add kernel param to force disable module load

Sometimes we need to test a kernel of same version with code or config option changes.

We already have sysctl to disable module load, but add a kernel parameter will be more convenient.

Since modules_disabled is int, so here use bint type in core_param.
TODO: make sysctl accept bool and change modules_disabled to bool

Cc Rusty Russell <[email protected]>
---
 Documentation/kernel-parameters.txt |    2 ++
 kernel/module.c                     |    1 +
 2 files changed, 3 insertions(+)
Documentation/kernel-parameters.txt +2 -0
@@ -1833,6 +1833,8 @@ bytes respectively. Such letter suffixes
 			shutdown the other cpus.  Instead use the REBOOT_VECTOR
 			irq.
 
+	nomodule	Disable module load
+
 	nopat		[X86] Disable PAT (page attribute table extension of
 			pagetables) support.
 
kernel/module.c +1 -0
@@ -105,6 +105,7 @@ struct list_head *kdb_modules = &modules
 
 /* Block module loading/unloading? */
 int modules_disabled = 0;
+core_param(nomodule, modules_disabled, bint, 0);
 
 /* Waiting for a module to finish initializing? */
 static DECLARE_WAIT_QUEUE_HEAD(module_wq);
#1 lore raw
Quoted 8 lines · Dave Young

Sometimes we need to test a kernel of same version with code or config option changes.

We already have sysctl to disable module load, but add a kernel parameter will be more convenient.

Since modules_disabled is int, so here use bint type in core_param.
TODO: make sysctl accept bool and change modules_disabled to bool

Both applied.

Thanks!
Rusty.