public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "S. P. Prasanna" <prasanna@in.ibm.com>
To: Arjan van de Ven <arjan@infradead.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
	Ian McDonald <ian.mcdonald@jandi.co.nz>,
	Andrew Morton <akpm@linux-foundation.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Miklos Szeredi <miklos@szeredi.hu>, Ingo Molnar <mingo@elte.hu>,
	"Darrick J. Wong" <djwong@us.ibm.com>, Andi Kleen <ak@suse.de>,
	Bj?rn Steinbrink <B.Steinbrink@gmx.de>,
	William Cohen <wcohen@redhat.com>,
	Antonino Daplas <adaplas@gmail.com>, Olaf Hering <olaf@aepfle.de>,
	Ville Syrj?l? <syrjala@sci.fi>, Jean Delvare <khali@linux-fr.org>,
	Rudolf Marek <r.marek@assembler.cz>,
	Soeren Sonnenburg <kernel@nn7.de>,
	Michal Piotrowski <michal.k.k.piotrowski@gmail.com>
Subject: Re: [1/2] 2.6.22-rc5: known regressions with patches
Date: Thu, 21 Jun 2007 12:41:25 +0530	[thread overview]
Message-ID: <20070621071125.GA6615@in.ibm.com> (raw)
In-Reply-To: <1182403401.2863.10.camel@laptopd505.fenrus.org>

On Wed, Jun 20, 2007 at 10:23:21PM -0700, Arjan van de Ven wrote:
> On Wed, 2007-06-20 at 16:50 -0700, Linus Torvalds wrote:
> > 
> > On Wed, 20 Jun 2007, Arjan van de Ven wrote:
> > > 
> > > the real fix would be something like this instead:
> > 
> > If people can test this, and confirm it works, please send a patch that 
> > not only does this ad undoes the Kconfig language.  It looks like the 
> > right thing to do, but I won't touch it without somebody who actually 
> > tested these combinarions sending in a patch.
> 
> Hi,
> 
> I have tested this on x86_64, and without the config language, the
> original oopses, while with the patch below it works fine (as expected).
> I've not been able to test the i386 one (no 32 bit testboxes since 2
> years) but the change is even simpler there, just an ifdef around the
> entire kernel text marking.

I tested this patch on i386 box, it seems to work fine.

Thanks
Prasanna
> 
> 
> 
> Do not mark the kernel text read only if KPROBES is in the kernel;
> kprobes needs to hot-patch the kernel text to insert it's
> instrumentation. In this case, only mark the .rodata segment as read
> only.
> 
> Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>
> 
> --- linux-2.6.22-rc5/arch/i386/Kconfig.debug.org	2007-06-20 22:20:30.000000000 -0700
> +++ linux-2.6.22-rc5/arch/i386/Kconfig.debug	2007-06-20 22:20:55.000000000 -0700
> @@ -49,7 +49,6 @@ config DEBUG_PAGEALLOC
>  config DEBUG_RODATA
>  	bool "Write protect kernel read-only data structures"
>  	depends on DEBUG_KERNEL
> -	depends on !KPROBES # temporary for 2.6.22
>  	help
>  	  Mark the kernel read-only data as write-protected in the pagetables,
>  	  in order to catch accidental (and incorrect) writes to such const
> --- linux-2.6.22-rc5/arch/x86_64/Kconfig.debug.org	2007-06-20 22:20:28.000000000 -0700
> +++ linux-2.6.22-rc5/arch/x86_64/Kconfig.debug	2007-06-20 22:20:44.000000000 -0700
> @@ -9,7 +9,6 @@ source "lib/Kconfig.debug"
>  config DEBUG_RODATA
>         bool "Write protect kernel read-only data structures"
>         depends on DEBUG_KERNEL
> -       depends on !KPROBES # temporary for 2.6.22
>         help
>  	 Mark the kernel read-only data as write-protected in the pagetables,
>  	 in order to catch accidental (and incorrect) writes to such const data.
> --- linux-2.6.22-rc5/arch/i386/mm/init.c.org	2007-06-20 22:18:40.000000000 -0700
> +++ linux-2.6.22-rc5/arch/i386/mm/init.c	2007-06-20 22:19:45.000000000 -0700
> @@ -799,6 +799,7 @@ void mark_rodata_ro(void)
>  	unsigned long start = PFN_ALIGN(_text);
>  	unsigned long size = PFN_ALIGN(_etext) - start;
> 
> +#ifndef CONFIG_KPROBES
>  #ifdef CONFIG_HOTPLUG_CPU
>  	/* It must still be possible to apply SMP alternatives. */
>  	if (num_possible_cpus() <= 1)
> @@ -808,7 +809,7 @@ void mark_rodata_ro(void)
>  		                 size >> PAGE_SHIFT, PAGE_KERNEL_RX);
>  		printk("Write protecting the kernel text: %luk\n", size >> 10);
>  	}
> -
> +#endif
>  	start += size;
>  	size = (unsigned long)__end_rodata - start;
>  	change_page_attr(virt_to_page(start),
> --- linux-2.6.22-rc5/arch/x86_64/mm/init.c.org	2007-06-20 21:44:15.000000000 -0700
> +++ linux-2.6.22-rc5/arch/x86_64/mm/init.c	2007-06-20 22:17:45.000000000 -0700
> @@ -605,6 +605,11 @@ void mark_rodata_ro(void)
>  	if (num_possible_cpus() > 1)
>  		start = (unsigned long)_etext;
>  #endif
> +
> +#ifdef CONFIG_KPROBES
> +	start = (unsigned long)__start_rodata;
> +#endif
> +	
>  	end = (unsigned long)__end_rodata;
>  	start = (start + PAGE_SIZE - 1) & PAGE_MASK;
>  	end &= PAGE_MASK;
> 
> -- 
> if you want to mail me at work (you don't), use arjan (at) linux.intel.com
> Test the interaction between Linux and your BIOS via http://www.linuxfirmwarekit.org

-- 
Thanks & Regards
Prasanna S.P.
Linux Technology Center
India Software Labs, IBM Bangalore
Email: prasanna@in.ibm.com
Ph: 91-80-41776329

  reply	other threads:[~2007-06-21  7:11 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-17 14:23 [1/2] 2.6.22-rc5: known regressions with patches Michal Piotrowski
2007-06-17 15:16 ` Ingo Molnar
2007-06-17 15:31   ` Michal Piotrowski
2007-06-20 22:08 ` Ian McDonald
2007-06-20 22:31   ` Chuck Ebbert
2007-06-20 22:38     ` Ian McDonald
2007-06-20 22:41     ` Linus Torvalds
2007-06-20 22:38   ` Linus Torvalds
2007-06-20 22:41     ` Ian McDonald
2007-06-20 22:54       ` Linus Torvalds
2007-06-20 23:02         ` Ian McDonald
2007-06-20 23:04         ` Linus Torvalds
2007-06-21 15:46           ` Chuck Ebbert
2007-06-20 23:07     ` Dave Jones
2007-06-20 23:15       ` Arjan van de Ven
2007-06-20 23:24         ` Dave Jones
2007-06-20 23:48       ` Linus Torvalds
2007-06-21  9:19         ` [PATCH] Alternative fix for kprobes&DEBUG_RODATA was " Andi Kleen
2007-06-21 16:03           ` Linus Torvalds
2007-06-20 23:21     ` Arjan van de Ven
2007-06-20 23:50       ` Linus Torvalds
2007-06-21  5:23         ` Arjan van de Ven
2007-06-21  7:11           ` S. P. Prasanna [this message]
2007-06-21 14:35           ` Stefan Richter
2007-06-21 14:36             ` 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=20070621071125.GA6615@in.ibm.com \
    --to=prasanna@in.ibm.com \
    --cc=B.Steinbrink@gmx.de \
    --cc=adaplas@gmail.com \
    --cc=ak@suse.de \
    --cc=akpm@linux-foundation.org \
    --cc=arjan@infradead.org \
    --cc=djwong@us.ibm.com \
    --cc=ian.mcdonald@jandi.co.nz \
    --cc=kernel@nn7.de \
    --cc=khali@linux-fr.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michal.k.k.piotrowski@gmail.com \
    --cc=miklos@szeredi.hu \
    --cc=mingo@elte.hu \
    --cc=olaf@aepfle.de \
    --cc=r.marek@assembler.cz \
    --cc=syrjala@sci.fi \
    --cc=torvalds@linux-foundation.org \
    --cc=wcohen@redhat.com \
    /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