Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 5 Sep 2020 22:41:31 +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: r365368 - head/libexec/rtld-elf
Message-ID:  <202009052241.085MfV9b058901@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Sat Sep  5 22:41:31 2020
New Revision: 365368
URL: https://svnweb.freebsd.org/changeset/base/365368

Log:
  rtld: do not process absent dynamic.
  
  If object has no dynamic phdr, do not try to dereference NULL.  This
  means that we cannot process any relocation, and that there cannot be
  symbols defined, but it is up to static linker to produce meaningful
  objects.
  
  PR:	249121
  Reported by:	wsh@riski.sh
  Sponsored by:	The FreeBSD Foundation
  MFC after:	1 week

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

Modified: head/libexec/rtld-elf/rtld.c
==============================================================================
--- head/libexec/rtld-elf/rtld.c	Sat Sep  5 20:22:02 2020	(r365367)
+++ head/libexec/rtld-elf/rtld.c	Sat Sep  5 22:41:31 2020	(r365368)
@@ -1089,7 +1089,10 @@ digest_dynamic1(Obj_Entry *obj, int early, const Elf_D
     *dyn_runpath = NULL;
 
     obj->bind_now = false;
-    for (dynp = obj->dynamic;  dynp->d_tag != DT_NULL;  dynp++) {
+    dynp = obj->dynamic;
+    if (dynp == NULL)
+	return;
+    for (;  dynp->d_tag != DT_NULL;  dynp++) {
 	switch (dynp->d_tag) {
 
 	case DT_REL:



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