1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-11-30 08:19:09 +00:00

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
This commit is contained in:
Konstantin Belousov 2017-02-09 23:33:06 +00:00
parent 148ed9d8c1
commit 6d20836aa7
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=313494

View File

@ -3957,15 +3957,19 @@ symlook_default(SymLook *req, const Obj_Entry *refobj)
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);