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

[PATCH] Fix __down Tainting Kernel with CONFIG_MODVERSIONS=y

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

PowerPC64 ABI has ".funcname" (the actual function) and "funcname" (the
function descriptor) and we strip off the dots in "dedotify" called from
module_frob_arch_sections().  We need to also de-dotify the corresponding
names in the __version section.

Actually has nothing to do with __down, it's just that we only print the
first symbol whose version is missing.
parent 5a3e2446
...@@ -138,6 +138,16 @@ static unsigned long get_stubs_size(const Elf64_Ehdr *hdr, ...@@ -138,6 +138,16 @@ static unsigned long get_stubs_size(const Elf64_Ehdr *hdr,
return relocs * sizeof(struct ppc64_stub_entry); return relocs * sizeof(struct ppc64_stub_entry);
} }
static void dedotify_versions(struct modversion_info *vers,
unsigned long size)
{
struct modversion_info *end;
for (end = (void *)vers + size; vers < end; vers++)
if (vers->name[0] == '.')
memmove(vers->name, vers->name+1, strlen(vers->name));
}
/* Undefined symbols which refer to .funcname, hack to funcname */ /* Undefined symbols which refer to .funcname, hack to funcname */
static void dedotify(Elf64_Sym *syms, unsigned int numsyms, char *strtab) static void dedotify(Elf64_Sym *syms, unsigned int numsyms, char *strtab)
{ {
...@@ -166,6 +176,9 @@ int module_frob_arch_sections(Elf64_Ehdr *hdr, ...@@ -166,6 +176,9 @@ int module_frob_arch_sections(Elf64_Ehdr *hdr,
me->arch.stubs_section = i; me->arch.stubs_section = i;
else if (strcmp(secstrings + sechdrs[i].sh_name, ".toc") == 0) else if (strcmp(secstrings + sechdrs[i].sh_name, ".toc") == 0)
me->arch.toc_section = i; me->arch.toc_section = i;
else if (strcmp(secstrings+sechdrs[i].sh_name,"__versions")==0)
dedotify_versions((void *)hdr + sechdrs[i].sh_offset,
sechdrs[i].sh_size);
/* We don't handle .init for the moment: rename to _init */ /* We don't handle .init for the moment: rename to _init */
while ((p = strstr(secstrings + sechdrs[i].sh_name, ".init"))) while ((p = strstr(secstrings + sechdrs[i].sh_name, ".init")))
......
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