From: Andi Kleen <ak@suse.de>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Dave Jones <davej@redhat.com>,
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>,
Bj?rn Steinbrink <B.Steinbrink@gmx.de>,
William Cohen <wcohen@redhat.com>,
"S. P. Prasanna" <prasanna@in.ibm.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: [PATCH] Alternative fix for kprobes&DEBUG_RODATA was Re: [1/2] 2.6.22-rc5: known regressions with patches
Date: Thu, 21 Jun 2007 11:19:06 +0200 [thread overview]
Message-ID: <200706211119.07754.ak@suse.de> (raw)
In-Reply-To: <alpine.LFD.0.98.0706201647350.3593@woody.linux-foundation.org>
On Thursday 21 June 2007 01:48:43 Linus Torvalds wrote:
>
> On Wed, 20 Jun 2007, Dave Jones wrote:
> >
> > Surely the fundamental disagreement is only due to DEBUG_RODATA
> > covering write-protection of both .text, and .rodata ?
>
> I agree that we could well split DEBUG_RODATA into something more
> fine-grained, and for example have it _only_ protect that .rodata thing
> when Kprobes are enabled, and both .text _and_ .rodata when Kprobes are
> not.
>
> That would make lots of sense.
Ok, here's a patch to do this. With that 55181000cd60334fe920c65ffbcdfe0e3f1de406
should be reverted because it isn't needed anymore.
I still think in .23 it should be fixed properly, by either using c_p_a()
as needed in the kprobes/alternatives code (Prasanna already had a patch)
or perhaps better just doing a temporal ioremap() there.
-Andi
---
Disable kernel text protection when kprobes are enabled
To be done better in .23
Signed-off-by: Andi Kleen <ak@suse.de>
Index: linux/arch/x86_64/mm/init.c
===================================================================
--- linux.orig/arch/x86_64/mm/init.c
+++ linux/arch/x86_64/mm/init.c
@@ -600,6 +600,10 @@ void mark_rodata_ro(void)
{
unsigned long start = (unsigned long)_stext, end;
+#ifdef CONFIG_KPROBES
+ /* Kprobes code doesn't know yet how to unprotect. Temporary fix. */
+ start = (unsigned long)_etext;
+#endif
#ifdef CONFIG_HOTPLUG_CPU
/* It must still be possible to apply SMP alternatives. */
if (num_possible_cpus() > 1)
Index: linux/arch/i386/mm/init.c
===================================================================
--- linux.orig/arch/i386/mm/init.c
+++ linux/arch/i386/mm/init.c
@@ -798,12 +798,16 @@ void mark_rodata_ro(void)
{
unsigned long start = PFN_ALIGN(_text);
unsigned long size = PFN_ALIGN(_etext) - start;
+ int notext = 0;
+#ifdef CONFIG_KPROBES
+ notext = 1;
+#endif
#ifdef CONFIG_HOTPLUG_CPU
/* It must still be possible to apply SMP alternatives. */
- if (num_possible_cpus() <= 1)
+ notext = (num_possible_cpus() > 1);
#endif
- {
+ if (!notext) {
change_page_attr(virt_to_page(start),
size >> PAGE_SHIFT, PAGE_KERNEL_RX);
printk("Write protecting the kernel text: %luk\n", size >> 10);
next prev parent reply other threads:[~2007-06-21 9:20 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 ` Andi Kleen [this message]
2007-06-21 16:03 ` [PATCH] Alternative fix for kprobes&DEBUG_RODATA was " 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
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=200706211119.07754.ak@suse.de \
--to=ak@suse.de \
--cc=B.Steinbrink@gmx.de \
--cc=adaplas@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=davej@redhat.com \
--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=prasanna@in.ibm.com \
--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