kexec: fix for "Unhandled rela relocation: R_X86_64_PLT32" error

Resolves: bz1619122
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1619122

This patch fixes the "Unhandled rela relocation: R_X86_64_PLT32" error
that we are seeing with Fedora 29 (and newer kernels > 4.18) which
trying to run kexec/kdump on x86_64 machines.

The patch is being discussed upstream and has been ACK'ed by Baoquan and
myself (see <https://www.spinics.net/lists/kexec/msg21255.html>) and I
have also tested the same on Fedora 29/rawhide x86_64 machine as well:

Before the patch:
----------------
[root@hp-bl480c-01 ~]# kdumpctl restart
  kexec: unloaded kdump kernel
  Stopping kdump: [OK]
  Unhandled rela relocation: R_X86_64_PLT32
  kexec: failed to load kdump kernel
  Starting kdump: [FAILED]

After the patch:
---------------
[root@hp-bl480c-01 ~]# kdumpctl restart
  kexec: unloaded kdump kernel
  Stopping kdump: [OK]
  kexec: loaded kdump kernel
  Starting kdump: [OK]

Suggested Upstream Fix:

    In response to a change in binutils, commit b21ebf2fb4c
    (x86: Treat R_X86_64_PLT32 as R_X86_64_PC32) was applied to
    the linux kernel during the 4.16 development cycle and has
    since been backported to earlier stable kernel series. The
    change results in the failure message in $SUBJECT when
    rebooting via kexec.

    Fix this by replicating the change in kexec.

    Signed-off-by: Chris Clayton <chris2553@googlemail.com>

Signed-off-by: Bhupesh Sharma <bhsharma@redhat.com>
Acked-by: Kairui Song <kasong@redhat.com>
This commit is contained in:
Bhupesh Sharma 2018-08-22 01:53:33 +05:30 committed by Kairui Song
parent d92b9364ae
commit 00da17176d
2 changed files with 40 additions and 0 deletions

View File

@ -0,0 +1,37 @@
From 35a2fb50293da9fbd94f29a2ed6a4f114fd8044f Mon Sep 17 00:00:00 2001
From: Bhupesh Sharma <bhsharma@redhat.com>
Date: Tue, 21 Aug 2018 16:22:31 +0530
Subject: [PATCH] kexec: fix for "Unhandled rela relocation: R_X86_64_PLT32"
error
In response to a change in binutils, commit b21ebf2fb4c
(x86: Treat R_X86_64_PLT32 as R_X86_64_PC32) was applied to
the linux kernel during the 4.16 development cycle and has
since been backported to earlier stable kernel series. The
change results in the failure message in $SUBJECT when
rebooting via kexec.
Fix this by replicating the change in kexec.
Signed-off-by: Chris Clayton <chris2553@googlemail.com>
---
kexec/arch/x86_64/kexec-elf-rel-x86_64.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/kexec/arch/x86_64/kexec-elf-rel-x86_64.c b/kexec/arch/x86_64/kexec-elf-rel-x86_64.c
index 7fdde73a5eca..af33689a7d43 100644
--- a/kexec/arch/x86_64/kexec-elf-rel-x86_64.c
+++ b/kexec/arch/x86_64/kexec-elf-rel-x86_64.c
@@ -78,7 +78,8 @@ void machine_apply_elf_rel(struct mem_ehdr *UNUSED(ehdr),
if ((int64_t)value != *(int32_t *)location)
goto overflow;
break;
- case R_X86_64_PC32:
+ case R_X86_64_PC32:
+ case R_X86_64_PLT32:
*(uint32_t *)location = value - address;
break;
default:
--
2.7.4

View File

@ -71,6 +71,7 @@ Obsoletes: diskdumputils netdump kexec-tools-eppic
#
# Patches 101 through 200 are meant for x86_64 kexec-tools enablement
#
Patch101: kexec-tools-2.0.17-kexec-fix-for-Unhandled-rela-relocation-R_X86_64_PLT.patch
#
# Patches 301 through 400 are meant for ppc64 kexec-tools enablement
@ -101,6 +102,8 @@ mkdir -p -m755 kcp
tar -z -x -v -f %{SOURCE9}
tar -z -x -v -f %{SOURCE19}
%patch101 -p1
%ifarch ppc
%define archdef ARCH=ppc
%endif