Commit 2fe90be7 authored by Rusty Russell's avatar Rusty Russell Committed by Kai Germaschewski

kbuild: Modversions fixes

Fix the case where no CRCs are supplied (OK, but taints kernel), and
only print one tainted message (otherwise --force gives hundreds of them).
parent 46f08e8a
...@@ -737,12 +737,9 @@ static int check_version(Elf_Shdr *sechdrs, ...@@ -737,12 +737,9 @@ static int check_version(Elf_Shdr *sechdrs,
unsigned int i, num_versions; unsigned int i, num_versions;
struct modversion_info *versions; struct modversion_info *versions;
if (!ksg->crcs) { /* Exporting module didn't supply crcs? OK, we're already tainted. */
printk("%s: no CRC for \"%s\" [%s] found: kernel tainted.\n", if (!ksg->crcs)
mod->name, symname, return 1;
ksg->owner ? ksg->owner->name : "kernel");
goto taint;
}
crc = ksg->crcs[symidx]; crc = ksg->crcs[symidx];
...@@ -763,10 +760,11 @@ static int check_version(Elf_Shdr *sechdrs, ...@@ -763,10 +760,11 @@ static int check_version(Elf_Shdr *sechdrs,
return 0; return 0;
} }
/* Not in module's version table. OK, but that taints the kernel. */ /* Not in module's version table. OK, but that taints the kernel. */
printk("%s: no version for \"%s\" found: kernel tainted.\n", if (!(tainted & TAINT_FORCED_MODULE)) {
mod->name, symname); printk("%s: no version for \"%s\" found: kernel tainted.\n",
taint: mod->name, symname);
tainted |= TAINT_FORCED_MODULE; tainted |= TAINT_FORCED_MODULE;
}
return 1; return 1;
} }
#else #else
...@@ -1273,11 +1271,23 @@ static struct module *load_module(void *umod, ...@@ -1273,11 +1271,23 @@ static struct module *load_module(void *umod,
mod->symbols.num_syms = (sechdrs[exportindex].sh_size mod->symbols.num_syms = (sechdrs[exportindex].sh_size
/ sizeof(*mod->symbols.syms)); / sizeof(*mod->symbols.syms));
mod->symbols.syms = (void *)sechdrs[exportindex].sh_addr; mod->symbols.syms = (void *)sechdrs[exportindex].sh_addr;
mod->symbols.crcs = (void *)sechdrs[crcindex].sh_addr; if (crcindex)
mod->symbols.crcs = (void *)sechdrs[crcindex].sh_addr;
mod->gpl_symbols.num_syms = (sechdrs[gplindex].sh_size mod->gpl_symbols.num_syms = (sechdrs[gplindex].sh_size
/ sizeof(*mod->symbols.syms)); / sizeof(*mod->symbols.syms));
mod->gpl_symbols.syms = (void *)sechdrs[gplindex].sh_addr; mod->gpl_symbols.syms = (void *)sechdrs[gplindex].sh_addr;
mod->gpl_symbols.crcs = (void *)sechdrs[gplcrcindex].sh_addr; if (gplcrcindex)
mod->gpl_symbols.crcs = (void *)sechdrs[gplcrcindex].sh_addr;
#ifdef CONFIG_MODVERSIONS
if ((mod->symbols.num_syms && !crcindex)
|| (mod->gpl_symbols.num_syms && !gplcrcindex))
printk(KERN_WARNING "%s: No versions for exported symbols."
" Tainting kernel.\n", mod->name);
tainted |= TAINT_FORCED_MODULE;
}
#endif
/* Set up exception table */ /* Set up exception table */
if (exindex) { if (exindex) {
......
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