Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=0864a4e201b1ea442f4c8b887418a29f67e24d30
Commit:     0864a4e201b1ea442f4c8b887418a29f67e24d30
Parent:     79d9a72f87d0a6f910be262a9dd4c36e96972a92
Author:     Arjan van de Ven <[EMAIL PROTECTED]>
AuthorDate: Wed Jun 20 22:23:21 2007 -0700
Committer:  Linus Torvalds <[EMAIL PROTECTED]>
CommitDate: Thu Jun 21 16:02:50 2007 -0700

    Allow DEBUG_RODATA and KPROBES to co-exist
    
    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 <[EMAIL PROTECTED]>
    Tested-by: S. P. Prasanna <[EMAIL PROTECTED]>
    Cc: Andi Kleen <[EMAIL PROTECTED]>
    Cc: William Cohen <[EMAIL PROTECTED]>
    Cc: Ian McDonald <[EMAIL PROTECTED]>
    Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
---
 arch/i386/Kconfig.debug   |    1 -
 arch/i386/mm/init.c       |    3 ++-
 arch/x86_64/Kconfig.debug |    1 -
 arch/x86_64/mm/init.c     |    5 +++++
 4 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/arch/i386/Kconfig.debug b/arch/i386/Kconfig.debug
index 6293920..b31c080 100644
--- a/arch/i386/Kconfig.debug
+++ b/arch/i386/Kconfig.debug
@@ -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
diff --git a/arch/i386/mm/init.c b/arch/i386/mm/init.c
index b22ce8d..7135946 100644
--- a/arch/i386/mm/init.c
+++ b/arch/i386/mm/init.c
@@ -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),
diff --git a/arch/x86_64/Kconfig.debug b/arch/x86_64/Kconfig.debug
index 8a86775..775d211 100644
--- a/arch/x86_64/Kconfig.debug
+++ b/arch/x86_64/Kconfig.debug
@@ -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.
diff --git a/arch/x86_64/mm/init.c b/arch/x86_64/mm/init.c
index efb6e84..9a0e98a 100644
--- a/arch/x86_64/mm/init.c
+++ b/arch/x86_64/mm/init.c
@@ -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;
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to