Author: markj
Date: Fri Nov 13 01:25:02 2015
New Revision: 290737
URL: https://svnweb.freebsd.org/changeset/base/290737

Log:
  MFC r290320:
  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.

Modified:
  stable/10/sys/kern/link_elf.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/kern/link_elf.c
==============================================================================
--- stable/10/sys/kern/link_elf.c       Fri Nov 13 01:03:59 2015        
(r290736)
+++ stable/10/sys/kern/link_elf.c       Fri Nov 13 01:25:02 2015        
(r290737)
@@ -1544,6 +1544,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;
_______________________________________________
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"

Reply via email to