Date: Thu, 9 Feb 2017 23:33:06 +0000 (UTC) From: Konstantin Belousov <kib@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r313494 - head/libexec/rtld-elf Message-ID: <201702092333.v19NX6Ll026723@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: kib Date: Thu Feb 9 23:33:06 2017 New Revision: 313494 URL: https://svnweb.freebsd.org/changeset/base/313494 Log: Handle protected symbols in rtld. Protected symbol reference in GOT of the defining object must be resolved to itself, same as -Bsymbolic globally. Discussed with: emaste Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D9317 Modified: head/libexec/rtld-elf/rtld.c Modified: head/libexec/rtld-elf/rtld.c ============================================================================== --- head/libexec/rtld-elf/rtld.c Thu Feb 9 23:32:03 2017 (r313493) +++ head/libexec/rtld-elf/rtld.c Thu Feb 9 23:33:06 2017 (r313494) @@ -3957,15 +3957,19 @@ symlook_default(SymLook *req, const Obj_ donelist_init(&donelist); symlook_init_from_req(&req1, req); - /* Look first in the referencing object if linked symbolically. */ - if (refobj->symbolic && !donelist_check(&donelist, refobj)) { - res = symlook_obj(&req1, refobj); - if (res == 0) { - req->sym_out = req1.sym_out; - req->defobj_out = req1.defobj_out; - assert(req->defobj_out != NULL); - } + /* + * Look first in the referencing object if linked symbolically, + * and similarly handle protected symbols. + */ + res = symlook_obj(&req1, refobj); + if (res == 0 && (refobj->symbolic || + ELF_ST_VISIBILITY(req1.sym_out->st_other) == STV_PROTECTED)) { + req->sym_out = req1.sym_out; + req->defobj_out = req1.defobj_out; + assert(req->defobj_out != NULL); } + if (refobj->symbolic || req->defobj_out != NULL) + donelist_check(&donelist, refobj); symlook_global(req, &donelist);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201702092333.v19NX6Ll026723>