Hi,
When you call dwfl_module_relocations() on a mod that isn't ET_REL, then it can potentially return the wrong answer because it checks and returns mod->reloc_info->count. Which for ET_EXEC and ET_DYN can be setup because someone called dwfl_module_address_section(), but doesn't correspond to the actual relocation count in that case.
Does the following fix look sane?
2011-10-19 Mark Wielaard mjw@redhat.com
* derelocate.c (dwfl_module_relocations): Only check mod->reloc_info->count for ET_REL.
Thanks,
Mark
That looks correct. But I see that all callers of cache_sections conditionalize its call the same way. So might as well just move the short-circuit logic into the top of that function and remove the duplications of it, and here it will be a tail call.
Thanks, Roland
On Wed, 2011-10-19 at 16:35 -0700, Roland McGrath wrote:
That looks correct. But I see that all callers of cache_sections conditionalize its call the same way. So might as well just move the short-circuit logic into the top of that function and remove the duplications of it, and here it will be a tail call.
You mean like the following?
2011-10-20 Mark Wielaard mjw@redhat.com
* derelocate.c (cache_sections): Intern mod->reloc_info check. (dwfl_module_relocations): Don't check mod->reloc_info. (dwfl_module_relocation_info): Likewise. (find_section): Likewise.
Thanks,
Mark
Yes, but it can even go before the decls in cache_sections (C99 ftw).
Thanks, Roland
elfutils-devel@lists.fedorahosted.org