]> code.ossystems Code Review - openembedded-core.git/commit
debugedit: fix segment fault while file's bss offset have a large number
authorHongxu Jia <hongxu.jia@windriver.com>
Mon, 21 Oct 2013 11:37:22 +0000 (19:37 +0800)
committerRobert Yang <liezhi.yang@windriver.com>
Wed, 11 Dec 2013 02:12:22 +0000 (21:12 -0500)
commita82322a982dc97ebc95f3fc45f9ad98bed947ad9
treedeb26f523fb5378d023550fbde62518a6f2275a1
parent8c75d888a5e4cf7fc2c92df730d80224f5ffa99a
debugedit: fix segment fault while file's bss offset have a large number

While ELF_C_RDWR_MMAP was used, elf_begin invoked mmap() to map file
into memory. While the file's bss Offset has a large number, elf_update
caculated file size by __elf64_updatenull_wrlock and the size was
enlarged.

In this situation, elf_update invoked ftruncate to enlarge the file,
and memory size (elf->maximum_size) also was incorrectly updated.
There was segment fault in elf_end which invoked munmap with the
length is the enlarged file size, not the mmap's length.

Before the above operations, invoke elf_begin/elf_update/elf_end
with ELF_C_RDWR and ELF_F_LAYOUT set to enlarge the above file, it
could make sure the file is safe for the following elf operations.

[YOCTO #5356]
https://bugzilla.redhat.com/show_bug.cgi?id=1019707
https://bugzilla.redhat.com/show_bug.cgi?id=1020842

(From OE-Core master rev: 35c8b1ac7c3b1e4209b1e30d1dbd1a457286b97b)

Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
meta/recipes-devtools/rpm/rpm/debugedit-valid-file-to-fix-segment-fault.patch [new file with mode: 0644]
meta/recipes-devtools/rpm/rpm_5.4.9.bb