git: rtld: Fix ELF filter implementation
John Marino
marino at crater.dragonflybsd.org
Sun Mar 25 04:28:45 PDT 2012
commit 3f04b942847833b9613fd053cbf4379ab352f8b8
Author: John Marino <draco at marino.st>
Date: Sun Mar 25 12:28:13 2012 +0200
rtld: Fix ELF filter implementation
Vertatim from FreeBSD SVN 233231 (20 March 2012):
Do not relocate twice an object which happens to be needed by loaded
binary (or dso) and some filtee opened due to symbol resolution when
relocating need objects. Record the state of the relocation
processing in Obj_Entry and short-circuit relocate_objects() if
current object already processed.
Do not call constructors for filtees loaded during the early
relocation processing before image is initialized enough to run
user-provided code. Filtees are loaded using dlopen_object(), which
normally performs relocation and initialization. If filtee is
lazy-loaded during the relocation of dso needed by the main object,
dlopen_object() runs too earlier, when most runtime services are not
yet ready.
Postpone the constructors call to the time when main binary and
depended libraries constructors are run, passing the new flag
RTLD_LO_EARLY to dlopen_object(). Symbol lookups callers inform
symlook_* functions about early stage of initialization with
SYMLOOK_EARLY. Pass flags through all functions participating in
object relocation.
Use the opportunity and fix flags argument to find_symdef() in
arch-specific reloc.c to use proper name SYMLOOK_IN_PLT instead of
true, which happen to have the same numeric value.
Summary of changes:
libexec/rtld-elf/i386/reloc.c | 30 ++++++++-------
libexec/rtld-elf/rtld.c | 78 ++++++++++++++++++++++++++++-----------
libexec/rtld-elf/rtld.h | 11 ++++-
libexec/rtld-elf/x86_64/reloc.c | 34 +++++++++--------
4 files changed, 98 insertions(+), 55 deletions(-)
http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/3f04b942847833b9613fd053cbf4379ab352f8b8
--
DragonFly BSD source repository
More information about the Commits
mailing list