29e4319178cbc2a4e9f058a99ae8098d4b6ac055 981 B

1234567891011121314151617181920212223242526272829
  1. From 29e4319178cbc2a4e9f058a99ae8098d4b6ac055 Mon Sep 17 00:00:00 2001
  2. From: Rich Felker <dalias@aerifal.cx>
  3. Date: Thu, 10 Nov 2022 09:02:02 -0500
  4. Subject: fix double-processing of DT_RELR relocations in ldso relocating
  5. itself
  6. this is analogous to skip_relative logic in do_relocs -- because
  7. relative relocations for the dynamic linker itself were already
  8. performed at entry (stage 1), they must not be applied again.
  9. ---
  10. ldso/dynlink.c | 1 +
  11. 1 file changed, 1 insertion(+)
  12. diff --git a/ldso/dynlink.c b/ldso/dynlink.c
  13. index 7b47b163..8068fb37 100644
  14. --- a/ldso/dynlink.c
  15. +++ b/ldso/dynlink.c
  16. @@ -552,6 +552,7 @@ static void do_relocs(struct dso *dso, size_t *rel, size_t rel_size, size_t stri
  17. static void do_relr_relocs(struct dso *dso, size_t *relr, size_t relr_size)
  18. {
  19. + if (dso == &ldso) return; /* self-relocation was done in _dlstart */
  20. unsigned char *base = dso->base;
  21. size_t *reloc_addr;
  22. for (; relr_size; relr++, relr_size-=sizeof(size_t))
  23. --
  24. cgit v1.2.1