* Make CONFIG_DEBUG_RODATA boot-time configurable
@ 2010-07-15 21:09 Dave Jones
2010-07-15 21:35 ` Randy Dunlap
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Dave Jones @ 2010-07-15 21:09 UTC (permalink / raw)
To: Linux Kernel; +Cc: x86
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.
^ permalink raw reply related [flat|nested] 7+ messages in thread* Re: Make CONFIG_DEBUG_RODATA boot-time configurable
2010-07-15 21:09 Make CONFIG_DEBUG_RODATA boot-time configurable Dave Jones
@ 2010-07-15 21:35 ` Randy Dunlap
2010-07-15 21:52 ` Dave Jones
2010-07-15 22:06 ` Thomas Gleixner
2010-07-16 3:42 ` Arjan van de Ven
2 siblings, 1 reply; 7+ messages in thread
From: Randy Dunlap @ 2010-07-15 21:35 UTC (permalink / raw)
To: Dave Jones; +Cc: Linux Kernel, x86
On Thu, 15 Jul 2010 17:09:44 -0400 Dave Jones wrote:
> 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]
What is X86-specific about this boot option?
> + 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.
> --
---
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: Make CONFIG_DEBUG_RODATA boot-time configurable
2010-07-15 21:35 ` Randy Dunlap
@ 2010-07-15 21:52 ` Dave Jones
0 siblings, 0 replies; 7+ messages in thread
From: Dave Jones @ 2010-07-15 21:52 UTC (permalink / raw)
To: Randy Dunlap; +Cc: Linux Kernel, x86
On Thu, Jul 15, 2010 at 02:35:25PM -0700, Randy Dunlap wrote:
> > 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]
>
> What is X86-specific about this boot option?
Just hadn't realized that other archs had implemented it.
Dave
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Make CONFIG_DEBUG_RODATA boot-time configurable
2010-07-15 21:09 Make CONFIG_DEBUG_RODATA boot-time configurable Dave Jones
2010-07-15 21:35 ` Randy Dunlap
@ 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
2 siblings, 2 replies; 7+ messages in thread
From: Thomas Gleixner @ 2010-07-15 22:06 UTC (permalink / raw)
To: Dave Jones; +Cc: Linux Kernel, x86, Arjan van de Ven
On Thu, 15 Jul 2010, Dave Jones wrote:
> 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>
Nice one, shouldn't we get rid of the DEBUG_RODATA config and enable
it unconditionally ?
Thanks,
tglx
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Make CONFIG_DEBUG_RODATA boot-time configurable
2010-07-15 22:06 ` Thomas Gleixner
@ 2010-07-15 22:09 ` Dave Jones
2010-07-16 3:53 ` Arjan van de Ven
1 sibling, 0 replies; 7+ messages in thread
From: Dave Jones @ 2010-07-15 22:09 UTC (permalink / raw)
To: Thomas Gleixner; +Cc: Linux Kernel, x86, Arjan van de Ven
On Fri, Jul 16, 2010 at 12:06:16AM +0200, Thomas Gleixner wrote:
> On Thu, 15 Jul 2010, Dave Jones wrote:
>
> > 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>
>
> Nice one, shouldn't we get rid of the DEBUG_RODATA config and enable
> it unconditionally ?
I personally have no objection, but others might.
follow-up patch rather than including it in this maybe?
Dave
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Make CONFIG_DEBUG_RODATA boot-time configurable
2010-07-15 22:06 ` Thomas Gleixner
2010-07-15 22:09 ` Dave Jones
@ 2010-07-16 3:53 ` Arjan van de Ven
1 sibling, 0 replies; 7+ messages in thread
From: Arjan van de Ven @ 2010-07-16 3:53 UTC (permalink / raw)
To: Thomas Gleixner; +Cc: Dave Jones, Linux Kernel, x86
On Fri, 16 Jul 2010 00:06:16 +0200 (CEST)
Thomas Gleixner <tglx@linutronix.de> wrote:
> On Thu, 15 Jul 2010, Dave Jones wrote:
>
> > 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>
>
> Nice one, shouldn't we get rid of the DEBUG_RODATA config and enable
> it unconditionally ?
>
I'd go one step further; enable unconditional, and have the config
option control if you can turn it off or not...
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Make CONFIG_DEBUG_RODATA boot-time configurable
2010-07-15 21:09 Make CONFIG_DEBUG_RODATA boot-time configurable Dave Jones
2010-07-15 21:35 ` Randy Dunlap
2010-07-15 22:06 ` Thomas Gleixner
@ 2010-07-16 3:42 ` Arjan van de Ven
2 siblings, 0 replies; 7+ messages in thread
From: Arjan van de Ven @ 2010-07-16 3:42 UTC (permalink / raw)
To: Dave Jones; +Cc: Linux Kernel, x86
On Thu, 15 Jul 2010 17:09:44 -0400
Dave Jones <davej@redhat.com> wrote:
> 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.
I'd be very curious what kind of debugging this is...
is this the rootkit type of debugging?
--
Arjan van de Ven Intel Open Source Technology Centre
For development, discussion and tips for power savings,
visit http://www.lesswatts.org
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2010-07-16 3:49 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-15 21:09 Make CONFIG_DEBUG_RODATA boot-time configurable Dave Jones
2010-07-15 21:35 ` 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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox