All of lore.kernel.org
 help / color / mirror / Atom feed
* (Possible) fix for "Unhandled rela relocation: R_X86_64_PLT32" error
@ 2018-07-25  8:46 Chris Clayton
  2018-08-20  8:37 ` Baoquan He
  0 siblings, 1 reply; 11+ messages in thread
From: Chris Clayton @ 2018-07-25  8:46 UTC (permalink / raw)
  To: kexec

Hi.

I haven't rebooted my laptop with kexec for quite some time, but when I tried to this morning I got the error you will
see in $SUBJECT.  The error occurs with both kexec-tools-2.0.17 or -2.0.16 run on either 4.18.0-rc6+ (built from a git
pull this morning) or 4.14.57 kernels.

I searched for "R_X86_64_PLT32" and found that there was a change to the kernel that may be related -
b21ebf2fb4cde1618915a97cc773e287ff49173e x86: Treat R_X86_64_PLT32 as R_X86_64_PC32. So I replicated the change that
patch made to arch/x86/kernel/machine_kexec_64.c in kexec/arch/x86_64/kexec-elf-rel-x86_64.c and kexec now reboots into
the new kernel.

I don't know enough about relocations and the like to know whether my 'fix' is correct and the best way to go about it,
but I've included it below for your consideration.

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

--- kexec-tools-2.0.17/kexec/arch/x86_64/kexec-elf-rel-x86_64.c.orig	2018-07-25 08:48:24.152054030 +0100
+++ kexec-tools-2.0.17/kexec/arch/x86_64/kexec-elf-rel-x86_64.c	2018-07-25 08:49:16.860055330 +0100
@@ -79,6 +79,7 @@ void machine_apply_elf_rel(struct mem_eh
 			goto overflow;
 		break;
 	case R_X86_64_PC32:
+	case R_X86_64_PLT32:
 		*(uint32_t *)location = value - address;
 		break;
 	default:

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: (Possible) fix for "Unhandled rela relocation: R_X86_64_PLT32" error
  2018-07-25  8:46 (Possible) fix for "Unhandled rela relocation: R_X86_64_PLT32" error Chris Clayton
@ 2018-08-20  8:37 ` Baoquan He
  2018-08-20 11:00   ` kexec: " Chris Clayton
  0 siblings, 1 reply; 11+ messages in thread
From: Baoquan He @ 2018-08-20  8:37 UTC (permalink / raw)
  To: Chris Clayton; +Cc: kexec

On 07/25/18 at 09:46am, Chris Clayton wrote:
> Hi.
> 
> I haven't rebooted my laptop with kexec for quite some time, but when I tried to this morning I got the error you will
> see in $SUBJECT.  The error occurs with both kexec-tools-2.0.17 or -2.0.16 run on either 4.18.0-rc6+ (built from a git
> pull this morning) or 4.14.57 kernels.
> 
> I searched for "R_X86_64_PLT32" and found that there was a change to the kernel that may be related -
> b21ebf2fb4cde1618915a97cc773e287ff49173e x86: Treat R_X86_64_PLT32 as R_X86_64_PC32. So I replicated the change that
> patch made to arch/x86/kernel/machine_kexec_64.c in kexec/arch/x86_64/kexec-elf-rel-x86_64.c and kexec now reboots into
> the new kernel.
> 
> I don't know enough about relocations and the like to know whether my 'fix' is correct and the best way to go about it,
> but I've included it below for your consideration.
> 
> Signed-off-by: Chris Clayton <chris2553@googlemail.com>
> 
> --- kexec-tools-2.0.17/kexec/arch/x86_64/kexec-elf-rel-x86_64.c.orig	2018-07-25 08:48:24.152054030 +0100
> +++ kexec-tools-2.0.17/kexec/arch/x86_64/kexec-elf-rel-x86_64.c	2018-07-25 08:49:16.860055330 +0100
> @@ -79,6 +79,7 @@ void machine_apply_elf_rel(struct mem_eh
>  			goto overflow;
>  		break;
>  	case R_X86_64_PC32:
> +	case R_X86_64_PLT32:

Looks like a good fix, could you make a formal patch, e.g rearrange the
patch log, I woule like to ack it.

>  		*(uint32_t *)location = value - address;
>  		break;
>  	default:
> 
> _______________________________________________
> kexec mailing list
> kexec@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/kexec

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

^ permalink raw reply	[flat|nested] 11+ messages in thread

* kexec: fix for "Unhandled rela relocation: R_X86_64_PLT32" error
  2018-08-20  8:37 ` Baoquan He
