[eresi-dev] Patch for elfsh SuSe bug
jv at ens dot fr
julien.vanegue at ens.fr
Tue Sep 25 16:38:29 UTC 2007
The faulty line 113 in libelfsh/map.c was :
$ grep -in 'actual->next->shdr->sh_addr' map.c
113: actual->next->shdr->sh_offset != actual->shdr->sh_offset)
$
the patch is :
RCS file: /home/cvsroot/eresi/libelfsh/map.c,v
112c112,113
< actual->next->shdr->sh_offset != actual->shdr->sh_offset)
---
> actual->next->shdr->sh_offset != actual->shdr->sh_offset &&
> actual->next->shdr->sh_addr != actual->shdr->sh_addr)
Explanations:
While loading the file, elfsh automatically fixes the size field of
sections which have their size = 0. This is the case of the .init_array
section which is a SuSe specific section. However in that case, the
size should not have been fixed because this section contains no
data (more precisely it overlaps with .ctors so the size needs to
stay at 0 for .init_array)
this fix ensures that the size field is only fixed if the next section
has a different file offset AND a different virtual address than
the current section. Before, only the file offset was checked to
be different, which was a too weak check in our case.
Thanks for reporting the bug the fix is not yet in CVS but it will
be in my next commit. If you wish to fix your tree, just add the
second check of the patch in your libelfsh/map.c at the right
place as indicated by the diff.
Julien Vanegue
More information about the eresi-dev
mailing list