Skip to contentSkip to conversation

package/elfutils: fix build with glibc < 2.16

PATCH New Fabrice Fontaine 2 participants 3 messages Aug 3, 2019 – Aug 30, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/elfutils: fix build with glibc < 2.16

Fixes:
- autobuild.buildroot.net/results/1053e2b4b51bc225c4a1a29c93946101a7a53be9

---
 ...source-leak-in-elf-32-64-_updatefile.patch | 32 ++++++++++
 ...ix_memalign-instead-of-aligned_alloc.patch | 58 +++++++++++++++++++
 2 files changed, 90 insertions(+)
 create mode 100644 package/elfutils/0004-libelf-Fix-possible-resource-leak-in-elf-32-64-_updatefile.patch
 create mode 100644 package/elfutils/0005-libelf-Use-posix_memalign-instead-of-aligned_alloc.patch
package/elfutils/0004-libelf-Fix-possible-resource-leak-in-elf-32-64-_updatefile.patch new file +32 -0
new file mode 100644
index 0000000000..af5849a23b
@@ -0,0 +1,32 @@
+From 75e147d0ab85262d9bb2fff093db7ce67dbd4b62 Mon Sep 17 00:00:00 2001
+From: Mark Wielaard <[email protected]>
+Date: Wed, 6 Mar 2019 19:56:54 +0100
+Subject: [PATCH] libelf: Fix possible resource leak in elf[32|64]_updatefile.
+
+When we cannot allocate enough memory to convert the data in
+updatemmap we should free the scns before returning an error.
+
+Signed-off-by: Mark Wielaard <[email protected]>
+[Retrieved (and sliglty updated to remove ChangeLog update) from:
+https://sourceware.org/git/?p=elfutils.git;a=patch;h=75e147d0ab85262d9bb2fff093db7ce67dbd4b62]
+Signed-off-by: Fabrice Fontaine <[email protected]>
+---
+ libelf/elf32_updatefile.c | 1 +
+ 2 files changed, 6 insertions(+)
+
+ 	* gelf_xlate.c (__elf_xfctstof): Remove alias.
+diff --git a/libelf/elf32_updatefile.c b/libelf/elf32_updatefile.c
+index 2899c6f..457d18e 100644
+--- a/libelf/elf32_updatefile.c
++++ b/libelf/elf32_updatefile.c
+@@ -365,6 +365,7 @@ __elfw2(LIBELFBITS,updatemmap) (Elf *elf, int change_bo, size_t shnum)
+ 			    char *converted = aligned_alloc (align, size);
+ 			    if (converted == NULL)
+ 			      {
++				free (scns);
+ 				__libelf_seterrno (ELF_E_NOMEM);
+ 				return 1;
+ 			      }
+-- 
+2.9.3
+
package/elfutils/0005-libelf-Use-posix_memalign-instead-of-aligned_alloc.patch new file +58 -0

58 lines not on this page · raw message

Signature · 1 line
2.20.1
#1 lore raw

PATCH 1/1 package/elfutils: fix build with glibc < 2.16

Quoted 6 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

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

Fixes:
- autobuild.buildroot.net/results/1053e2b4b51bc225c4a1a29c93946101a7a53be9

Committed, thanks!

Signature · 1 line
Bye, Peter Korsgaard