@ 2018-08-20 11:00   ` Chris Clayton
  2018-08-20 12:17     ` Baoquan He
  0 siblings, 1 reply; 11+ messages in thread
From: Chris Clayton @ 2018-08-20 11:00 UTC (permalink / raw)
  To: Baoquan He; +Cc: kexec

In response to a change in binutils, change b21ebf2fb4cde1618915a97cc773e287ff49173e (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-tools-2.0.17/kexec/arch/x86_64/kexec-elf-rel-x86_64.c.orig	2018-07-25 08:48:24.152054030 +0100
+++ kexec-tools-2.0.17/kexec/arch/x86_64/kexec-elf-rel-x86_64.c	2018-07-25 08:49:16.860055330 +0100
@@ -79,6 +79,7 @@ void machine_apply_elf_rel(struct mem_eh
 			goto overflow;
 		break;
 	case R_X86_64_PC32:
+	case R_X86_64_PLT32:
 		*(uint32_t *)location = value - address;
 		break;
 	default:

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

^ permalink raw reply	[flat|nested] 11+ messages in thread

* kexec: fix for "Unhandled rela relocation: R_X86_64_PLT32" error
  2018-08-20 11:00   ` kexec: " Chris Clayton
@ 2018-08-20 12:17     ` Baoquan He
  2018-08-20 12:21       ` Baoquan He
  0 siblings, 1 reply; 11+ messages in thread
From: Baoquan He @ 2018-08-20 12:17 UTC (permalink / raw)
  To: Chris Clayton, Simon Horman; +Cc: kexec

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 | 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


_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: kexec: fix for "Unhandled rela relocation: R_X86_64_PLT32" error
  2018-08-20 12:17     ` Baoquan He
@ 2018-08-20 12:21       ` Baoquan He
  2018-08-20 15:12         ` Chris Clayton
  0 siblings, 1 reply; 11+ messages in thread
From: Baoquan He @ 2018-08-20 12:21 UTC (permalink / raw)
  To: Chris Clayton, Simon Horman; +Cc: kexec

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.
> 
> Signed-off-by: Chris Clayton <chris2553@googlemail.com>

I adjusted the patch log a little bit, you have tested it on upstream
kernel, right?

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
> 
> 
> _______________________________________________
> kexec mailing list
> kexec@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/kexec

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: kexec: fix for "Unhandled rela relocation: R_X86_64_PLT32" error
  2018-08-20 12:21       ` Baoquan He
@ 2018-08-20 15:12         ` Chris Clayton
  2018-08-20 22:38           ` Baoquan He
  2018-08-21 11:21           ` Bhupesh Sharma
  0 siblings, 2 replies; 11+ messages in thread
From: Chris Clayton @ 2018-08-20 15:12 UTC (permalink / raw)
  To: Baoquan He, Simon Horman; +Cc: kexec



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@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
>>
>>
>> _______________________________________________
>> kexec mailing list
>> kexec@lists.infradead.org
>> http://lists.infradead.org/mailman/listinfo/kexec

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: kexec: fix for "Unhandled rela relocation: R_X86_64_PLT32" error
  2018-08-20 15:12         ` Chris Clayton
@ 2018-08-20 22:38           ` Baoquan He
  2018-08-21 11:21           ` Bhupesh Sharma
  1 sibling, 0 replies; 11+ messages in thread
From: Baoquan He @ 2018-08-20 22:38 UTC (permalink / raw)
  To: Chris Clayton; +Cc: Simon Horman, kexec

On 08/20/18 at 04:12pm, Chris Clayton 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@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.

I think it's fine and enough, ack this patch.

Acked-by: Baoquan He <bhe@redhat.com>

By the way, feel free to repost with this format so that Simon won't
miss it. And you can add my ack when you repost. Surely you can also
wait for Simon or ping him later in this threaad.


Thanks
Baoquan
> 
> 
> > 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
> >>
> >>
> >> _______________________________________________
> >> kexec mailing list
> >> kexec@lists.infradead.org
> >> http://lists.infradead.org/mailman/listinfo/kexec

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: kexec: fix for "Unhandled rela relocation: R_X86_64_PLT32" error
  2018-08-20 15:12         ` Chris Clayton
  2018-08-20 22:38           ` Baoquan He
@ 2018-08-21 11:21           ` Bhupesh Sharma
  2018-08-24  7:56             ` Simon Horman
  1 sibling, 1 reply; 11+ messages in thread
From: Bhupesh Sharma @ 2018-08-21 11:21 UTC (permalink / raw)
  To: Chris Clayton, Simon Horman
  Cc: Bhupesh SHARMA, kexec mailing list, Baoquan He

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@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@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@redhat.com>

Thanks,
Bhupesh

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: kexec: fix for "Unhandled rela relocation: R_X86_64_PLT32" error
  2018-08-21 11:21           ` Bhupesh Sharma
@ 2018-08-24  7:56             ` Simon Horman
  2018-08-24 14:57               ` Baoquan He
  2018-08-24 15:08               ` Bhupesh Sharma
  0 siblings, 2 replies; 11+ messages in thread
From: Simon Horman @ 2018-08-24  7:56 UTC (permalink / raw)
  To: Bhupesh Sharma
  Cc: Bhupesh SHARMA, Chris Clayton, kexec mailing list, Baoquan He

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@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@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@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:


From b9de21ef51a7ceab7122a707c188602eae22c4ee Mon Sep 17 00:00:00 2001
From: Chris Clayton <chris2553@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@googlemail.com>
Acked-by: Baoquan He <bhe@redhat.com>
Tested-by: Bhupesh Sharma <bhsharma@redhat.com>
Acked-by: Bhupesh Sharma <bhsharma@redhat.com>
Signed-off-by: Simon Horman <horms@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


_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: kexec: fix for "Unhandled rela relocation: R_X86_64_PLT32" error
  2018-08-24  7:56             ` Simon Horman
@ 2018-08-24 14:57               ` Baoquan He
  2018-08-24 15:08               ` Bhupesh Sharma
  1 sibling, 0 replies; 11+ messages in thread
From: Baoquan He @ 2018-08-24 14:57 UTC (permalink / raw)
  To: Simon Horman
  Cc: Bhupesh Sharma, Bhupesh SHARMA, kexec mailing list, Chris Clayton

On 08/24/18 at 09:56am, Simon Horman wrote:
> On Tue, Aug 21, 2018 at 04:51:49PM +0530, Bhupesh Sharma wrote:
 
> 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 a lot for your help, Simon. You can still take the 2 weeks as a
period to merge patch, no hurry.

Thanks
Baoquan

> 
> 
> From b9de21ef51a7ceab7122a707c188602eae22c4ee Mon Sep 17 00:00:00 2001
> From: Chris Clayton <chris2553@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@googlemail.com>
> Acked-by: Baoquan He <bhe@redhat.com>
> Tested-by: Bhupesh Sharma <bhsharma@redhat.com>
> Acked-by: Bhupesh Sharma <bhsharma@redhat.com>
> Signed-off-by: Simon Horman <horms@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
> 
> 
> _______________________________________________
> kexec mailing list
> kexec@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/kexec

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: kexec: fix for "Unhandled rela relocation: R_X86_64_PLT32" error
  2018-08-24  7:56             ` Simon Horman
  2018-08-24 14:57               ` Baoquan He
@ 2018-08-24 15:08               ` Bhupesh Sharma
  1 sibling, 0 replies; 11+ messages in thread
From: Bhupesh Sharma @ 2018-08-24 15:08 UTC (permalink / raw)
  To: Simon Horman
  Cc: Bhupesh SHARMA, Chris Clayton, kexec mailing list, Baoquan He

Hi Simon,

On Fri, Aug 24, 2018 at 1:26 PM, Simon Horman <horms@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@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@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@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@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@googlemail.com>
> Acked-by: Baoquan He <bhe@redhat.com>
> Tested-by: Bhupesh Sharma <bhsharma@redhat.com>
> Acked-by: Bhupesh Sharma <bhsharma@redhat.com>
> Signed-off-by: Simon Horman <horms@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
>

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2018-08-24 15:08 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-25  8:46 (Possible) fix for "Unhandled rela relocation: R_X86_64_PLT32" error Chris Clayton
2018-08-20  8:37 ` Baoquan He
2018-08-20 11:00   ` kexec: " Chris Clayton
2018-08-20 12:17     ` Baoquan He
2018-08-20 12:21       ` Baoquan He
2018-08-20 15:12         ` Chris Clayton
2018-08-20 22:38           ` Baoquan He
2018-08-21 11:21           ` Bhupesh Sharma
2018-08-24  7:56             ` Simon Horman
2018-08-24 14:57               ` Baoquan He
2018-08-24 15:08               ` Bhupesh Sharma

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.