linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Anton Blanchard <anton@samba.org>
To: Laurent Dufour <ldufour@linux.vnet.ibm.com>, rusty@rustcorp.com.au
Cc: linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH] powerpc: module: fix TOC symbol CRC
Date: Thu, 19 Jun 2014 09:44:04 +1000	[thread overview]
Message-ID: <20140619094404.18e7047b@kryten> (raw)
In-Reply-To: <20140617155658.30560.578.stgit@nimbus>


Hi Laurent,

> The commit 71ec7c55ed91 introduced the magic symbol ".TOC." for ELFv2
> ABI. This symbol is built manually and has no CRC value computed. A
> zero value is put in the CRC section to avoid modpost complaining
> about a missing CRC. Unfortunately, this breaks the kernel module
> loading when the kernel is relocated (kdump case for instance)
> because of the relocation applied to the kcrctab values.
> 
> This patch compute a CRC value for the TOC symbol which will match
> the one compute by the kernel when it is relocated - aka '0 -
> relocate_start' done in maybe_relocated called by check_version
> (module.c).

Adding Rusty since he maintains the module loader code.

Anton

> Signed-off-by: Laurent Dufour <ldufour@linux.vnet.ibm.com>
> Cc: Anton Blanchard <anton@samba.org>
> ---
>  arch/powerpc/kernel/module_64.c |    9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/powerpc/kernel/module_64.c
> b/arch/powerpc/kernel/module_64.c index 077d2ce..a80c933 100644
> --- a/arch/powerpc/kernel/module_64.c
> +++ b/arch/powerpc/kernel/module_64.c
> @@ -315,8 +315,15 @@ static void dedotify_versions(struct
> modversion_info *vers, struct modversion_info *end;
>  
>  	for (end = (void *)vers + size; vers < end; vers++)
> -		if (vers->name[0] == '.')
> +		if (vers->name[0] == '.') {
>  			memmove(vers->name, vers->name+1, strlen(vers->name));
> +			/* The TOC symbol has no CRC computed. To avoid CRC
> +			 * check failing, we must force it to the expected
> +			 * value (see CRC check in module.c).
> +			 */
> +			if (!strcmp(vers->name, "TOC."))
> +				vers->crc = -(unsigned long)reloc_start;
> +		}
>  }
>  
>  /* Undefined symbols which refer to .funcname, hack to funcname
> (or .TOC.) */

  reply	other threads:[~2014-06-18 23:44 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-17 15:56 [PATCH] powerpc: module: fix TOC symbol CRC Laurent Dufour
2014-06-18 23:44 ` Anton Blanchard [this message]
2014-06-24  4:06   ` Benjamin Herrenschmidt
2014-06-24  8:42     ` Laurent Dufour
2014-06-24  8:53     ` [PATCH V2] " Laurent Dufour

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=20140619094404.18e7047b@kryten \
    --to=anton@samba.org \
    --cc=ldufour@linux.vnet.ibm.com \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --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;
as well as URLs for NNTP newsgroup(s).