Hi,
In function 'elf_from_remote_memory' (file elf_from_memory.c) I see
references to 32-bit variant when file format is 64-bit one in couple of
places:
line 246:
case ELFCLASS64:
if (elf32_xlatetom (&xlateto, &xlatefrom,
ehdr.e32.e_ident[EI_DATA]) == NULL)
goto libelf_error;
for (uint_fast16_t i = 0; i < phnum; ++i)
if (phdrs.p32[i].p_type == PT_LOAD) //<===== should it be phdrs.p64[i] ?
and line 323:
case ELFCLASS64:
for (uint_fast16_t i = 0; i < phnum; ++i)
if (phdrs.p32[i].p_type == PT_LOAD) //<===== should it be phdrs.p64[i] ?
Is it intentionally?
Thanks,
--Serge
Show replies by date
Nope, those were legitimate bugs. That code was probably never tested on a
64-bit case. (I don't think there was an x86-64 vDSO when I wrote it.)
IIRC it's actually impossible to test at all on recent kernels, because
they don't let you read /proc without attaching ptrace first.
But the fix is clear and obviously correct. I've put it in.
Thanks,
Roland