Make sure that elf_image structure is copied.

A previous change modified the code so that a pointer to the elf_image
structure from the map data was returned instead of copied. This can
cause a race condition when doing local unwinds if the map needs to be
rebuilt. One thread might have a pointer to a freed data structure.

To fix this, make sure that the elf_image is always copied when the
contents are going to be used.

In addition, remove the map pointer in the mapped data because it could
also be stale when a local unwind causes a map rebuild. Add a big comment
in front of the elf_image structure to explain this so it won't happen

Bug: 27123610
Change-Id: I09166be04b62b32db82a2b85282e464924e69e2d
18 files changed