diff options
author | Arjan van de Ven <arjan@infradead.org> | 2006-01-06 03:12:01 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-01-06 11:33:36 -0500 |
commit | 37b73c828185731f6236a6387c02d7b08c150810 (patch) | |
tree | 312b9f082f78072aba62ee2230e417928156873e | |
parent | d89c145c0344fe2180336af6a309a59a8bc8c1c0 (diff) |
[PATCH] x86/x86_64: mark rodata section read only: generic infrastructure
Generic prep-work for marking the .rodata section readonly:
* Align the rodata section at 4Kb boundary
* call the mark_rodata_ro() function when available
Signed-off-by: Arjan van de Ven <arjan@infradead.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Adrian Bunk <bunk@stusta.de>
Cc: Andi Kleen <ak@muc.de>
Signed-off-by: Jesper Juhl <jesper.juhl@gmail.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r-- | include/asm-generic/vmlinux.lds.h | 4 | ||||
-rw-r--r-- | init/main.c | 5 |
2 files changed, 9 insertions, 0 deletions
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h index 094d4917c1a9..35de20cf8fac 100644 --- a/include/asm-generic/vmlinux.lds.h +++ b/include/asm-generic/vmlinux.lds.h | |||
@@ -10,6 +10,8 @@ | |||
10 | #define ALIGN_FUNCTION() . = ALIGN(8) | 10 | #define ALIGN_FUNCTION() . = ALIGN(8) |
11 | 11 | ||
12 | #define RODATA \ | 12 | #define RODATA \ |
13 | . = ALIGN(4096); \ | ||
14 | __start_rodata = .; \ | ||
13 | .rodata : AT(ADDR(.rodata) - LOAD_OFFSET) { \ | 15 | .rodata : AT(ADDR(.rodata) - LOAD_OFFSET) { \ |
14 | *(.rodata) *(.rodata.*) \ | 16 | *(.rodata) *(.rodata.*) \ |
15 | *(__vermagic) /* Kernel version magic */ \ | 17 | *(__vermagic) /* Kernel version magic */ \ |
@@ -74,6 +76,8 @@ | |||
74 | __ksymtab_strings : AT(ADDR(__ksymtab_strings) - LOAD_OFFSET) { \ | 76 | __ksymtab_strings : AT(ADDR(__ksymtab_strings) - LOAD_OFFSET) { \ |
75 | *(__ksymtab_strings) \ | 77 | *(__ksymtab_strings) \ |
76 | } \ | 78 | } \ |
79 | __end_rodata = .; \ | ||
80 | . = ALIGN(4096); \ | ||
77 | \ | 81 | \ |
78 | /* Built-in module parameters. */ \ | 82 | /* Built-in module parameters. */ \ |
79 | __param : AT(ADDR(__param) - LOAD_OFFSET) { \ | 83 | __param : AT(ADDR(__param) - LOAD_OFFSET) { \ |
diff --git a/init/main.c b/init/main.c index 54aaf561cf66..2ed3638deec7 100644 --- a/init/main.c +++ b/init/main.c | |||
@@ -52,6 +52,7 @@ | |||
52 | #include <asm/bugs.h> | 52 | #include <asm/bugs.h> |
53 | #include <asm/setup.h> | 53 | #include <asm/setup.h> |
54 | #include <asm/sections.h> | 54 | #include <asm/sections.h> |
55 | #include <asm/cacheflush.h> | ||
55 | 56 | ||
56 | /* | 57 | /* |
57 | * This is one of the first .c files built. Error out early | 58 | * This is one of the first .c files built. Error out early |
@@ -99,6 +100,9 @@ extern void acpi_early_init(void); | |||
99 | #else | 100 | #else |
100 | static inline void acpi_early_init(void) { } | 101 | static inline void acpi_early_init(void) { } |
101 | #endif | 102 | #endif |
103 | #ifndef CONFIG_DEBUG_RODATA | ||
104 | static inline void mark_rodata_ro(void) { } | ||
105 | #endif | ||
102 | 106 | ||
103 | #ifdef CONFIG_TC | 107 | #ifdef CONFIG_TC |
104 | extern void tc_init(void); | 108 | extern void tc_init(void); |
@@ -708,6 +712,7 @@ static int init(void * unused) | |||
708 | */ | 712 | */ |
709 | free_initmem(); | 713 | free_initmem(); |
710 | unlock_kernel(); | 714 | unlock_kernel(); |
715 | mark_rodata_ro(); | ||
711 | system_state = SYSTEM_RUNNING; | 716 | system_state = SYSTEM_RUNNING; |
712 | numa_default_policy(); | 717 | numa_default_policy(); |
713 | 718 | ||