summaryrefslogtreecommitdiffstats
path: root/sys/kern
diff options
context:
space:
mode:
authormarkj <markj@FreeBSD.org>2015-11-13 01:25:02 +0000
committermarkj <markj@FreeBSD.org>2015-11-13 01:25:02 +0000
commit2f7340b2834385328346377b624f6b4694749e02 (patch)
tree2a2a782ffe9d046159e584960af9c59b0fccd7f6 /sys/kern
parent63e6b748374f5613b5b76e9beb6bceb75df45323 (diff)
downloadFreeBSD-src-2f7340b2834385328346377b624f6b4694749e02.zip
FreeBSD-src-2f7340b2834385328346377b624f6b4694749e02.tar.gz
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.
Diffstat (limited to 'sys/kern')
-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 b4f6586..3b03d6f 100644
--- a/sys/kern/link_elf.c
+++ b/sys/kern/link_elf.c
@@ -1544,6 +1544,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