mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ben Hutchings <ben@decadent.org.uk>
To: Woody Suwalski <terraluna977@gmail.com>,
	LKML <linux-kernel@vger.kernel.org>
Cc: stable <stable@vger.kernel.org>
Subject: Re: [PATCH] fix 3.16 unknown rela relocation 4 error
Date: Sun, 26 Jan 2020 17:13:32 +0000	[thread overview]
Message-ID: <114b087b50c83cfa3cc9afc8e08641a0d1ab8ce4.camel@decadent.org.uk> (raw)
In-Reply-To: <48d562fd-f80a-69ae-56e5-d0bada0feeed@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1909 bytes --]

On Sat, 2020-01-25 at 22:16 -0500, Woody Suwalski wrote:
> Trying to use an AMD64 3.16 kernel built on a new Debian system fails 
> because
> most of the kernel modules can not be loaded.

I don't recommend using the latest toolchain for 3.16 (certainly gcc 9
won't work).  But I will apply this since it's such a simple fix. 
Thanks for the backport.

Ben.

> This patch handles the PLT32 relocation errors for kernels modules built 
> with binutils
> newer then 2.31, similar to:
> [    5.742485] module: autofs4: Unknown rela relocation: 4
> [    5.742536] systemd[1]: Failed to insert module 'autofs4': Exec 
> format error
> 
> This patch is based on a mainline kernel patch 
> b21ebf2fb4cde1618915a97cc773e287ff49173e
> From: "H.J. Lu" <hjl.tools@gmail.com>
> Date: Wed, 7 Feb 2018 14:20:09 -0800
> Subject: x86: Treat R_X86_64_PLT32 as R_X86_64_PC32
> 
> Signed-off-by: Woody Suwalski <terraluna977@gmail.com>
> 
> --- a/arch/x86/tools/relocs.c    2020-01-24 18:48:09.477919152 -0500
> +++ b/arch/x86/tools/relocs.c    2020-01-24 18:48:53.645612045 -0500
> @@ -763,6 +763,7 @@ static int do_reloc64(struct section *se
>       switch (r_type) {
>       case R_X86_64_NONE:
>       case R_X86_64_PC32:
> +    case R_X86_64_PLT32:
>           /*
>            * NONE can be ignored and PC relative relocations don't
>            * need to be adjusted.
> --- a/arch/x86/kernel/module.c    2020-01-24 18:46:54.922670590 -0500
> +++ b/arch/x86/kernel/module.c    2020-01-24 18:47:46.714112016 -0500
> @@ -180,6 +180,7 @@ int apply_relocate_add(Elf64_Shdr *sechd
>                   goto overflow;
>               break;
>           case R_X86_64_PC32:
> +        case R_X86_64_PLT32:
>               val -= (u64)loc;
>               *(u32 *)loc = val;
>   #if 0
> 
-- 
Ben Hutchings
The program is absolutely right; therefore, the computer must be wrong.



[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

      reply	other threads:[~2020-01-26 17:13 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-26  3:16 Woody Suwalski
2020-01-26 17:13 ` Ben Hutchings [this message]

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=114b087b50c83cfa3cc9afc8e08641a0d1ab8ce4.camel@decadent.org.uk \
    --to=ben@decadent.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=terraluna977@gmail.com \
    /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

all inboxes | Powered by JetHome®