[PATCH] libelf: Don't extend ELF file size with SHT_NOBITS sh_offset.

Mark Wielaard mjw at redhat.com
Fri Mar 27 22:06:26 UTC 2015


On Mon, 2015-03-23 at 22:46 +0100, Mark Wielaard wrote:
> Don't explicitly extend the file size for SHT_NOBITS sections. Since
> that could cause a size beyond any actual file content it will cause
> issues when the underlying ELF file has been mmapped or will extend
> the file size to increase (writing fill bytes) when not mmapped. The
> sh_offset value is essentially meaningless for SHT_NOBITS. gabi says
> that a NOBITS section sh_offset member locates the "conceptual
> placement" in the file. But it doesn't say this cannot be beyond the
> enf of the file. When ELF_F_LAYOUT is set we should trust sh_offset
> as given is what is wanted for an SHT_NOBITS section without extending
> the file size.

I pushed this to master.


More information about the elfutils-devel mailing list