From: Rich Felker Date: Thu, 4 Jun 2015 15:45:17 +0000 (-0400) Subject: fix dynamic linker regression processing R_*_NONE type relocations X-Git-Tag: v1.1.10~1 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=b6a6cd703ffefa6352249fb01f4da28d85d17306;p=oweals%2Fmusl.git fix dynamic linker regression processing R_*_NONE type relocations commit f3ddd173806fd5c60b3f034528ca24542aecc5b9 inadvertently removed the early check for "none" type relocations, causing the address dso->base+0 to be dereferenced to obtain an addend. shared libraries, (including libc.so) and PIE executables were unaffected, since their base addresses are the actual address of their mappings and are readable. non-PIE main executables, however, have a base address of 0 because their load addresses are absolute and not offset at load time. in practice none-type relocations do not arise with toolchains that are in use except on mips, and on mips it's moderately rare for a non-PIE executable to have a relocation table, since the mips-specific got processing serves in its place for most purposes. --- diff --git a/src/ldso/dynlink.c b/src/ldso/dynlink.c index 42930adf..42b056d2 100644 --- a/src/ldso/dynlink.c +++ b/src/ldso/dynlink.c @@ -270,6 +270,7 @@ static void do_relocs(struct dso *dso, size_t *rel, size_t rel_size, size_t stri for (; rel_size; rel+=stride, rel_size-=stride*sizeof(size_t)) { if (skip_relative && IS_RELATIVE(rel[1])) continue; type = R_TYPE(rel[1]); + if (type == REL_NONE) continue; sym_index = R_SYM(rel[1]); reloc_addr = (void *)(base + rel[0]); if (sym_index) {