1
0
Fork 0
mirror of https://github.com/tobast/libunwind-eh_elf.git synced 2024-11-22 15:47:37 +01:00

Some entries in /proc/<pid>/maps are not ELF files, so add check

in elf_map_image() to ensure mapped files have a valid ELF header.

Signed-off-by: Zachary T Welch <zwelch@codesourcery.com>
Signed-off-by: Arun Sharma <asharma@fb.com>
This commit is contained in:
Arun Sharma 2011-01-23 17:55:55 -08:00
parent 5007f8c794
commit a83e96cc1c

View file

@ -43,6 +43,12 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
# define elf_w(x) _Uelf64_##x
#endif
extern int elf_w (valid_object) (struct elf_image *ei);
extern int elf_w (get_proc_name) (unw_addr_space_t as,
pid_t pid, unw_word_t ip,
char *buf, size_t len,
unw_word_t *offp);
static inline int
elf_map_image (struct elf_image *ei, const char *path)
{
@ -65,11 +71,11 @@ elf_map_image (struct elf_image *ei, const char *path)
if (ei->image == MAP_FAILED)
return -1;
if (!elf_w (valid_object) (ei))
{
munmap(ei->image, ei->size);
return -1;
}
return 0;
}
extern int elf_w (valid_object) (struct elf_image *ei);
extern int elf_w (get_proc_name) (unw_addr_space_t as,
pid_t pid, unw_word_t ip,
char *buf, size_t len,
unw_word_t *offp);