https://sourceware.org/bugzilla/show_bug.cgi?id=34007
Bug ID: 34007
Summary: crash with eu-strip from 0.192
Product: elfutils
Version: unspecified
Status: NEW
Severity: normal
Priority: P2
Component: backends
Assignee: unassigned at sourceware dot org
Reporter: rguenth at gcc dot gnu.org
CC: elfutils-devel at sourceware dot org
Target Milestone: ---
I have a core file with eu-strip operating on
/var/tmp/dracut.diOdZPX/initramfs/usr/lib64/libkeymap.so.1.0.0:
#0 openbackend (emulation=0x0, elf=0x5575a71b64e0, machine=62)
at ../libebl/eblopenbackend.c:330
#1 ebl_openbackend (elf=0x5575a71b64e0) at ../libebl/eblopenbackend.c:377
#2 handle_elf (fd=fd@entry=3, elf=elf@entry=0x5575a71b64e0,
fname=fname@entry=0x7fff63261b1c
"/var/tmp/dracut.diOdZPX/initramfs/usr/lib64/libkeymap.so.1.0.0",
mode=<optimized out>, tvp=<optimized out>, prefix=0x0)
at /usr/src/debug/elfutils-0.192/src/strip.c:1054
#3 0x0000557583e88625 in process_file (
fname=0x7fff63261b1c
"/var/tmp/dracut.diOdZPX/initramfs/usr/lib64/libkeymap.so.1.0.0") at
/usr/src/debug/elfutils-0.192/src/strip.c:799
#4 0x0000557583e8056b in main (argc=195, argv=0x7fff6325f6b8)
at /usr/src/debug/elfutils-0.192/src/strip.c:269
which shows we crash here (master):
/* Prefer taking the information from the ELF file. */
if (elf == NULL)
{
result->machine = machines[cnt].em;
result->class = machines[cnt].class;
result->data = machines[cnt].data;
}
else
{
result->machine = elf->state.elf32.ehdr->e_machine;
^^^
result->class = elf->state.elf32.ehdr->e_ident[EI_CLASS];
result->data = elf->state.elf32.ehdr->e_ident[EI_DATA];
}
because elf->state.elf{,32,64}.ehdr == NULL.
I do not have the artifact to reproduce but it seems the above should
check for a NULL ehdr pointer as well and make sure machines[cnt].init (...)
will not crash in such situation either.
It is odd we arrive with a NULL ehdr here, of course.
--
You are receiving this mail because:
You are on the CC list for the bug.