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,
unsigned int i, num_versions;
struct modversion_info *versions;
if (!ksg->crcs) {
printk("%s: no CRC for \"%s\" [%s] found: kernel tainted.\n",
mod->name, symname,
ksg->owner ? ksg->owner->name : "kernel");
goto taint;
}
/* Exporting module didn't supply crcs? OK, we're already tainted. */
if (!ksg->crcs)
return 1;
crc = ksg->crcs[symidx];
......@@ -763,10 +760,11 @@ static int check_version(Elf_Shdr *sechdrs,
return 0;
}
/* Not in module's version table. OK, but that taints the kernel. */
printk("%s: no version for \"%s\" found: kernel tainted.\n",
mod->name, symname);
taint:
tainted |= TAINT_FORCED_MODULE;
if (!(tainted & TAINT_FORCED_MODULE)) {
printk("%s: no version for \"%s\" found: kernel tainted.\n",
mod->name, symname);
tainted |= TAINT_FORCED_MODULE;
}
return 1;
}
#else
......@@ -1273,11 +1271,23 @@ static struct module *load_module(void *umod,
mod->symbols.num_syms = (sechdrs[exportindex].sh_size
/ sizeof(*mod->symbols.syms));
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
/ sizeof(*mod->symbols.syms));
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 */
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