public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: James Hogan <james.hogan@imgtec.com>
To: "H. Peter Anvin" <hpa@zytor.com>, <rusty@rustcorp.com.au>
Cc: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>,
	<arjan@infradead.org>, <linux-kernel@vger.kernel.org>,
	<andy.shevchenko@gmail.com>
Subject: Re: [PATCH] x86_32: Fix module version table mismatch.
Date: Wed, 24 Apr 2013 11:13:53 +0100	[thread overview]
Message-ID: <5177B061.50107@imgtec.com> (raw)
In-Reply-To: <51772EBC.1050600@zytor.com>

On 24/04/13 02:00, H. Peter Anvin wrote:
> On 04/23/2013 05:52 PM, H. Peter Anvin wrote:
>> On 04/23/2013 05:40 AM, Tetsuo Handa wrote:
>>> Commit a4b6a77b "module: fix symbol versioning with symbol prefixes" broke
>>> loading of net/ipv6/ipv6.ko built with CONFIG_MODVERSIONS=y for x86_32.
>>
>> This really does seem to be the offending commit, although I'm still
>> confused how the heck that is possible.
>>
> 
> OK, now I grok.
> 
> The bug is the use of VMLINUX_SYMBOL_STR(%s) which expands at the time
> the output of modpost is compiled.  However, VMLINUX_SYMBOL_STR() unlike
> __VMLINUX_SYMBOL_STR() does macro expansion on its argument, which is
> actively wrong here.

Yes, nasty bug there (sorry!)

> I think the choice is either to change this to __VMLINUX_SYMBOL_STR() or
> re-introduce CONFIG_SYMBOL_PREFIX (or its equivalent) so that modprobe
> can emit it at compile time

Using __VMLINUX_SYMBOL_STR looks like the correct solution to me.

> (assuming there even should *be* a prefix on
> the symbol here, i.e. that the compiler won't add it.)

[__]VMLINUX_SYMBOL_STR expands to a string (e.g. "_" "memcmp" or just
"memcmp") so the compiler won't touch it.

> 
> Either way -- James, Rusty, this is in your court.

How does the patch below look? I presume this is preferred over
making VMLINUX_SYMBOL_STR non-argument-expanding?

Thanks
James

Subject: [PATCH 1/1] modpost: fix unwanted VMLINUX_SYMBOL_STR expansion

Commit a4b6a77b77ba4f526392612c2365797fab956014 ("module: fix symbol
versioning with symbol prefixes") broke the MODVERSIONS loading of any
module using memcmp (e.g. ipv6) on x86_32, as it's defined to
__builtin_memcmp which is expanded by VMLINUX_SYMBOL_STR. Use
__VMLINUX_SYMBOL_STR instead which doesn't expand the argument.

Reported-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Signed-off-by: James Hogan <james.hogan@imgtec.com>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: H. Peter Anvin <hpa@zytor.com>
---
 scripts/mod/modpost.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 1f90961..a4be8e1 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -1957,7 +1957,7 @@ static int add_versions(struct buffer *b, struct module *mod)
 				s->name, mod->name);
 			continue;
 		}
-		buf_printf(b, "\t{ %#8x, VMLINUX_SYMBOL_STR(%s) },\n",
+		buf_printf(b, "\t{ %#8x, __VMLINUX_SYMBOL_STR(%s) },\n",
 			   s->crc, s->name);
 	}
 
-- 
1.8.1.2


  reply	other threads:[~2013-04-24 10:14 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CAHp75VdDwh0wgCWrVDcPps1C2qfdDZra15y9BQvzfWHzSMqbWA@mail.gmail.com>
2013-04-12 15:08 ` memcmp in modules Andy Shevchenko
2013-04-22 14:26   ` Tetsuo Handa
2013-04-23 12:40     ` [PATCH] x86_32: Fix module version table mismatch Tetsuo Handa
2013-04-23 14:14       ` Andy Shevchenko
2013-04-23 15:17       ` H. Peter Anvin
2013-04-23 15:41         ` Andy Shevchenko
2013-04-23 22:07           ` H. Peter Anvin
2013-04-23 22:56       ` H. Peter Anvin
2013-04-24  0:52       ` H. Peter Anvin
2013-04-24  1:00         ` H. Peter Anvin
2013-04-24 10:13           ` James Hogan [this message]
2013-04-24 11:24             ` Andy Shevchenko
2013-04-24 12:28             ` Tetsuo Handa
2013-04-24 13:49             ` Andy Shevchenko
2013-04-24 17:48             ` H. Peter Anvin
2013-04-25 10:42               ` [PATCH v2] modpost: fix unwanted VMLINUX_SYMBOL_STR expansion James Hogan
2013-04-29  2:10                 ` Rusty Russell
2013-04-23 23:15     ` memcmp in modules H. Peter Anvin

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=5177B061.50107@imgtec.com \
    --to=james.hogan@imgtec.com \
    --cc=andy.shevchenko@gmail.com \
    --cc=arjan@infradead.org \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=penguin-kernel@I-love.SAKURA.ne.jp \
    --cc=rusty@rustcorp.com.au \
    /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