diff options
author | Helge Deller <deller@parisc-linux.org> | 2006-01-13 15:21:06 -0500 |
---|---|---|
committer | Kyle McMartin <kyle@duet.int.mcmartin.ca> | 2006-01-22 20:26:54 -0500 |
commit | 1bcdd8548286743e1d6b3d53c96a90c6da975620 (patch) | |
tree | b244aa416992bbd06c4153ec2c97022629826ef2 /arch/parisc/mm/init.c | |
parent | a2bb214dcd1db862fdb6421e21f1cff0c3535162 (diff) |
[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/init.c')
-rw-r--r-- | arch/parisc/mm/init.c | 15 |
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) | |||
417 | #endif | 417 | #endif |
418 | } | 418 | } |
419 | 419 | ||
420 | |||
421 | #ifdef CONFIG_DEBUG_RODATA | ||
422 | void mark_rodata_ro(void) | ||
423 | { | ||
424 | extern char __start_rodata, __end_rodata; | ||
425 | /* rodata memory was already mapped with KERNEL_RO access rights by | ||
426 | pagetable_init() and map_pages(). No need to do additional stuff here */ | ||
427 | printk (KERN_INFO "Write protecting the kernel read-only data: %luk\n", | ||
428 | (unsigned long)(&__end_rodata - &__start_rodata) >> 10); | ||
429 | } | ||
430 | #endif | ||
431 | |||
432 | |||
420 | /* | 433 | /* |
421 | * Just an arbitrary offset to serve as a "hole" between mapping areas | 434 | * Just an arbitrary offset to serve as a "hole" between mapping areas |
422 | * (between top of physical memory and a potential pcxl dma mapping | 435 | * (between top of physical memory and a potential pcxl dma mapping |
@@ -685,7 +698,7 @@ static void __init pagetable_init(void) | |||
685 | 698 | ||
686 | #ifdef CONFIG_BLK_DEV_INITRD | 699 | #ifdef CONFIG_BLK_DEV_INITRD |
687 | if (initrd_end && initrd_end > mem_limit) { | 700 | if (initrd_end && initrd_end > mem_limit) { |
688 | printk("initrd: mapping %08lx-%08lx\n", initrd_start, initrd_end); | 701 | printk(KERN_INFO "initrd: mapping %08lx-%08lx\n", initrd_start, initrd_end); |
689 | map_pages(initrd_start, __pa(initrd_start), | 702 | map_pages(initrd_start, __pa(initrd_start), |
690 | initrd_end - initrd_start, PAGE_KERNEL); | 703 | initrd_end - initrd_start, PAGE_KERNEL); |
691 | } | 704 | } |