diff options
author | kib <kib@FreeBSD.org> | 2017-03-29 10:59:46 +0000 |
---|---|---|
committer | kib <kib@FreeBSD.org> | 2017-03-29 10:59:46 +0000 |
commit | 8c7458908683635acf91691601f8a542f4067505 (patch) | |
tree | b3fbe74f5d9fb8d365fadabcc669a556deb29442 | |
parent | 70e6c4dadf51f74895990794605450febe97cede (diff) | |
download | FreeBSD-src-8c7458908683635acf91691601f8a542f4067505.zip FreeBSD-src-8c7458908683635acf91691601f8a542f4067505.tar.gz |
MFC r309068 (by jhb):
Fix _mips_rtld_bind() to handle ELF filters.
-rw-r--r-- | libexec/rtld-elf/mips/reloc.c | 15 | ||||
-rw-r--r-- | libexec/rtld-elf/rtld.c | 4 |
2 files changed, 15 insertions, 4 deletions
diff --git a/libexec/rtld-elf/mips/reloc.c b/libexec/rtld-elf/mips/reloc.c index 4d22fcb..a3ba2f4 100644 --- a/libexec/rtld-elf/mips/reloc.c +++ b/libexec/rtld-elf/mips/reloc.c @@ -240,10 +240,17 @@ _mips_rtld_bind(Obj_Entry *obj, Elf_Size reloff) Elf_Addr *got = obj->pltgot; const Elf_Sym *def; const Obj_Entry *defobj; + Elf_Addr *where; Elf_Addr target; + RtldLockState lockstate; + rlock_acquire(rtld_bind_lock, &lockstate); + if (sigsetjmp(lockstate.env, 0) != 0) + lock_upgrade(rtld_bind_lock, &lockstate); + + where = &got[obj->local_gotno + reloff - obj->gotsym]; def = find_symdef(reloff, obj, &defobj, SYMLOOK_IN_PLT, NULL, - NULL); + &lockstate); if (def == NULL) rtld_die(); @@ -251,9 +258,9 @@ _mips_rtld_bind(Obj_Entry *obj, Elf_Size reloff) dbg("bind now/fixup at %s sym # %jd in %s --> was=%p new=%p", obj->path, (intmax_t)reloff, defobj->strtab + def->st_name, - (void *)got[obj->local_gotno + reloff - obj->gotsym], - (void *)target); - got[obj->local_gotno + reloff - obj->gotsym] = target; + (void *)*where, (void *)target); + *where = target; + lock_release(rtld_bind_lock, &lockstate); return (Elf_Addr)target; } diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c index 6b65042..a3def35 100644 --- a/libexec/rtld-elf/rtld.c +++ b/libexec/rtld-elf/rtld.c @@ -702,6 +702,10 @@ rtld_resolve_ifunc(const Obj_Entry *obj, const Elf_Sym *def) return ((void *)target); } +/* + * NB: MIPS uses a private version of this function (_mips_rtld_bind). + * Changes to this function should be applied there as well. + */ Elf_Addr _rtld_bind(Obj_Entry *obj, Elf_Size reloff) { |