Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 6 Jul 2020 11:57:59 +0000 (UTC)
From:      Leandro Lupori <luporl@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r362958 - head/libexec/rtld-elf
Message-ID:  <202007061157.066BvxTI014819@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: luporl
Date: Mon Jul  6 11:57:59 2020
New Revision: 362958
URL: https://svnweb.freebsd.org/changeset/base/362958

Log:
  Handle non-PLT GNU IFUNC relocations in rtld
  
  In the last IFUNC related changes to rtld, the code that handled non-PLT
  GNU IFUNC relocations ended up getting lost. This could leave some
  relocations unhandled, causing crashes or misbehavior. This change restores
  the handling of these relocations, but now together with the other IFUNC
  relocations, allowing resolvers to reference external symbols.
  
  Reviewed by:	kib
  MFC after:	2 weeks
  Sponsored by:	Eldorado Research Institute (eldorado.org.br)
  Differential Revision:	https://reviews.freebsd.org/D25550

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

Modified: head/libexec/rtld-elf/rtld.c
==============================================================================
--- head/libexec/rtld-elf/rtld.c	Mon Jul  6 10:05:35 2020	(r362957)
+++ head/libexec/rtld-elf/rtld.c	Mon Jul  6 11:57:59 2020	(r362958)
@@ -3111,7 +3111,8 @@ resolve_object_ifunc(Obj_Entry *obj, bool bind_now, in
 		return (0);
 	obj->ifuncs_resolved = true;
 	if (!obj->irelative && !obj->irelative_nonplt &&
-	    !((obj->bind_now || bind_now) && obj->gnu_ifunc))
+	    !((obj->bind_now || bind_now) && obj->gnu_ifunc) &&
+	    !obj->non_plt_gnu_ifunc)
 		return (0);
 	if (obj_disable_relro(obj) == -1 ||
 	    (obj->irelative && reloc_iresolve(obj, lockstate) == -1) ||
@@ -3119,6 +3120,8 @@ resolve_object_ifunc(Obj_Entry *obj, bool bind_now, in
 	    lockstate) == -1) ||
 	    ((obj->bind_now || bind_now) && obj->gnu_ifunc &&
 	    reloc_gnu_ifunc(obj, flags, lockstate) == -1) ||
+	    (obj->non_plt_gnu_ifunc && reloc_non_plt(obj, &obj_rtld,
+	    flags | SYMLOOK_IFUNC, lockstate) == -1) ||
 	    obj_enforce_relro(obj) == -1)
 		return (-1);
 	return (0);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202007061157.066BvxTI014819>