]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
Some fixes for LD_BIND_NOW + ifuncs.
authorkib <kib@FreeBSD.org>
Mon, 3 Dec 2018 20:03:43 +0000 (20:03 +0000)
committerkib <kib@FreeBSD.org>
Mon, 3 Dec 2018 20:03:43 +0000 (20:03 +0000)
commitafa4092620919b39fcfa2d0c299410b18bcd0349
tree53aea58d46b69c6979a878e18a43de60dd82efdc
parentf60daffdf95c62e52494eb74584d62ac4a8882bd
Some fixes for LD_BIND_NOW + ifuncs.

- Do not perform ifunc relocations together with other PLT relocations
  in PLT.  Instead, do it during an additional pass over the init
  list, so that ifuncs are resolved in the order of dso
  dependencies. This allows the ifuncs resolvers to call into depended
  libs.  Init list now includes all objects instead of only objects
  with init/fini callables.
- Disable relro protection around bind_now ifunc relocations.

I considered calling ifunc resolvers of dso after initializers of all
dependencies are processed, and decided that this is wrong/should not
be supported. The order now is normal relocations for all
objects->ifunc resolution in init order->initializers, where each step
does complete pass over all loaded objects before moving to the next
step.

Reported, tested and reviewed by: emaste
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D18400
libexec/rtld-elf/rtld.c
libexec/rtld-elf/rtld.h