Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 3 Nov 2015 03:29:35 +0000 (UTC)
From:      Mark Johnston <markj@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r290320 - head/sys/kern
Message-ID:  <201511030329.tA33TZVv072270@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: markj
Date: Tue Nov  3 03:29:35 2015
New Revision: 290320
URL: https://svnweb.freebsd.org/changeset/base/290320

Log:
  Have elf_lookup() return an error if the specified non-weak symbol could
  not be found. Otherwise, relocations against such symbols will be silently
  ignored instead of causing an error to be raised.
  
  Reviewed by:	kib
  MFC after:	1 week

Modified:
  head/sys/kern/link_elf.c

Modified: head/sys/kern/link_elf.c
==============================================================================
--- head/sys/kern/link_elf.c	Tue Nov  3 00:54:14 2015	(r290319)
+++ head/sys/kern/link_elf.c	Tue Nov  3 03:29:35 2015	(r290320)
@@ -1594,6 +1594,10 @@ elf_lookup(linker_file_t lf, Elf_Size sy
 	}
 
 	addr = ((Elf_Addr)linker_file_lookup_symbol(lf, symbol, deps));
+	if (addr == 0 && ELF_ST_BIND(sym->st_info) != STB_WEAK) {
+		*res = 0;
+		return (EINVAL);
+	}
 
 	if (elf_set_find(&set_pcpu_list, addr, &start, &base))
 		addr = addr - start + base;



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