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>
This commit is contained in:
committed by
Linus Torvalds
parent
0a5dcb5177
commit
a3b81113fb
@@ -41,7 +41,7 @@ struct sym_entry {
|
||||
|
||||
static struct sym_entry *table;
|
||||
static unsigned int table_size, table_cnt;
|
||||
static unsigned long long _text, _stext, _etext, _sinittext, _einittext, _sextratext, _eextratext;
|
||||
static unsigned long long _text, _stext, _etext, _sinittext, _einittext;
|
||||
static int all_symbols = 0;
|
||||
static char symbol_prefix_char = '\0';
|
||||
|
||||
@@ -99,10 +99,6 @@ static int read_symbol(FILE *in, struct sym_entry *s)
|
||||
_sinittext = s->addr;
|
||||
else if (strcmp(sym, "_einittext") == 0)
|
||||
_einittext = s->addr;
|
||||
else if (strcmp(sym, "_sextratext") == 0)
|
||||
_sextratext = s->addr;
|
||||
else if (strcmp(sym, "_eextratext") == 0)
|
||||
_eextratext = s->addr;
|
||||
else if (toupper(stype) == 'A')
|
||||
{
|
||||
/* Keep these useful absolute symbols */
|
||||
@@ -165,18 +161,18 @@ static int symbol_valid(struct sym_entry *s)
|
||||
* and inittext sections are discarded */
|
||||
if (!all_symbols) {
|
||||
if ((s->addr < _stext || s->addr > _etext)
|
||||
&& (s->addr < _sinittext || s->addr > _einittext)
|
||||
&& (s->addr < _sextratext || s->addr > _eextratext))
|
||||
&& (s->addr < _sinittext || s->addr > _einittext))
|
||||
return 0;
|
||||
/* Corner case. Discard any symbols with the same value as
|
||||
* _etext _einittext or _eextratext; they can move between pass
|
||||
* 1 and 2 when the kallsyms data are added. If these symbols
|
||||
* move then they may get dropped in pass 2, which breaks the
|
||||
* kallsyms rules.
|
||||
* _etext _einittext; they can move between pass 1 and 2 when
|
||||
* the kallsyms data are added. If these symbols move then
|
||||
* they may get dropped in pass 2, which breaks the kallsyms
|
||||
* rules.
|
||||
*/
|
||||
if ((s->addr == _etext && strcmp((char*)s->sym + offset, "_etext")) ||
|
||||
(s->addr == _einittext && strcmp((char*)s->sym + offset, "_einittext")) ||
|
||||
(s->addr == _eextratext && strcmp((char*)s->sym + offset, "_eextratext")))
|
||||
if ((s->addr == _etext &&
|
||||
strcmp((char *)s->sym + offset, "_etext")) ||
|
||||
(s->addr == _einittext &&
|
||||
strcmp((char *)s->sym + offset, "_einittext")))
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user