[oe-commits] Roy Li : elfutils: fix elf_cvt_gnuhash

git at git.openembedded.org git at git.openembedded.org
Thu Oct 30 13:38:19 UTC 2014


Module: openembedded-core.git
Branch: master
Commit: b7936bacf0cc89bdda6722d317274bd4a3af840a
URL:    http://git.openembedded.org/?p=openembedded-core.git&a=commit;h=b7936bacf0cc89bdda6722d317274bd4a3af840a

Author: Roy Li <rongqing.li at windriver.com>
Date:   Tue Oct 28 13:09:41 2014 +0800

elfutils: fix elf_cvt_gnuhash

The 'dest' and 'src' can be same, we need to save the value of src32[2]
before swaping it.

Signed-off-by: Roy Li <rongqing.li at windriver.com>
Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>

---

 .../elfutils/elfutils/Fix_elf_cvt_gunhash.patch    | 29 ++++++++++++++++++++++
 meta/recipes-devtools/elfutils/elfutils_0.148.bb   |  1 +
 meta/recipes-devtools/elfutils/elfutils_0.158.bb   |  1 +
 3 files changed, 31 insertions(+)

diff --git a/meta/recipes-devtools/elfutils/elfutils/Fix_elf_cvt_gunhash.patch b/meta/recipes-devtools/elfutils/elfutils/Fix_elf_cvt_gunhash.patch
new file mode 100644
index 0000000..374cba5
--- /dev/null
+++ b/meta/recipes-devtools/elfutils/elfutils/Fix_elf_cvt_gunhash.patch
@@ -0,0 +1,29 @@
+Fix elf_cvt_gunhash if dest and src are same.
+
+Upstream-status: Pending
+
+The 'dest' and 'src' can be same, we need to save the value of src32[2]
+before swaping it.
+
+Signed-off-by: Baoshan Pang <BaoShan.Pang at windriver.com>
+diff --git a/libelf/gnuhash_xlate.h b/libelf/gnuhash_xlate.h
+index 6faf113..04d9ca1 100644
+--- a/libelf/gnuhash_xlate.h
++++ b/libelf/gnuhash_xlate.h
+@@ -40,6 +40,7 @@ elf_cvt_gnuhash (void *dest, const void *src, size_t len, int encode)
+      words.  We must detangle them here.   */
+   Elf32_Word *dest32 = dest;
+   const Elf32_Word *src32 = src;
++  Elf32_Word save_src32_2 = src32[2]; // dest could be equal to src
+ 
+   /* First four control words, 32 bits.  */
+   for (unsigned int cnt = 0; cnt < 4; ++cnt)
+@@ -50,7 +51,7 @@ elf_cvt_gnuhash (void *dest, const void *src, size_t len, int encode)
+       len -= 4;
+     }
+ 
+-  Elf32_Word bitmask_words = encode ? src32[2] : dest32[2];
++  Elf32_Word bitmask_words = encode ? save_src32_2 : dest32[2];
+ 
+   /* Now the 64 bit words.  */
+   Elf64_Xword *dest64 = (Elf64_Xword *) &dest32[4];
diff --git a/meta/recipes-devtools/elfutils/elfutils_0.148.bb b/meta/recipes-devtools/elfutils/elfutils_0.148.bb
index 1106242..ab95639 100644
--- a/meta/recipes-devtools/elfutils/elfutils_0.148.bb
+++ b/meta/recipes-devtools/elfutils/elfutils_0.148.bb
@@ -32,6 +32,7 @@ SRC_URI += "\
 	file://dso-link-change.patch \
 	file://nm-Fix-size-passed-to-snprintf-for-invalid-sh_name-case.patch \
 	file://elfutils-ar-c-fix-num-passed-to-memset.patch \
+	file://Fix_elf_cvt_gunhash.patch \
 "
 # Only apply when building uclibc based target recipe
 SRC_URI_append_libc-uclibc = " file://uclibc-support.patch"
diff --git a/meta/recipes-devtools/elfutils/elfutils_0.158.bb b/meta/recipes-devtools/elfutils/elfutils_0.158.bb
index ef3dd0b..42724a1 100644
--- a/meta/recipes-devtools/elfutils/elfutils_0.158.bb
+++ b/meta/recipes-devtools/elfutils/elfutils_0.158.bb
@@ -30,6 +30,7 @@ SRC_URI += "\
         file://dso-link-change.patch \
         file://m4-biarch.m4-tweak-AC_RUN_IFELSE-for-cross-compiling.patch \
         file://fixheadercheck.patch \
+        file://Fix_elf_cvt_gunhash.patch \
 "
 
 # Only apply when building uclibc based target recipe



More information about the Openembedded-commits mailing list