Commit a8b9e8d7 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] fix for kallsyms module symbol resolution problem

From:  Rusty Russell <rusty@rustcorp.com.au>

Fix a problem with kallsyms being unable to look up symbols which are in
modules.

add_kallsyms should be above module_finalize, which means you can just use
the mod->symtab and mod->strtab members.
parent bffb0b0a
......@@ -1243,7 +1243,15 @@ static void add_kallsyms(struct module *mod,
mod->symtab[i].st_info
= elf_type(&mod->symtab[i], sechdrs, secstrings, mod);
}
#endif
#else
static inline void add_kallsyms(struct module *mod,
Elf_Shdr *sechdrs,
unsigned int symindex,
unsigned int strindex,
const char *secstrings)
{
}
#endif /* CONFIG_KALLSYMS */
/* Allocate and load the module: note that size of section 0 is always
zero, and we rely on this for optional sections. */
......@@ -1516,14 +1524,12 @@ static struct module *load_module(void __user *umod,
percpu_modcopy(mod->percpu, (void *)sechdrs[pcpuindex].sh_addr,
sechdrs[pcpuindex].sh_size);
add_kallsyms(mod, sechdrs, symindex, strindex, secstrings);
err = module_finalize(hdr, sechdrs, mod);
if (err < 0)
goto cleanup;
#ifdef CONFIG_KALLSYMS
add_kallsyms(mod, sechdrs, symindex, strindex, secstrings);
#endif
mod->args = args;
if (obsparmindex) {
err = obsolete_params(mod->name, mod->args,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment