aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobin Getz <rgetz@blackfin.uclinux.org>2008-02-06 04:36:26 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2008-02-06 13:41:01 -0500
commita3b81113fb6658629f4ebaabf8dd3067cd341020 (patch)
treec6823e84d410f18b110ce07726643d7dc841553d
parent0a5dcb51770be3cd0202d6b90a07996fb40130b6 (diff)
remove support for un-needed _extratext section
When passing a zero address to kallsyms_lookup(), the kernel thought it was a valid kernel address, even if it is not. This is because is_ksym_addr() called is_kernel_extratext() and checked against labels that don't exist on many archs (which default as zero). Since PPC was the only kernel which defines _extra_text, (in 2005), and no longer needs it, this patch removes _extra_text support. For some history (provided by Jon): http://ozlabs.org/pipermail/linuxppc-dev/2005-September/019734.html http://ozlabs.org/pipermail/linuxppc-dev/2005-September/019736.html http://ozlabs.org/pipermail/linuxppc-dev/2005-September/019751.html [akpm@linux-foundation.org: coding-style fixes] Signed-off-by: Robin Getz <rgetz@blackfin.uclinux.org> Cc: David Woodhouse <dwmw2@infradead.org> Cc: Jon Loeliger <jdl@freescale.com> Cc: Paul Mackerras <paulus@samba.org> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Sam Ravnborg <sam@ravnborg.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--arch/ppc/kernel/vmlinux.lds.S5
-rw-r--r--include/asm-generic/sections.h2
-rw-r--r--kernel/kallsyms.c11
-rw-r--r--scripts/kallsyms.c24
4 files changed, 11 insertions, 31 deletions
diff --git a/arch/ppc/kernel/vmlinux.lds.S b/arch/ppc/kernel/vmlinux.lds.S
index 52b64fcbdfc5..8a24bc47eb6c 100644
--- a/arch/ppc/kernel/vmlinux.lds.S
+++ b/arch/ppc/kernel/vmlinux.lds.S
@@ -143,11 +143,6 @@ SECTIONS
143 143
144 . = ALIGN(4096); 144 . = ALIGN(4096);
145 __init_end = .; 145 __init_end = .;
146
147 . = ALIGN(4096);
148 _sextratext = .;
149 _eextratext = .;
150
151 __bss_start = .; 146 __bss_start = .;
152 .bss : 147 .bss :
153 { 148 {
diff --git a/include/asm-generic/sections.h b/include/asm-generic/sections.h
index 962cad7cfbbd..8feeae1f2369 100644
--- a/include/asm-generic/sections.h
+++ b/include/asm-generic/sections.h
@@ -8,8 +8,6 @@ extern char _data[], _sdata[], _edata[];
8extern char __bss_start[], __bss_stop[]; 8extern char __bss_start[], __bss_stop[];
9extern char __init_begin[], __init_end[]; 9extern char __init_begin[], __init_end[];
10extern char _sinittext[], _einittext[]; 10extern char _sinittext[], _einittext[];
11extern char _sextratext[] __attribute__((weak));
12extern char _eextratext[] __attribute__((weak));
13extern char _end[]; 11extern char _end[];
14extern char __per_cpu_start[], __per_cpu_end[]; 12extern char __per_cpu_start[], __per_cpu_end[];
15extern char __kprobes_text_start[], __kprobes_text_end[]; 13extern char __kprobes_text_start[], __kprobes_text_end[];
diff --git a/kernel/kallsyms.c b/kernel/kallsyms.c
index 7dadc71ce516..f091d13def00 100644
--- a/kernel/kallsyms.c
+++ b/kernel/kallsyms.c
@@ -53,14 +53,6 @@ static inline int is_kernel_inittext(unsigned long addr)
53 return 0; 53 return 0;
54} 54}
55 55
56static inline int is_kernel_extratext(unsigned long addr)
57{
58 if (addr >= (unsigned long)_sextratext
59 && addr <= (unsigned long)_eextratext)
60 return 1;
61 return 0;
62}
63
64static inline int is_kernel_text(unsigned long addr) 56static inline int is_kernel_text(unsigned long addr)
65{ 57{
66 if (addr >= (unsigned long)_stext && addr <= (unsigned long)_etext) 58 if (addr >= (unsigned long)_stext && addr <= (unsigned long)_etext)
@@ -80,8 +72,7 @@ static int is_ksym_addr(unsigned long addr)
80 if (all_var) 72 if (all_var)
81 return is_kernel(addr); 73 return is_kernel(addr);
82 74
83 return is_kernel_text(addr) || is_kernel_inittext(addr) || 75 return is_kernel_text(addr) || is_kernel_inittext(addr);
84 is_kernel_extratext(addr);
85} 76}
86 77
87/* expand a compressed symbol data into the resulting uncompressed string, 78/* expand a compressed symbol data into the resulting uncompressed string,
diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c
index 1f11d848532a..8fb87003d5d3 100644
--- a/scripts/kallsyms.c
+++ b/scripts/kallsyms.c
@@ -41,7 +41,7 @@ struct sym_entry {
41 41
42static struct sym_entry *table; 42static struct sym_entry *table;
43static unsigned int table_size, table_cnt; 43static unsigned int table_size, table_cnt;
44static unsigned long long _text, _stext, _etext, _sinittext, _einittext, _sextratext, _eextratext; 44static unsigned long long _text, _stext, _etext, _sinittext, _einittext;
45static int all_symbols = 0; 45static int all_symbols = 0;
46static char symbol_prefix_char = '\0'; 46static char symbol_prefix_char = '\0';
47 47
@@ -99,10 +99,6 @@ static int read_symbol(FILE *in, struct sym_entry *s)
99 _sinittext = s->addr; 99 _sinittext = s->addr;
100 else if (strcmp(sym, "_einittext") == 0) 100 else if (strcmp(sym, "_einittext") == 0)
101 _einittext = s->addr; 101 _einittext = s->addr;
102 else if (strcmp(sym, "_sextratext") == 0)
103 _sextratext = s->addr;
104 else if (strcmp(sym, "_eextratext") == 0)
105 _eextratext = s->addr;
106 else if (toupper(stype) == 'A') 102 else if (toupper(stype) == 'A')
107 { 103 {
108 /* Keep these useful absolute symbols */ 104 /* Keep these useful absolute symbols */
@@ -165,18 +161,18 @@ static int symbol_valid(struct sym_entry *s)
165 * and inittext sections are discarded */ 161 * and inittext sections are discarded */
166 if (!all_symbols) { 162 if (!all_symbols) {
167 if ((s->addr < _stext || s->addr > _etext) 163 if ((s->addr < _stext || s->addr > _etext)
168 && (s->addr < _sinittext || s->addr > _einittext) 164 && (s->addr < _sinittext || s->addr > _einittext))
169 && (s->addr < _sextratext || s->addr > _eextratext))
170 return 0; 165 return 0;
171 /* Corner case. Discard any symbols with the same value as 166 /* Corner case. Discard any symbols with the same value as
172 * _etext _einittext or _eextratext; they can move between pass 167 * _etext _einittext; they can move between pass 1 and 2 when
173 * 1 and 2 when the kallsyms data are added. If these symbols 168 * the kallsyms data are added. If these symbols move then
174 * move then they may get dropped in pass 2, which breaks the 169 * they may get dropped in pass 2, which breaks the kallsyms
175 * kallsyms rules. 170 * rules.
176 */ 171 */
177 if ((s->addr == _etext && strcmp((char*)s->sym + offset, "_etext")) || 172 if ((s->addr == _etext &&
178 (s->addr == _einittext && strcmp((char*)s->sym + offset, "_einittext")) || 173 strcmp((char *)s->sym + offset, "_etext")) ||
179 (s->addr == _eextratext && strcmp((char*)s->sym + offset, "_eextratext"))) 174 (s->addr == _einittext &&
175 strcmp((char *)s->sym + offset, "_einittext")))
180 return 0; 176 return 0;
181 } 177 }
182 178