public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Rusty Russell <rusty@rustcorp.com.au>
To: James Hogan <james.hogan@imgtec.com>
Cc: linux-kernel@vger.kernel.org,
	James Hogan <james.hogan@imgtec.com>,
	Michal Marek <mmarek@suse.cz>, Sam Ravnborg <sam@ravnborg.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Jonathan Kliegman <kliegs@chromium.org>
Subject: Re: [PATCH 1/1] module: fix symbol versioning with symbol prefixes
Date: Thu, 14 Mar 2013 10:21:19 +1030	[thread overview]
Message-ID: <8738vyvoy0.fsf@rustcorp.com.au> (raw)
In-Reply-To: <1363100964-29982-1-git-send-email-james.hogan@imgtec.com>

James Hogan <james.hogan@imgtec.com> writes:
> Fix symbol versioning on architectures with symbol prefixes. Although
> the build was free from warnings the actual modules still wouldn't load
> as the ____versions table contained unprefixed symbol names, which were
> being compared against the prefixed symbol names when checking the
> symbol versions.
>
> This is fixed by modifying modpost to add the symbol prefix to the
> ____versions table it outputs (Modules.symvers still contains unprefixed
> symbol names). The check_modstruct_version() function is also fixed as
> it checks the version of the unprefixed "module_layout" symbol which
> would no longer work.

Hmm, this has always been broken, right?  And noone noticed?  Unless you
really want it now, I'll queue it for *next* merge window.

I've applied it (reworked) to my pending-rebases queue, and will put it
in modules-next once the cleanup goes in.

Thanks,
Rusty.

From: James Hogan <james.hogan@imgtec.com>
Subject: module: fix symbol versioning with symbol prefixes

Fix symbol versioning on architectures with symbol prefixes. Although
the build was free from warnings the actual modules still wouldn't load
as the ____versions table contained unprefixed symbol names, which were
being compared against the prefixed symbol names when checking the
symbol versions.

This is fixed by modifying modpost to add the symbol prefix to the
____versions table it outputs (Modules.symvers still contains unprefixed
symbol names). The check_modstruct_version() function is also fixed as
it checks the version of the unprefixed "module_layout" symbol which
would no longer work.

Signed-off-by: James Hogan <james.hogan@imgtec.com>
Cc: Michal Marek <mmarek@suse.cz>
Cc: Sam Ravnborg <sam@ravnborg.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Jonathan Kliegman <kliegs@chromium.org>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (updated for cleanup)

diff --git a/kernel/module.c b/kernel/module.c
index cfd4a3f..3c2c72d 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -1212,7 +1212,8 @@ static inline int check_modstruct_version(Elf_Shdr *sechdrs,
 	if (!find_symbol(VMLINUX_SYMBOL_STR(module_layout), NULL,
 			 &crc, true, false))
 		BUG();
-	return check_version(sechdrs, versindex, "module_layout", mod, crc,
+	return check_version(sechdrs, versindex,
+			     VMLINUX_SYMBOL_STR(module_layout), mod, crc,
 			     NULL);
 }
 
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 6985021..909b5e7 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -1927,7 +1927,8 @@ static int add_versions(struct buffer *b, struct module *mod)
 				s->name, mod->name);
 			continue;
 		}
-		buf_printf(b, "\t{ %#8x, \"%s\" },\n", s->crc, s->name);
+		buf_printf(b, "\t{ %#8x, \"%s%s\" },\n", s->crc,
+			   VMLINUX_SYMBOL_PREFIX_STR, s->name);
 	}
 
 	buf_printf(b, "};\n");

  reply	other threads:[~2013-03-14  6:45 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-12 15:09 [PATCH 1/1] module: fix symbol versioning with symbol prefixes James Hogan
2013-03-13 23:51 ` Rusty Russell [this message]
2013-03-14  9:21   ` James Hogan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8738vyvoy0.fsf@rustcorp.com.au \
    --to=rusty@rustcorp.com.au \
    --cc=gregkh@linuxfoundation.org \
    --cc=james.hogan@imgtec.com \
    --cc=kliegs@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mmarek@suse.cz \
    --cc=sam@ravnborg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox