diff options
author | Shan Hai <shan.hai@windriver.com> | 2014-10-24 14:05:36 +0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2014-12-31 10:18:30 +0000 |
commit | 0bc80a385002a707dbe01cb78416db1d10471905 (patch) | |
tree | b9bc68ac099a741a2910799f7a6c1c4f221ddfc3 /meta/recipes-core | |
parent | 1020bc3de3faafb0b2768f3c6f977472758e058a (diff) | |
download | poky-0bc80a385002a707dbe01cb78416db1d10471905.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)
(From OE-Core rev: 7799b884f57642a48f9ed9a829a176d83b474516)
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>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-core')
-rw-r--r-- | meta/recipes-core/glibc/ldconfig-native-2.12.1/endian-ness_handling_fix.patch | 47 | ||||
-rw-r--r-- | meta/recipes-core/glibc/ldconfig-native_2.12.1.bb | 1 |
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..931a151e20 --- /dev/null +++ b/meta/recipes-core/glibc/ldconfig-native-2.12.1/endian-ness_handling_fix.patch | |||
@@ -0,0 +1,47 @@ | |||
1 | Upstream-Status: Inappropriate [embedded specific] | ||
2 | |||
3 | Fix problem during parsing of ELF headers for 64bit on big-endian. | ||
4 | Some header fields were read with wrong size. | ||
5 | |||
6 | 2014/10/24 | ||
7 | Par Olsson <Par.Olsson@windriver.com> | ||
8 | Shan Hai <shan.hai@windriver.com> | ||
9 | |||
10 | diff --git a/readelflib.c b/readelflib.c | ||
11 | index 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 | ||
17 | PR = "r2" | 18 | PR = "r2" |