[PATCH] libelf: Only memcpy ehdr back when not already directly mmapped.

Mark Wielaard mjw at redhat.com
Mon Nov 11 14:09:29 UTC 2013


On Fri, 2013-11-08 at 19:28 +0100, Mark Wielaard wrote:
> When the elf file is mmapped ehdr can still point to ehdr_mem if the
> address is unaligned.  In such cases we do need to memcpy the ehdr back
> to the file. We shouldn't when ehdr already comes directly from the mmapped
> file, because that would cause an memcpy call with overlapping addresses
> (ehdr being copied directly over itself).

> +2013-11-08  Mark Wielaard  <mjw at redhat.com>
> +
> +	* elf32_updatefile.c (elfXX_updatemmap): Only memcpy ehdr when not
> +	already directly mmapped.

I pushed this to master.



More information about the elfutils-devel mailing list