Author: kib
Date: Wed Mar 27 22:35:28 2019
New Revision: 345620
URL: https://svnweb.freebsd.org/changeset/base/345620

Log:
  rtld: disable relro enforcement for irelative relocation processing.
  
  This fixes yet another breakage for relro + bind now.
  
  Reported by:  emaste
  Sponsored by: The FreeBSD Foundation
  MFC after:    3 days

Modified:
  head/libexec/rtld-elf/rtld.c

Modified: head/libexec/rtld-elf/rtld.c
==============================================================================
--- head/libexec/rtld-elf/rtld.c        Wed Mar 27 22:27:25 2019        
(r345619)
+++ head/libexec/rtld-elf/rtld.c        Wed Mar 27 22:35:28 2019        
(r345620)
@@ -2956,14 +2956,14 @@ resolve_object_ifunc(Obj_Entry *obj, bool bind_now, in
        if (obj->ifuncs_resolved)
                return (0);
        obj->ifuncs_resolved = true;
-       if (obj->irelative && reloc_iresolve(obj, lockstate) == -1)
+       if (!obj->irelative && !((obj->bind_now || bind_now) && obj->gnu_ifunc))
+               return (0);
+       if (obj_disable_relro(obj) == -1 ||
+           (obj->irelative && reloc_iresolve(obj, lockstate) == -1) ||
+           ((obj->bind_now || bind_now) && obj->gnu_ifunc &&
+           reloc_gnu_ifunc(obj, flags, lockstate) == -1) ||
+           obj_enforce_relro(obj) == -1)
                return (-1);
-       if ((obj->bind_now || bind_now) && obj->gnu_ifunc) {
-               if (obj_disable_relro(obj) ||
-                   reloc_gnu_ifunc(obj, flags, lockstate) == -1 ||
-                   obj_enforce_relro(obj))
-                       return (-1);
-       }
        return (0);
 }
 


_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to