(Possible) fix for "Unhandled rela relocation: R_X86_64_PLT32" error
Subsystems (2)
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.
kexec/arch/x86_64/kexec-elf-rel-x86_64.c renamed from kexec/arch/x86_64/kexec-elf-rel-x86_64.c.orig +1 -0
@@ -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
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Quoted 19 lines · Chris Clayton
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 -b21ebf2fb4cde1618915a97cc773e287ff49173ex86: TreatR_X86_64_PLT32asR_X86_64_PC32. So I replicated the change that patch made toarch/x86/kernel/machine_kexec_64.cinkexec/arch/x86_64/kexec-elf-rel-x86_64.cand 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 <[email protected]>
kexec/arch/x86_64/kexec-elf-rel-x86_64.c void machine_apply_elf_rel(struct mem_eh · line 82
Quoted 4 lines
kexec/arch/x86_64/kexec-elf-rel-x86_64.c renamed from kexec/arch/x86_64/kexec-elf-rel-x86_64.c.orig +1
-0@@ -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.
Quoted 8 lines
kexec/arch/x86_64/kexec-elf-rel-x86_64.c renamed from kexec/arch/x86_64/kexec-elf-rel-x86_64.c.orig +0
-0*(uint32_t *)location = value - address;break ;default :_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
kexec: fix for "Unhandled rela relocation: R_X86_64_PLT32" error
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.
---
kexec/arch/x86_64/kexec-elf-rel-x86_64.c renamed from kexec/arch/x86_64/kexec-elf-rel-x86_64.c.orig +1 -0
@@ -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
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
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.
--- kexec/arch/x86_64/kexec-elf-rel-x86_64.c | 1 + 1 file changed, 1 insertion(+)
kexec/arch/x86_64/kexec-elf-rel-x86_64.c +1 -0
@@ -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 :
Signature · 7 lines
2.13.6 _______________________________________________ kexec mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kexec
Re: kexec: fix for "Unhandled rela relocation: R_X86_64_PLT32" error
Hi Chris,
Quoted 10 lines · Baoquan He
In response to a change in binutils, commit
b21ebf2fb4c(x86: TreatR_X86_64_PLT32asR_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 <[email protected]>
I adjusted the patch log a little bit, you have tested it on upstream kernel, right?
Thanks
Baoquan
Quoted 24 lines
--- kexec/arch/x86_64/kexec-elf-rel-x86_64.c | 1 + 1 file changed, 1 insertion(+)kexec/arch/x86_64/kexec-elf-rel-x86_64.c +1
-0@@ -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 :Signature · 7 lines
2.13.6 _______________________________________________ kexec mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kexec
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Re: kexec: fix for "Unhandled rela relocation: R_X86_64_PLT32" error
Quoted 12 lines · Baoquan He
Hi Chris,
Quoted 9 lines · Baoquan He
In response to a change in binutils, commit
b21ebf2fb4c(x86: TreatR_X86_64_PLT32asR_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.
Quoted 5 lines
Quoted 1 line
Signed-off-by Chris Clayton <[email protected]>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
Quoted 23 lines
Thanks
BaoquanQuoted 20 lines
--- kexec/arch/x86_64/kexec-elf-rel-x86_64.c | 1 + 1 file changed, 1 insertion(+)kexec/arch/x86_64/kexec-elf-rel-x86_64.c +1
-0@@ -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 :Signature · 1 line
2.13.6
Quoted 4 lines
Quoted 4 lines
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Baoquan He
Acked-byRe: kexec: fix for "Unhandled rela relocation: R_X86_64_PLT32" error
Quoted 20 lines · Chris Clayton
Quoted 12 lines · Baoquan He
Hi Chris,
Quoted 9 lines · Baoquan He
In response to a change in binutils, commit
b21ebf2fb4c(x86: TreatR_X86_64_PLT32asR_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.
Quoted 2 lines
Quoted 1 line
Signed-off-by Chris Clayton <[email protected]>
Quoted 7 lines
Quoted 3 lines
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.
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
Quoted 25 lines
Quoted 25 lines
Thanks
BaoquanQuoted 20 lines
--- kexec/arch/x86_64/kexec-elf-rel-x86_64.c | 1 + 1 file changed, 1 insertion(+)kexec/arch/x86_64/kexec-elf-rel-x86_64.c +1
-0@@ -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 :Signature · 1 line
2.13.6
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Re: kexec: fix for "Unhandled rela relocation: R_X86_64_PLT32" error
In reply to Chris ClaytonThanks for this fix Chris,
I have tested this fix on Fedora 29 and it works fine.
Quoted 38 lines · Chris Clayton
Quoted 12 lines · Baoquan He
Hi Chris,
Quoted 9 lines · Baoquan He
In response to a change in binutils, commit
b21ebf2fb4c(x86: TreatR_X86_64_PLT32asR_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.
Quoted 5 lines
Quoted 1 line
Signed-off-by Chris Clayton <[email protected]>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
Quoted 7 lines
Thanks
BaoquanQuoted 4 lines
--- kexec/arch/x86_64/kexec-elf-rel-x86_64.c | 1 + 1 file changed, 1 insertion(+)
Quoted 16 lines
Quoted 8 lines
Quoted 8 lines
kexec/arch/x86_64/kexec-elf-rel-x86_64.c +0
-0@@ -79,6 +79,7 @@ void machine_apply_elf_rel(struct mem_ehdr *UNUSED(ehdr), goto overflow;break ;case R_X86_64_PC32 :Quoted 8 lines
Quoted 8 lines
kexec/arch/x86_64/kexec-elf-rel-x86_64.c +1
-1+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 <[email protected]>
Thanks,
Bhupesh
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Re: kexec: fix for "Unhandled rela relocation: R_X86_64_PLT32" error
Quoted 71 lines · Bhupesh Sharma
Thanks for this fix Chris,
I have tested this fix on Fedora 29 and it works fine.
Quoted 38 lines · Chris Clayton
Quoted 12 lines · Baoquan He
Hi Chris,
Quoted 9 lines · Baoquan He
In response to a change in binutils, commit
b21ebf2fb4c(x86: TreatR_X86_64_PLT32asR_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.
Quoted 5 lines
Quoted 1 line
Signed-off-by Chris Clayton <[email protected]>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
Quoted 7 lines
Thanks
BaoquanQuoted 4 lines
--- kexec/arch/x86_64/kexec-elf-rel-x86_64.c | 1 + 1 file changed, 1 insertion(+)Quoted 16 lines
Quoted 8 lines
Quoted 8 lines
kexec/arch/x86_64/kexec-elf-rel-x86_64.c +0
-0@@ -79,6 +79,7 @@ void machine_apply_elf_rel(struct mem_ehdr *UNUSED(ehdr), goto overflow;break ;case R_X86_64_PC32 :Quoted 8 lines
Quoted 8 lines
kexec/arch/x86_64/kexec-elf-rel-x86_64.c +1
-1+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.
Quoted 5 lines
I have tested this on a Fedora 29
x86_64host 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 <[email protected]>
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 <[email protected]>
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.
--- kexec/arch/x86_64/kexec-elf-rel-x86_64.c | 1 + 1 file changed, 1 insertion(+)
kexec/arch/x86_64/kexec-elf-rel-x86_64.c +1 -0
@@ -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 :
Signature · 7 lines
2.11.0 _______________________________________________ kexec mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kexec
Re: kexec: fix for "Unhandled rela relocation: R_X86_64_PLT32" error
Quoted 6 lines · Simon Horman
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
Quoted 46 lines
From
b9de21ef51a7ceab7122a707c188602eae22c4eeMon Sep 17 00:00:00 2001
From: Chris Clayton <[email protected]>
Date: Mon, 20 Aug 2018 12:00:31 +0100
Subject: [PATCH] kexec: fix for "Unhandled rela relocation:R_X86_64_PLT32"
errorIn response to a change in binutils, commit
b21ebf2fb4c(x86: TreatR_X86_64_PLT32asR_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 <[email protected]>Acked-by Baoquan He <[email protected]>Tested-by Bhupesh Sharma <[email protected]>Acked-by Bhupesh Sharma <[email protected]>Signed-off-by Simon Horman <[email protected]>--- kexec/arch/x86_64/kexec-elf-rel-x86_64.c | 1 + 1 file changed, 1 insertion(+)kexec/arch/x86_64/kexec-elf-rel-x86_64.c +1
-0@@ -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 :Signature · 7 lines
2.11.0 _______________________________________________ kexec mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kexec
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Re: kexec: fix for "Unhandled rela relocation: R_X86_64_PLT32" error
In reply to Simon HormanHi Simon,
Quoted 75 lines · Simon Horman
Quoted 74 lines · Bhupesh Sharma
Thanks for this fix Chris,
I have tested this fix on Fedora 29 and it works fine.
Quoted 38 lines · Chris Clayton
Quoted 12 lines · Baoquan He
Hi Chris,
Quoted 9 lines · Baoquan He
In response to a change in binutils, commit
b21ebf2fb4c(x86: TreatR_X86_64_PLT32asR_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.
Quoted 5 lines
Quoted 1 line
Signed-off-by Chris Clayton <[email protected]>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
Quoted 7 lines
Thanks
BaoquanQuoted 4 lines
--- kexec/arch/x86_64/kexec-elf-rel-x86_64.c | 1 + 1 file changed, 1 insertion(+)Quoted 16 lines
Quoted 8 lines
Quoted 8 lines
kexec/arch/x86_64/kexec-elf-rel-x86_64.c +0
-0@@ -79,6 +79,7 @@ void machine_apply_elf_rel(struct mem_ehdr *UNUSED(ehdr), goto overflow;break ;case R_X86_64_PC32 :Quoted 8 lines
Quoted 8 lines
kexec/arch/x86_64/kexec-elf-rel-x86_64.c +1
-1+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_64host and I no longer encounter the 'Unhandled rela relocation:R_X86_64_PLT32' error.
Quoted 7 lines
Quoted 2 lines
Please feel free to add to this patch:
Tested-by and Acked-by: Bhupesh Sharma <[email protected]>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
Quoted 37 lines
From
b9de21ef51a7ceab7122a707c188602eae22c4eeMon Sep 17 00:00:00 2001
From: Chris Clayton <[email protected]>
Date: Mon, 20 Aug 2018 12:00:31 +0100
Subject: [PATCH] kexec: fix for "Unhandled rela relocation:R_X86_64_PLT32"
errorIn response to a change in binutils, commit
b21ebf2fb4c(x86: TreatR_X86_64_PLT32asR_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 <[email protected]>Acked-by Baoquan He <[email protected]>Tested-by Bhupesh Sharma <[email protected]>Acked-by Bhupesh Sharma <[email protected]>Signed-off-by Simon Horman <[email protected]>--- kexec/arch/x86_64/kexec-elf-rel-x86_64.c | 1 + 1 file changed, 1 insertion(+)kexec/arch/x86_64/kexec-elf-rel-x86_64.c +1
-1@@ -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 : --
Quoted 2 lines
2.11.0
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec