aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Rostedt <rostedt@goodmis.org>2011-05-19 21:34:58 -0400
committerIngo Molnar <mingo@elte.hu>2011-05-20 02:56:56 -0400
commita2d063ac216c1618bfc2b4d40b7176adffa63511 (patch)
tree499d4cc67e296cb8b51f51215a49407c440c4690
parentc16dbd54a3fe126b539a0ef149d80221c667bbd5 (diff)
extable, core_kernel_data(): Make sure all archs define _sdata
A new utility function (core_kernel_data()) is used to determine if a passed in address is part of core kernel data or not. It may or may not return true for RO data, but this utility must work for RW data. Thus both _sdata and _edata must be defined and continuous, without .init sections that may later be freed and replaced by volatile memory (memory that can be freed). This utility function is used to determine if data is safe from ever being freed. Thus it should return true for all RW global data that is not in a module or has been allocated, or false otherwise. Also change core_kernel_data() back to the more precise _sdata condition and document the function. Signed-off-by: Steven Rostedt <rostedt@goodmis.org> Acked-by: Ralf Baechle <ralf@linux-mips.org> Acked-by: Hirokazu Takata <takata@linux-m32r.org> Cc: Richard Henderson <rth@twiddle.net> Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru> Cc: Matt Turner <mattst88@gmail.com> Cc: Geert Uytterhoeven <geert@linux-m68k.org> Cc: Roman Zippel <zippel@linux-m68k.org> Cc: linux-m68k@lists.linux-m68k.org Cc: Kyle McMartin <kyle@mcmartin.ca> Cc: Helge Deller <deller@gmx.de> Cc: JamesE.J.Bottomley <jejb@parisc-linux.org> Link: http://lkml.kernel.org/r/1305855298.1465.19.camel@gandalf.stny.rr.com Signed-off-by: Ingo Molnar <mingo@elte.hu> ---- arch/alpha/kernel/vmlinux.lds.S | 1 + arch/m32r/kernel/vmlinux.lds.S | 1 + arch/m68k/kernel/vmlinux-std.lds | 2 ++ arch/m68k/kernel/vmlinux-sun3.lds | 1 + arch/mips/kernel/vmlinux.lds.S | 1 + arch/parisc/kernel/vmlinux.lds.S | 3 +++ kernel/extable.c | 12 +++++++++++- 7 files changed, 20 insertions(+), 1 deletion(-)
-rw-r--r--arch/alpha/kernel/vmlinux.lds.S1
-rw-r--r--arch/m32r/kernel/vmlinux.lds.S1
-rw-r--r--arch/m68k/kernel/vmlinux-std.lds2
-rw-r--r--arch/m68k/kernel/vmlinux-sun3.lds1
-rw-r--r--arch/mips/kernel/vmlinux.lds.S1
-rw-r--r--arch/parisc/kernel/vmlinux.lds.S3
-rw-r--r--kernel/extable.c12
7 files changed, 20 insertions, 1 deletions
diff --git a/arch/alpha/kernel/vmlinux.lds.S b/arch/alpha/kernel/vmlinux.lds.S
index 433be2a24f31..3d890a98a08b 100644
--- a/arch/alpha/kernel/vmlinux.lds.S
+++ b/arch/alpha/kernel/vmlinux.lds.S
@@ -46,6 +46,7 @@ SECTIONS
46 __init_end = .; 46 __init_end = .;
47 /* Freed after init ends here */ 47 /* Freed after init ends here */
48 48
49 _sdata = .; /* Start of rw data section */
49 _data = .; 50 _data = .;
50 RW_DATA_SECTION(L1_CACHE_BYTES, PAGE_SIZE, THREAD_SIZE) 51 RW_DATA_SECTION(L1_CACHE_BYTES, PAGE_SIZE, THREAD_SIZE)
51 52
diff --git a/arch/m32r/kernel/vmlinux.lds.S b/arch/m32r/kernel/vmlinux.lds.S
index c194d64cdbb9..cf95aec77460 100644
--- a/arch/m32r/kernel/vmlinux.lds.S
+++ b/arch/m32r/kernel/vmlinux.lds.S
@@ -44,6 +44,7 @@ SECTIONS
44 EXCEPTION_TABLE(16) 44 EXCEPTION_TABLE(16)
45 NOTES 45 NOTES
46 46
47 _sdata = .; /* Start of data section */
47 RODATA 48 RODATA
48 RW_DATA_SECTION(32, PAGE_SIZE, THREAD_SIZE) 49 RW_DATA_SECTION(32, PAGE_SIZE, THREAD_SIZE)
49 _edata = .; /* End of data section */ 50 _edata = .; /* End of data section */
diff --git a/arch/m68k/kernel/vmlinux-std.lds b/arch/m68k/kernel/vmlinux-std.lds
index 878be5f38cad..d0993594f558 100644
--- a/arch/m68k/kernel/vmlinux-std.lds
+++ b/arch/m68k/kernel/vmlinux-std.lds
@@ -25,6 +25,8 @@ SECTIONS
25 25
26 EXCEPTION_TABLE(16) 26 EXCEPTION_TABLE(16)
27 27
28 _sdata = .; /* Start of data section */
29
28 RODATA 30 RODATA
29 31
30 RW_DATA_SECTION(16, PAGE_SIZE, THREAD_SIZE) 32 RW_DATA_SECTION(16, PAGE_SIZE, THREAD_SIZE)
diff --git a/arch/m68k/kernel/vmlinux-sun3.lds b/arch/m68k/kernel/vmlinux-sun3.lds
index 1ad6b7ad2c17..8080469ee6c1 100644
--- a/arch/m68k/kernel/vmlinux-sun3.lds
+++ b/arch/m68k/kernel/vmlinux-sun3.lds
@@ -25,6 +25,7 @@ SECTIONS
25 _etext = .; /* End of text section */ 25 _etext = .; /* End of text section */
26 26
27 EXCEPTION_TABLE(16) :data 27 EXCEPTION_TABLE(16) :data
28 _sdata = .; /* Start of rw data section */
28 RW_DATA_SECTION(16, PAGE_SIZE, THREAD_SIZE) :data 29 RW_DATA_SECTION(16, PAGE_SIZE, THREAD_SIZE) :data
29 /* End of data goes *here* so that freeing init code works properly. */ 30 /* End of data goes *here* so that freeing init code works properly. */
30 _edata = .; 31 _edata = .;
diff --git a/arch/mips/kernel/vmlinux.lds.S b/arch/mips/kernel/vmlinux.lds.S
index cd2ca544454b..01af3876cf90 100644
--- a/arch/mips/kernel/vmlinux.lds.S
+++ b/arch/mips/kernel/vmlinux.lds.S
@@ -65,6 +65,7 @@ SECTIONS
65 NOTES :text :note 65 NOTES :text :note
66 .dummy : { *(.dummy) } :text 66 .dummy : { *(.dummy) } :text
67 67
68 _sdata = .; /* Start of data section */
68 RODATA 69 RODATA
69 70
70 /* writeable */ 71 /* writeable */
diff --git a/arch/parisc/kernel/vmlinux.lds.S b/arch/parisc/kernel/vmlinux.lds.S
index 8f1e4efd143e..2d9a5c7c76f5 100644
--- a/arch/parisc/kernel/vmlinux.lds.S
+++ b/arch/parisc/kernel/vmlinux.lds.S
@@ -69,6 +69,9 @@ SECTIONS
69 /* End of text section */ 69 /* End of text section */
70 _etext = .; 70 _etext = .;
71 71
72 /* Start of data section */
73 _sdata = .;
74
72 RODATA 75 RODATA
73 76
74 /* writeable */ 77 /* writeable */
diff --git a/kernel/extable.c b/kernel/extable.c
index d44aac0c3faa..5339705b8241 100644
--- a/kernel/extable.c
+++ b/kernel/extable.c
@@ -72,9 +72,19 @@ int core_kernel_text(unsigned long addr)
72 return 0; 72 return 0;
73} 73}
74 74
75/**
76 * core_kernel_data - tell if addr points to kernel data
77 * @addr: address to test
78 *
79 * Returns true if @addr passed in is from the core kernel data
80 * section.
81 *
82 * Note: On some archs it may return true for core RODATA, and false
83 * for others. But will always be true for core RW data.
84 */
75int core_kernel_data(unsigned long addr) 85int core_kernel_data(unsigned long addr)
76{ 86{
77 if (addr >= (unsigned long)_stext && 87 if (addr >= (unsigned long)_sdata &&
78 addr < (unsigned long)_edata) 88 addr < (unsigned long)_edata)
79 return 1; 89 return 1;
80 return 0; 90 return 0;