Fix ppc64 ELFv1 assertion failure
Bogus assembly can hit an assertion in opd_entry_value when the symbol referenced by a function descriptor is undefined. Worse, the code after the assert copies unitialised memory to return the code section. This uninitialised pointer can later be dereferencd, possibly causing a linker segmentation fault. * elf64-ppc.c (opd_entry_value): Remove assertion. Instead, return -1 if symbol referenced is not defined. Tidy.
This commit is contained in:
parent
f945ba50bb
commit
bb854a36d1
2 changed files with 11 additions and 7 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
2015-07-22 Alan Modra <amodra@gmail.com>
|
||||||
|
|
||||||
|
* elf64-ppc.c (opd_entry_value): Remove assertion. Instead,
|
||||||
|
return -1 if symbol referenced is not defined. Tidy.
|
||||||
|
|
||||||
2015-07-20 Alan Modra <amodra@gmail.com>
|
2015-07-20 Alan Modra <amodra@gmail.com>
|
||||||
|
|
||||||
* po/SRC-POTFILES.in: Regenerate.
|
* po/SRC-POTFILES.in: Regenerate.
|
||||||
|
|
|
@ -6034,14 +6034,13 @@ opd_entry_value (asection *opd_sec,
|
||||||
if (rh != NULL)
|
if (rh != NULL)
|
||||||
{
|
{
|
||||||
rh = elf_follow_link (rh);
|
rh = elf_follow_link (rh);
|
||||||
BFD_ASSERT (rh->root.type == bfd_link_hash_defined
|
if (rh->root.type != bfd_link_hash_defined
|
||||||
|| rh->root.type == bfd_link_hash_defweak);
|
&& rh->root.type != bfd_link_hash_defweak)
|
||||||
val = rh->root.u.def.value;
|
break;
|
||||||
sec = rh->root.u.def.section;
|
if (rh->root.u.def.section->owner == opd_bfd)
|
||||||
if (sec->owner != opd_bfd)
|
|
||||||
{
|
{
|
||||||
sec = NULL;
|
val = rh->root.u.def.value;
|
||||||
val = (bfd_vma) -1;
|
sec = rh->root.u.def.section;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue