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

Bhupesh Sharma bhsharma at redhat.com
Fri Aug 24 08:08:36 PDT 2018


Hi Simon,

On Fri, Aug 24, 2018 at 1:26 PM, Simon Horman <horms at verge.net.au> wrote:
> On Tue, Aug 21, 2018 at 04:51:49PM +0530, Bhupesh Sharma wrote:
>> Thanks for this fix Chris,
>>
>> I have tested this fix on Fedora 29 and it works fine.
>>
>> On Mon, Aug 20, 2018 at 8:42 PM, Chris Clayton <chris2553 at googlemail.com> wrote:
>> >
>> >
>> > On 20/08/2018 13:21, Baoquan He wrote:
>> >> Hi Chris,
>> >>
>> >> On 08/20/18 at 08:17pm, Baoquan He wrote:
>> >>> 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.
>> >>>
>> >
>> > OK.
>> >
>> >>> Signed-off-by: Chris Clayton <chris2553 at googlemail.com>
>> >>
>> >> I adjusted the patch log a little bit, you have tested it on upstream
>> >> kernel, right?
>> >>
>> >
>> > At the time of my original message (25 July 2018), 4.18.0-rc6+ was the latest upstream. I tested my change on that and
>> > on the latest stable 4.14 series kernel, which was 4.14.57. I've just tested it with 4.18.3 and 4.14.65 and it works
>> > fine. I don't have a 4.19 development kernel installed at the moment - I'm busy with other stuff.
>> >
>> > Chris
>> >
>> >
>> >> Thanks
>> >> Baoquan
>> >>
>> >>> ---
>> >>>  kexec/arch/x86_64/kexec-elf-rel-x86_64.c | 1 +
>> >>>  1 file changed, 1 insertion(+)
>> >>>
>> >>> 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 7fdde73..db85b44 100644
>> >>> --- a/kexec/arch/x86_64/kexec-elf-rel-x86_64.c
>> >>> +++ b/kexec/arch/x86_64/kexec-elf-rel-x86_64.c
>> >>> @@ -79,6 +79,7 @@ void machine_apply_elf_rel(struct mem_ehdr *UNUSED(ehdr),
>> >>>                      goto overflow;
>> >>>              break;
>> >>>      case R_X86_64_PC32:
>> >>> +    case R_X86_64_PLT32:
>> >>>              *(uint32_t *)location = value - address;
>> >>>              break;
>> >>>      default:
>> >>> --
>> >>> 2.13.6
>> >>>
>> >>>
>>
>> Hi Simon,
>>
>> This patch fixes an important issue because of which both kdump and
>> kexec have become non-operational with newer kernels (> 4.18)
>>
>> We are seeing this issue with newer Fedora versions (for e.g. Fedora
>> 29, please see <https://bugzilla.redhat.com/show_bug.cgi?id=1619122>
>> for details), so would request you to apply this as an 'urgent' fix to
>> make sure that the kexec/kdump code keeps working fine with newer
>> kernel versions as well.
>>
>> I have tested this on a Fedora 29 x86_64 host and I no longer
>> encounter the 'Unhandled rela relocation: R_X86_64_PLT32' error.
>>
>> Please feel free to add to this patch:
>> Tested-by and Acked-by: Bhupesh Sharma <bhsharma at redhat.com>
>
> Thanks, and apologies for the delay - I was travelling.
>
> For some reason the patch did not apply cleanly so I did so by hand.
> The result is as follows:

Thanks for your help. Yes the format looks fine and applies cleanly
for me via 'git am'
Sorry to bother you during your travel, but this might affect folks
using newer kernels so it might be useful to have this included in the
tree.

Regards,
Bhupesh

> From b9de21ef51a7ceab7122a707c188602eae22c4ee Mon Sep 17 00:00:00 2001
> From: Chris Clayton <chris2553 at googlemail.com>
> Date: Mon, 20 Aug 2018 12:00:31 +0100
> 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 at googlemail.com>
> Acked-by: Baoquan He <bhe at redhat.com>
> Tested-by: Bhupesh Sharma <bhsharma at redhat.com>
> Acked-by: Bhupesh Sharma <bhsharma at redhat.com>
> Signed-off-by: Simon Horman <horms at verge.net.au>
> ---
>  kexec/arch/x86_64/kexec-elf-rel-x86_64.c | 1 +
>  1 file changed, 1 insertion(+)
>
> 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..db85b443238d 100644
> --- a/kexec/arch/x86_64/kexec-elf-rel-x86_64.c
> +++ b/kexec/arch/x86_64/kexec-elf-rel-x86_64.c
> @@ -79,6 +79,7 @@ void machine_apply_elf_rel(struct mem_ehdr *UNUSED(ehdr),
>                         goto overflow;
>                 break;
>         case R_X86_64_PC32:
> +       case R_X86_64_PLT32:
>                 *(uint32_t *)location = value - address;
>                 break;
>         default:
> --
> 2.11.0
>



More information about the kexec mailing list