[PATCH] libelf: Mark shdr_flags dirty if offset or size changes during update.
Thu May 16 16:03:00 GMT 2019
On Mon, 2019-05-13 at 00:13 +0200, Mark Wielaard wrote:
> We forgot to mark the shdr_flags dirty when only the sh_size or
> sh_offset changed during elf_update (). This meant that if there were
> no other shdr changes we only wrote out the section data, but didn't
> write out the shdr table to the file.
> Add a testcase that puts some sections in the reverse order and then
> writes out the resulting file again without doing any other
> updates. This would show the issue after write out of the
> (re-reversed) ELF file (the .shstrtab section offset would be wrong
> causing all section names to be garbage). Also run a self test on the
> ET_REL object files.
I pushed this to master with one small change to the self test.
It is now ran on all files. It only really tests the issue for ET_REL
files (since otherwise we keep the layout the same and so don't even
update the offsets). But it is better for test coverage to make sure
things also work fine for ET_DYN and ET_EXEC files.
It also seems to have fixed this RPM issue:
"debugedit fails to update section headers"
More information about the Elfutils-devel