diff options
author | Shan Hai <shan.hai@windriver.com> | 2014-10-24 14:05:36 +0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2014-11-04 10:19:55 +0000 |
commit | adbf0b1fdf897076e5e3dec2443c8927f315c2e6 (patch) | |
tree | b4e4f7c00bdd39c9d153be4f7735510e508e8eaf /meta/recipes-core | |
parent | aa0a1cbc92a4d586377cb9e9827ee8b90749c364 (diff) | |
download | openembedded-core-adbf0b1fdf897076e5e3dec2443c8927f315c2e6.tar.gz openembedded-core-adbf0b1fdf897076e5e3dec2443c8927f315c2e6.tar.bz2 openembedded-core-adbf0b1fdf897076e5e3dec2443c8927f315c2e6.zip |
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.
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>
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..6aecfe5268 --- /dev/null +++ b/meta/recipes-core/glibc/ldconfig-native-2.12.1/endian-ness_handling_fix.patch @@ -0,0 +1,47 @@ +Upstream-Status: Inappropriate [embedded specific] + +Fix problem during parsing of ELF headers for 64bit on big-endian. +Some header fields were read with wrong size. + +2014/10/24 +Par Olsson <Par.Olsson@windriver.com> +Shan Hai <shan.hai@windriver.com> + +diff --git a/readelflib.c b/readelflib.c +index 3f5b25b..0bf0de3 100644 +--- a/readelflib.c ++++ b/readelflib.c +@@ -261,8 +261,8 @@ process_elf_file64 (const char *file_name, const char *lib, int *flag, + int i; + unsigned int j; + Elf64_Addr loadaddr; +- unsigned int dynamic_addr; +- size_t dynamic_size; ++ Elf64_Addr dynamic_addr; ++ Elf64_Xword dynamic_size; + char *program_interpreter; + + Elf64_Ehdr *elf_header; +@@ -311,7 +311,7 @@ process_elf_file64 (const char *file_name, const char *lib, int *flag, + error (0, 0, _("more than one dynamic segment\n")); + + dynamic_addr = read64(segment->p_offset, be); +- dynamic_size = read32(segment->p_filesz, be); ++ dynamic_size = read64(segment->p_filesz, be); + break; + + case PT_INTERP: +@@ -329,11 +329,11 @@ process_elf_file64 (const char *file_name, const char *lib, int *flag, + break; + + case PT_NOTE: +- if (!*osversion && read32(segment->p_filesz, be) >= 32 && read32(segment->p_align, be) >= 4) ++ if (!*osversion && read64(segment->p_filesz, be) >= 32 && read64(segment->p_align, be) >= 4) + { + Elf64_Word *abi_note = (Elf64_Word *) (file_contents + + read64(segment->p_offset, be)); +- Elf64_Addr size = read32(segment->p_filesz, be); ++ Elf64_Xword size = read64(segment->p_filesz, be); + + while (read32(abi_note [0], be) != 4 || read32(abi_note [1], be) != 16 + || 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 \ file://flag_fix.patch \ file://endianess-header.patch \ file://ldconfig-default-to-all-multilib-dirs.patch \ + file://endian-ness_handling_fix.patch \ " PR = "r2" |