summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authormarkj <markj@FreeBSD.org>2015-11-03 03:29:35 +0000
committermarkj <markj@FreeBSD.org>2015-11-03 03:29:35 +0000
commit70321eeb6da6bc19d564844ec8225b67a8f22806 (patch)
tree3bd8acc33716bc3c9da06fc5c8b7e8df9a051a06 /sys
parent91183250ec200d84f490817cfdd0bcfd16bf2661 (diff)
downloadFreeBSD-src-70321eeb6da6bc19d564844ec8225b67a8f22806.zip
FreeBSD-src-70321eeb6da6bc19d564844ec8225b67a8f22806.tar.gz
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
Diffstat (limited to 'sys')
-rw-r--r--sys/kern/link_elf.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/sys/kern/link_elf.c b/sys/kern/link_elf.c
index c931ae9..d73c12d 100644
--- a/sys/kern/link_elf.c
+++ b/sys/kern/link_elf.c
@@ -1594,6 +1594,10 @@ elf_lookup(linker_file_t lf, Elf_Size symidx, int deps, Elf_Addr *res)
}
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;
OpenPOWER on IntegriCloud