linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dave Young <dyoung@redhat.com>
To: rusty@rustcorp.com.au, linux-kernel@vger.kernel.org
Subject: [PATCH] add kernel parameter to disable module load
Date: Sat, 28 Jan 2012 11:34:50 +0800	[thread overview]
Message-ID: <20120128033450.GA2138@darkstar> (raw)

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.
---
 Documentation/kernel-parameters.txt |    2 ++
 kernel/module.c                     |    7 +++++++
 2 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
index e229769..b5cd482 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -1796,6 +1796,8 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
 	nomfgpt		[X86-32] Disable Multi-Function General Purpose
 			Timer usage (for AMD Geode machines).
 
+	nomodule	Disable module load
+
 	nopat		[X86] Disable PAT (page attribute table extension of
 			pagetables) support.
 
diff --git a/kernel/module.c b/kernel/module.c
index 178333c..72395f5 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -3478,6 +3478,13 @@ void print_modules(void)
 	printk("\n");
 }
 
+static int __init module_load_disable(char *str)
+{
+	modules_disabled = 1;
+	return 1;
+}
+__setup("nomodule", module_load_disable);
+
 #ifdef CONFIG_MODVERSIONS
 /* Generate the signature for all relevant module structures here.
  * If these change, we don't want to try to parse the module. */
-- 
1.7.4.4


             reply	other threads:[~2012-01-28  3:34 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-28  3:34 Dave Young [this message]
2012-01-29  0:51 ` [PATCH] add kernel parameter to disable module load Rusty Russell
2012-01-30  7:38   ` Dave Young
2012-01-31  2:44   ` Dave Young
2012-01-31  2:59     ` Rusty Russell
2012-01-31  3:36       ` Dave Young

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120128033450.GA2138@darkstar \
    --to=dyoung@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rusty@rustcorp.com.au \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).