modversions on ppc64 will taint kernel

Rusty Russell rusty at rustcorp.com.au
Mon May 10 10:07:28 EST 2004


On Mon, 2004-05-10 at 05:42, Olaf Hering wrote:
> Rusty,
>
> the function check_version() looks for '__down', but there is '.__down'
> in the module.
> This happens with every recent 2.6 kernel. How can this be fixed?

Sorry for the delay, finally got around to looking at this.

Name: Fix __down Tainting Kernel with CONFIG_MODVERSIONS=y
Status: Tested on ppc tree 10-May-2004
Version: ppc64

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.

diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .28471-linux-ppc64-2.5/arch/ppc64/kernel/module.c .28471-linux-ppc64-2.5.updated/arch/ppc64/kernel/module.c
--- .28471-linux-ppc64-2.5/arch/ppc64/kernel/module.c	2004-01-22 16:05:41.000000000 +1100
+++ .28471-linux-ppc64-2.5.updated/arch/ppc64/kernel/module.c	2004-05-10 08:59:42.000000000 +1000
@@ -138,6 +138,16 @@ static unsigned long get_stubs_size(cons
 	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 */
 static void dedotify(Elf64_Sym *syms, unsigned int numsyms, char *strtab)
 {
@@ -166,6 +176,9 @@ int module_frob_arch_sections(Elf64_Ehdr
 			me->arch.stubs_section = i;
 		else if (strcmp(secstrings + sechdrs[i].sh_name, ".toc") == 0)
 			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 */
 		while ((p = strstr(secstrings + sechdrs[i].sh_name, ".init")))

--
Anyone who quotes me in their signature is an idiot -- Rusty Russell


** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/





More information about the Linuxppc64-dev mailing list