From 0864a4e201b1ea442f4c8b887418a29f67e24d30 Mon Sep 17 00:00:00 2001 From: Arjan van de Ven Date: Wed, 20 Jun 2007 22:23:21 -0700 Subject: 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 Tested-by: S. P. Prasanna Cc: Andi Kleen Cc: William Cohen Cc: Ian McDonald Signed-off-by: Linus Torvalds --- arch/i386/Kconfig.debug | 1 - arch/i386/mm/init.c | 3 ++- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'arch/i386') diff --git a/arch/i386/Kconfig.debug b/arch/i386/Kconfig.debug index 6293920cd1b..b31c0802e1c 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 b22ce8d6b1b..7135946d366 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), -- cgit v1.2.3