about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2022-11-10 09:02:02 -0500
committerRich Felker <dalias@aerifal.cx>2022-11-10 09:02:02 -0500
commit29e4319178cbc2a4e9f058a99ae8098d4b6ac055 (patch)
tree22f6d38857fdbd5137372dc15c81dec4200e7530
parentb50eb8c36c20f967bd0ed70c0b0db38a450886ba (diff)
downloadmusl-29e4319178cbc2a4e9f058a99ae8098d4b6ac055.tar.gz
musl-29e4319178cbc2a4e9f058a99ae8098d4b6ac055.tar.xz
musl-29e4319178cbc2a4e9f058a99ae8098d4b6ac055.zip
fix double-processing of DT_RELR relocations in ldso relocating itself
this is analogous to skip_relative logic in do_relocs -- because
relative relocations for the dynamic linker itself were already
performed at entry (stage 1), they must not be applied again.
-rw-r--r--ldso/dynlink.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/ldso/dynlink.c b/ldso/dynlink.c
index 7b47b163..8068fb37 100644
--- a/ldso/dynlink.c
+++ b/ldso/dynlink.c
@@ -552,6 +552,7 @@ static void do_relocs(struct dso *dso, size_t *rel, size_t rel_size, size_t stri
 
 static void do_relr_relocs(struct dso *dso, size_t *relr, size_t relr_size)
 {
+	if (dso == &ldso) return; /* self-relocation was done in _dlstart */
 	unsigned char *base = dso->base;
 	size_t *reloc_addr;
 	for (; relr_size; relr++, relr_size-=sizeof(size_t))