summary refs log tree commit diff
path: root/arch/parisc/mm
diff options
context:
space:
mode:
authorHelge Deller <deller@parisc-linux.org>2006-01-13 13:21:06 -0700
committerKyle McMartin <kyle@duet.int.mcmartin.ca>2006-01-22 20:26:54 -0500
commit1bcdd8548286743e1d6b3d53c96a90c6da975620 (patch)
treeb244aa416992bbd06c4153ec2c97022629826ef2 /arch/parisc/mm
parenta2bb214dcd1db862fdb6421e21f1cff0c3535162 (diff)
downloadlinux-1bcdd8548286743e1d6b3d53c96a90c6da975620.tar.gz
[PARISC] Add CONFIG_DEBUG_RODATA to protect read-only data
Add the parisc version of the "mark rodata section read only" patches.
Based on code from and Signed-off-by Arjan van de Ven
<arjan@infradead.org>, Ingo Molnar <mingo@elte.hu>, Andi Kleen <ak@muc.de>,
Andrew Morton <akpm@osdl.org>, Linus Torvalds <torvalds@osdl.org>.

Signed-off-by: Helge Deller <deller@parisc-linux.org>
Signed-off-by: Kyle McMartin <kyle@parisc-linux.org>
Diffstat (limited to 'arch/parisc/mm')
-rw-r--r--arch/parisc/mm/init.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/arch/parisc/mm/init.c b/arch/parisc/mm/init.c
index 9999eb045238..6f36d0b17d9e 100644
--- a/arch/parisc/mm/init.c
+++ b/arch/parisc/mm/init.c
@@ -417,6 +417,19 @@ void free_initmem(void)
 #endif
 }
 
+
+#ifdef CONFIG_DEBUG_RODATA
+void mark_rodata_ro(void)
+{
+	extern char __start_rodata, __end_rodata;
+	/* rodata memory was already mapped with KERNEL_RO access rights by
+           pagetable_init() and map_pages(). No need to do additional stuff here */
+	printk (KERN_INFO "Write protecting the kernel read-only data: %luk\n",
+		(unsigned long)(&__end_rodata - &__start_rodata) >> 10);
+}
+#endif
+
+
 /*
  * Just an arbitrary offset to serve as a "hole" between mapping areas
  * (between top of physical memory and a potential pcxl dma mapping
@@ -685,7 +698,7 @@ static void __init pagetable_init(void)
 
 #ifdef CONFIG_BLK_DEV_INITRD
 	if (initrd_end && initrd_end > mem_limit) {
-		printk("initrd: mapping %08lx-%08lx\n", initrd_start, initrd_end);
+		printk(KERN_INFO "initrd: mapping %08lx-%08lx\n", initrd_start, initrd_end);
 		map_pages(initrd_start, __pa(initrd_start),
 			initrd_end - initrd_start, PAGE_KERNEL);
 	}