summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShan Hai <shan.hai@windriver.com>2014-10-24 14:05:36 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-11-04 10:27:10 +0000
commit160b53b701b4b59a1f55f5a922e8558179273971 (patch)
treea5d2cf712eaff67e259222a684d433bde9632019
parenta60af9ac74ad8eea704b45fbf5054fecfe681288 (diff)
downloadpoky-160b53b701b4b59a1f55f5a922e8558179273971.tar.gz
ldconfig-native: fix a endian-ness bug
Some header fields of ELF were read with wrong size on 64bit big-endian machine, fix it by reading the fields with read64 instead of read32. (From OE-Core rev: adbf0b1fdf897076e5e3dec2443c8927f315c2e6) Signed-off-by: Par Olsson <Par.Olsson@windriver.com> Signed-off-by: Shan Hai <shan.hai@windriver.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/recipes-core/glibc/ldconfig-native-2.12.1/endian-ness_handling_fix.patch47
-rw-r--r--meta/recipes-core/glibc/ldconfig-native_2.12.1.bb1
2 files changed, 48 insertions, 0 deletions
diff --git a/meta/recipes-core/glibc/ldconfig-native-2.12.1/endian-ness_handling_fix.patch b/meta/recipes-core/glibc/ldconfig-native-2.12.1/endian-ness_handling_fix.patch
new file mode 100644
index 0000000000..6aecfe5268
--- /dev/null
+++ b/meta/recipes-core/glibc/ldconfig-native-2.12.1/endian-ness_handling_fix.patch
@@ -0,0 +1,47 @@
1Upstream-Status: Inappropriate [embedded specific]
2
3Fix problem during parsing of ELF headers for 64bit on big-endian.
4Some header fields were read with wrong size.
5
62014/10/24
7Par Olsson <Par.Olsson@windriver.com>
8Shan Hai <shan.hai@windriver.com>
9
10diff --git a/readelflib.c b/readelflib.c
11index 3f5b25b..0bf0de3 100644
12--- a/readelflib.c
13+++ b/readelflib.c
14@@ -261,8 +261,8 @@ process_elf_file64 (const char *file_name, const char *lib, int *flag,
15 int i;
16 unsigned int j;
17 Elf64_Addr loadaddr;
18- unsigned int dynamic_addr;
19- size_t dynamic_size;
20+ Elf64_Addr dynamic_addr;
21+ Elf64_Xword dynamic_size;
22 char *program_interpreter;
23
24 Elf64_Ehdr *elf_header;
25@@ -311,7 +311,7 @@ process_elf_file64 (const char *file_name, const char *lib, int *flag,
26 error (0, 0, _("more than one dynamic segment\n"));
27
28 dynamic_addr = read64(segment->p_offset, be);
29- dynamic_size = read32(segment->p_filesz, be);
30+ dynamic_size = read64(segment->p_filesz, be);
31 break;
32
33 case PT_INTERP:
34@@ -329,11 +329,11 @@ process_elf_file64 (const char *file_name, const char *lib, int *flag,
35 break;
36
37 case PT_NOTE:
38- if (!*osversion && read32(segment->p_filesz, be) >= 32 && read32(segment->p_align, be) >= 4)
39+ if (!*osversion && read64(segment->p_filesz, be) >= 32 && read64(segment->p_align, be) >= 4)
40 {
41 Elf64_Word *abi_note = (Elf64_Word *) (file_contents
42 + read64(segment->p_offset, be));
43- Elf64_Addr size = read32(segment->p_filesz, be);
44+ Elf64_Xword size = read64(segment->p_filesz, be);
45
46 while (read32(abi_note [0], be) != 4 || read32(abi_note [1], be) != 16
47 || read32(abi_note [2], be) != 1
diff --git a/meta/recipes-core/glibc/ldconfig-native_2.12.1.bb b/meta/recipes-core/glibc/ldconfig-native_2.12.1.bb
index 7c3463589b..1debf8ee2f 100644
--- a/meta/recipes-core/glibc/ldconfig-native_2.12.1.bb
+++ b/meta/recipes-core/glibc/ldconfig-native_2.12.1.bb
@@ -12,6 +12,7 @@ SRC_URI = "file://ldconfig-native-2.12.1.tar.bz2 \
12 file://flag_fix.patch \ 12 file://flag_fix.patch \
13 file://endianess-header.patch \ 13 file://endianess-header.patch \
14 file://ldconfig-default-to-all-multilib-dirs.patch \ 14 file://ldconfig-default-to-all-multilib-dirs.patch \
15 file://endian-ness_handling_fix.patch \
15" 16"
16 17
17PR = "r2" 18PR = "r2"