Author: kib
Date: Thu Feb 23 07:39:01 2017
New Revision: 314128
URL: https://svnweb.freebsd.org/changeset/base/314128

Log:
  MFC r313494:
  Handle protected symbols in rtld.

Modified:
  stable/11/libexec/rtld-elf/rtld.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/libexec/rtld-elf/rtld.c
==============================================================================
--- stable/11/libexec/rtld-elf/rtld.c   Thu Feb 23 07:28:29 2017        
(r314127)
+++ stable/11/libexec/rtld-elf/rtld.c   Thu Feb 23 07:39:01 2017        
(r314128)
@@ -3952,15 +3952,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);
 
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to