* [patch 2.6.15] Tell kallsyms_lookup_name() to ignore type U entries
@ 2006-01-06 5:36 Keith Owens
2006-01-06 15:18 ` Paulo Marques
0 siblings, 1 reply; 3+ messages in thread
From: Keith Owens @ 2006-01-06 5:36 UTC (permalink / raw)
To: linux-kernel
When one module exports a function symbol and another module uses that
symbol then kallsyms shows the symbol twice. Once from the consumer
with a type of 'U' and once from the provider with a type of 't' or
'T'. On most architectures, both entries have the same address so it
does not matter which one is returned by kallsyms_lookup_name(). But
on architectures with function descriptors, the 'U' entry points to the
descriptor, not to the code body, which is not what we want.
IA64 # grep -w qla2x00_remove_one /proc/kallsyms
a000000208c25ef8 U qla2x00_remove_one [qla2300] <= descriptor
a000000208bf44c0 t qla2x00_remove_one [qla2xxx] <= function body
Tell kallsyms_lookup_name() to ignore type U entries.
Signed-off-by: Keith Owens <kaos@sgi.com>
---
kallsyms.c | 6 ++++--
module.c | 3 ++-
2 files changed, 6 insertions(+), 3 deletions(-)
Index: linux/kernel/kallsyms.c
===================================================================
--- linux.orig/kernel/kallsyms.c 2006-01-06 12:58:52.842111488 +1100
+++ linux/kernel/kallsyms.c 2006-01-06 12:59:03.436355969 +1100
@@ -144,12 +144,14 @@ unsigned long kallsyms_lookup_name(const
{
char namebuf[KSYM_NAME_LEN+1];
unsigned long i;
- unsigned int off;
+ unsigned int off, prev_off;
for (i = 0, off = 0; i < kallsyms_num_syms; i++) {
+ prev_off = off;
off = kallsyms_expand_symbol(off, namebuf);
- if (strcmp(namebuf, name) == 0)
+ if (strcmp(namebuf, name) == 0 &&
+ kallsyms_get_symbol_type(prev_off) != 'U')
return kallsyms_addresses[i];
}
return module_kallsyms_lookup_name(name);
Index: linux/kernel/module.c
===================================================================
--- linux.orig/kernel/module.c 2006-01-06 12:58:52.841135060 +1100
+++ linux/kernel/module.c 2006-01-06 12:59:03.438308825 +1100
@@ -2050,7 +2050,8 @@ static unsigned long mod_find_symname(st
unsigned int i;
for (i = 0; i < mod->num_symtab; i++)
- if (strcmp(name, mod->strtab+mod->symtab[i].st_name) == 0)
+ if (strcmp(name, mod->strtab+mod->symtab[i].st_name) == 0 &&
+ mod->symtab[i].st_info != 'U')
return mod->symtab[i].st_value;
return 0;
}
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [patch 2.6.15] Tell kallsyms_lookup_name() to ignore type U entries
2006-01-06 5:36 [patch 2.6.15] Tell kallsyms_lookup_name() to ignore type U entries Keith Owens
@ 2006-01-06 15:18 ` Paulo Marques
2006-01-08 3:10 ` [patch 2.6.15 v2] " Keith Owens
0 siblings, 1 reply; 3+ messages in thread
From: Paulo Marques @ 2006-01-06 15:18 UTC (permalink / raw)
To: Keith Owens; +Cc: linux-kernel
Keith Owens wrote:
> When one module exports a function symbol and another module uses that
> symbol then kallsyms shows the symbol twice. Once from the consumer
> with a type of 'U' and once from the provider with a type of 't' or
> 'T'. On most architectures, both entries have the same address so it
> does not matter which one is returned by kallsyms_lookup_name(). But
> on architectures with function descriptors, the 'U' entry points to the
> descriptor, not to the code body, which is not what we want.
>
> IA64 # grep -w qla2x00_remove_one /proc/kallsyms
> a000000208c25ef8 U qla2x00_remove_one [qla2300] <= descriptor
> a000000208bf44c0 t qla2x00_remove_one [qla2xxx] <= function body
>
> [...]
> --- linux.orig/kernel/kallsyms.c 2006-01-06 12:58:52.842111488 +1100
> +++ linux/kernel/kallsyms.c 2006-01-06 12:59:03.436355969 +1100
> @@ -144,12 +144,14 @@ unsigned long kallsyms_lookup_name(const
> {
> char namebuf[KSYM_NAME_LEN+1];
> unsigned long i;
> - unsigned int off;
> + unsigned int off, prev_off;
>
> for (i = 0, off = 0; i < kallsyms_num_syms; i++) {
> + prev_off = off;
> off = kallsyms_expand_symbol(off, namebuf);
>
> - if (strcmp(namebuf, name) == 0)
> + if (strcmp(namebuf, name) == 0 &&
> + kallsyms_get_symbol_type(prev_off) != 'U')
This check should not be needed as it is already done in
scripts/kallsyms.c so that these symbols don't end up in the kernel
symbol table at all.
It seems that only symbols from modules can suffer from this problem,
but maybe I'm missing something here...
--
Paulo Marques - www.grupopie.com
Pointy-Haired Boss: I don't see anything that could stand in our way.
Dilbert: Sanity? Reality? The laws of physics?
^ permalink raw reply [flat|nested] 3+ messages in thread
* [patch 2.6.15 v2] Tell kallsyms_lookup_name() to ignore type U entries
2006-01-06 15:18 ` Paulo Marques
@ 2006-01-08 3:10 ` Keith Owens
0 siblings, 0 replies; 3+ messages in thread
From: Keith Owens @ 2006-01-08 3:10 UTC (permalink / raw)
To: linux-kernel; +Cc: Paulo Marques
When one module exports a function symbol and another module uses that
symbol then kallsyms shows the symbol twice. Once from the consumer
with a type of 'U' and once from the provider with a type of 't' or
'T'. On most architectures, both entries have the same address so it
does not matter which one is returned by kallsyms_lookup_name(). But
on architectures with function descriptors, the 'U' entry points to the
descriptor, not to the code body, which is not what we want.
IA64 # grep -w qla2x00_remove_one /proc/kallsyms
a000000208c25ef8 U qla2x00_remove_one [qla2300] <= descriptor
a000000208bf44c0 t qla2x00_remove_one [qla2xxx] <= function body
Tell kallsyms_lookup_name() to ignore type U entries in modules.
Signed-off-by: Keith Owens <kaos@sgi.com>
---
module.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
Index: linux/kernel/module.c
===================================================================
--- linux.orig/kernel/module.c 2006-01-06 12:58:52.841135060 +1100
+++ linux/kernel/module.c 2006-01-06 12:59:03.438308825 +1100
@@ -2050,7 +2050,8 @@ static unsigned long mod_find_symname(st
unsigned int i;
for (i = 0; i < mod->num_symtab; i++)
- if (strcmp(name, mod->strtab+mod->symtab[i].st_name) == 0)
+ if (strcmp(name, mod->strtab+mod->symtab[i].st_name) == 0 &&
+ mod->symtab[i].st_info != 'U')
return mod->symtab[i].st_value;
return 0;
}
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2006-01-08 3:10 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-01-06 5:36 [patch 2.6.15] Tell kallsyms_lookup_name() to ignore type U entries Keith Owens
2006-01-06 15:18 ` Paulo Marques
2006-01-08 3:10 ` [patch 2.6.15 v2] " Keith Owens
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®