public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Dave Jones <davej@redhat.com>
To: Linux Kernel <linux-kernel@vger.kernel.org>
Cc: x86@kernel.org
Subject: Make CONFIG_DEBUG_RODATA boot-time configurable
Date: Thu, 15 Jul 2010 17:09:44 -0400	[thread overview]
Message-ID: <20100715210944.GA24961@redhat.com> (raw)

We had a request to disable DEBUG_RODATA in our kernel for debugging purposes.  
Turning it off completely seems a bit unfortunate for the minority case
of people wanting to do debugging, so I came up with this patch to make
it a boot-time 'disable_rodata' argument.

Signed-off-by: Dave Jones <davej@redhat.com>


diff --git a/init/main.c b/init/main.c
index a42fdf4..eb60fae 100644
--- a/init/main.c
+++ b/init/main.c
@@ -820,6 +820,15 @@ static void run_init_process(char *init_filename)
 	kernel_execve(init_filename, argv_init, envp_init);
 }
 
+static unsigned int disable_rodata;
+static int __init set_disable_rodata(char *str)
+{
+	disable_rodata = 1;
+	return 1;
+}
+__setup("disable_rodata", set_disable_rodata);
+
+
 /* This is a non __init function. Force it to be noinline otherwise gcc
  * makes it inline to init() and it becomes part of init.text section
  */
@@ -830,7 +839,8 @@ static noinline int init_post(void)
 	async_synchronize_full();
 	free_initmem();
 	unlock_kernel();
-	mark_rodata_ro();
+	if (disable_rodata == 0)
+		mark_rodata_ro();
 	system_state = SYSTEM_RUNNING;
 	numa_default_policy();
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
index 4ddb58d..1320d80 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -651,6 +651,10 @@ and is between 256 and 4096 characters. It is defined in the file
 			MTRR settings.  This parameter disables that behavior,
 			possibly causing your machine to run very slowly.
 
+	disable_rodata [X86]
+			Don't mark .rodata section as read-only.
+			May be useful for debugging.
+
 	disable_timer_pin_1 [X86]
 			Disable PIN 1 of APIC timer
 			Can be useful to work around chipset bugs.

             reply	other threads:[~2010-07-15 21:10 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-15 21:09 Dave Jones [this message]
2010-07-15 21:35 ` Make CONFIG_DEBUG_RODATA boot-time configurable Randy Dunlap
2010-07-15 21:52   ` Dave Jones
2010-07-15 22:06 ` Thomas Gleixner
2010-07-15 22:09   ` Dave Jones
2010-07-16  3:53   ` Arjan van de Ven
2010-07-16  3:42 ` Arjan van de Ven

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=20100715210944.GA24961@redhat.com \
    --to=davej@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=x86@kernel.org \
    /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