Skip to contentSkip to conversation

package/frr: fix elf_py TLS section handling

PATCH In review Fabrice Fontaine 2 participants 2 messages Feb 26, 2022 – Mar 7, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/frr: fix elf_py TLS section handling

Fix the following build failure raised on mipsel, or1k, powerpc raised since bump to version 8.1 in commit ca2753fd47d47e5ad0eec16ea62f7b7f096331b6:

struct.error: unpack requires a buffer of 20 bytes

Fixes:
- http://autobuild.buildroot.org/results/74f39c6f14e3f60babdcabceb5e42656f69cdaa7

---
 ...-lib-fix-elf_py-TLS-section-handling.patch | 31 +++++++++++++++++++
 1 file changed, 31 insertions(+)
 create mode 100644 package/frr/0002-lib-fix-elf_py-TLS-section-handling.patch
package/frr/0002-lib-fix-elf_py-TLS-section-handling.patch new file +31 -0
new file mode 100644
index 0000000000..d491cb1a7d
@@ -0,0 +1,31 @@
+From 3942ee1f7bc754dd0dd9ae79f89d0f2635be334f Mon Sep 17 00:00:00 2001
+From: David Lamparter <[email protected]>
+Date: Wed, 10 Nov 2021 15:30:07 +0100
+Subject: [PATCH] lib: fix elf_py TLS section handling
+
+... need to ignore TLS sections, their address is effectively
+meaningless but can overlap other sections we actually need to access.
+
+Signed-off-by: David Lamparter <[email protected]>
+
+[Retrieved from:
+https://github.com/FRRouting/frr/commit/3942ee1f7bc754dd0dd9ae79f89d0f2635be334f]
+Signed-off-by: Fabrice Fontaine <[email protected]>
+---
+ lib/elf_py.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/lib/elf_py.c b/lib/elf_py.c
+index 1c306893ad8..f230add6957 100644
+--- a/lib/elf_py.c
++++ b/lib/elf_py.c
+@@ -636,6 +636,9 @@ static Elf_Scn *elf_find_addr(struct elffile *ef, uint64_t addr, size_t *idx)
+ 		Elf_Scn *scn = elf_getscn(ef->elf, i);
+ 		GElf_Shdr _shdr, *shdr = gelf_getshdr(scn, &_shdr);
+ 
++		/* virtual address is kinda meaningless for TLS sections */
++		if (shdr->sh_flags & SHF_TLS)
++			continue;
+ 		if (addr < shdr->sh_addr ||
+ 		    addr >= shdr->sh_addr + shdr->sh_size)
+ 			continue;
Signature · 6 lines
2.34.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw
Quoted 6 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Fabrice" == Fabrice Fontaine <[email protected]> writes:

Fix the following build failure raised on mipsel, or1k, powerpc raised since bump to version 8.1 in commit ca2753fd47d47e5ad0eec16ea62f7b7f096331b6:

Quoted 6 lines

struct.error: unpack requires a buffer of 20 bytes

Fixes:
- http://autobuild.buildroot.org/results/74f39c6f14e3f60babdcabceb5e42656f69cdaa7

Committed, thanks.

Signature · 5 lines
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot