On Wed, 2018-09-12 at 15:02 +0200, Mark Wielaard wrote:
> When ELF_C_RDWR_MMAP is used libelf might have to write overlapping memory
> when moving the section data or headers. Make sure to use memmove, not
> memcpy. Also the size of the underlying file might have to change. That
> means we will hav
Through an accident Fedora rawhide created various ELF files with thousands
of sections. This showed various issues in libelf, libdw and some of the
elfutils tools. When an ELF file has more than SHN_LORESERVE (0xff00, 65280)
sections then the Ehdr e_shnum and e_shshstrndx fields are too small to
h
For ELF files with more than SHN_LOWRESERVE sections we always need
section zero to store the section number (it doesn't just fit in the
Ehdr e_shnum field). Make sure to create it if it doesn't exist yet
in elf_getscn. Also fix handling on shnum in updatefile for the mmap
case (we already got this
dwarf_begin_elf used the Ehdr e_shstrndx to get the shdr string table
section. This does not work for ELF files with more than SHN_LORESERVE
sections. Use elf_getshdrstrndx, and don't pass around the ehdr.
Add a simple testcase that fails before the patch because dwarf_begin
return an error.
Sign
elfcmp would use the Ehdr e_shstrndx field to find the shdr string
index table. Use elf_getshdrstrndx instead to be able to handle ELF
files with more than SHN_LORESERVE sections.
Signed-off-by: Mark Wielaard
---
src/ChangeLog | 4
src/elfcmp.c | 20 ++--
2 files changed,
The .odp section is found by name. But ppc64_init used the e_shstrndx
Ehdr field for that. This is wrong if the file contains more than
SHN_LORESERVE sections. Use elf_getshdrstrndx instead to find the
shstrtab section.
Signed-off-by: Mark Wielaard
---
backends/ChangeLog| 4
backends/pp
print_shdr didn't print the correct number of sections if there were
more than SHN_LORESERVE sections. print_phdr wouldn't match up the
(allocated) sections and segements if there were more than SHN_LORESERVE
sections in the ELF file.
Signed-off-by: Mark Wielaard
---
src/ChangeLog | 5 +
sr
In various places in strip we used e_shstrndx instead of shdrstrndx and we
didn't setup the shdrstrndx for the debug file. In unstrip we forgot to copy
the shdrstrndx in case the -o output option was used.
Added a new testcase that adds many sections to a testfile and runs strip,
elflint,
unstrip
We already got the right shnum and shstrndx. But were still using
e_shnum in one check for ELFCLASS64 (it was correct for ELFCLASS32).
And when getting section names in check_symtab we still used
e_shstrndx in two places.
Signed-off-by: Mark Wielaard
---
src/ChangeLog | 7 +++
src/elflint.c
There are two places, dwfl_segment_report_module and elf_from_remote_memory
in libdwfl where we use the Ehdr e_shnum directly. Document why this is fine.
Getting the shdrs in those two places is really just a nice bonus and if there
are more than 0xff00 then it is unlikely we will get them all anyw
The ebl_section_strip_p function used the Ehdr e_shstrndx field
to get at the name of the (debug) sections. This is not correct
if there are more than SHN_LORESERVE sections. Use elf_getshdrstrndx
to get at the shstrtab section. And drop the Ehdr argument that isn't
necessary anymore.
Signed-off-b
The check_special_symbol backend functions used the Ehdr e_shstrndx
field to get at the name of sections. This is not correct if there
are more than SHN_LORESERVE sections. Always use elf_getshdrstrndx
to get the shstrtab section. And drop the Ehdr argument that isn't
necessary anymore.
Signed-off
12 matches
Mail list logo