diff options
author | Adhemerval Zanella <adhemerval.zanella@linaro.org> | 2023-07-10 17:01:00 -0300 |
---|---|---|
committer | Adhemerval Zanella <adhemerval.zanella@linaro.org> | 2023-07-12 15:29:08 -0300 |
commit | dddc88587a7f48cbb361d9929ec23d790164eef8 (patch) | |
tree | 5d68ec2c777263280278fd1a4cafad19f2c16fcc /elf | |
parent | ca230f5833d699a35778f83b3ab646ba37f6f66c (diff) | |
download | glibc-dddc88587a7f48cbb361d9929ec23d790164eef8.zip glibc-dddc88587a7f48cbb361d9929ec23d790164eef8.tar.gz glibc-dddc88587a7f48cbb361d9929ec23d790164eef8.tar.bz2 |
sparc: Fix la_symbind for bind-now (BZ 23734)
The sparc ABI has multiple cases on how to handle JMP_SLOT relocations,
(sparc_fixup_plt/sparc64_fixup_plt). For BINDNOW, _dl_audit_symbind
will be responsible to setup the final relocation value; while for
lazy binding _dl_fixup/_dl_profile_fixup will call the audit callback
and tail cail elf_machine_fixup_plt (which will call
sparc64_fixup_plt).
This patch fixes by issuing the SPARC specific routine on bindnow and
forwarding the audit value to elf_machine_fixup_plt for lazy resolution.
It fixes the la_symbind for bind-now tests on sparc64 and sparcv9:
elf/tst-audit24a
elf/tst-audit24b
elf/tst-audit24c
elf/tst-audit24d
Checked on sparc64-linux-gnu and sparcv9-linux-gnu.
Tested-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
Diffstat (limited to 'elf')
-rw-r--r-- | elf/dl-audit.c | 6 | ||||
-rw-r--r-- | elf/dl-runtime.c | 5 | ||||
-rw-r--r-- | elf/do-rel.h | 6 |
3 files changed, 10 insertions, 7 deletions
diff --git a/elf/dl-audit.c b/elf/dl-audit.c index 00e794a..81543f8 100644 --- a/elf/dl-audit.c +++ b/elf/dl-audit.c @@ -176,8 +176,8 @@ rtld_hidden_def (_dl_audit_symbind_alt) void _dl_audit_symbind (struct link_map *l, struct reloc_result *reloc_result, - const ElfW(Sym) *defsym, DL_FIXUP_VALUE_TYPE *value, - lookup_t result) + const void *reloc, const ElfW(Sym) *defsym, + DL_FIXUP_VALUE_TYPE *value, lookup_t result, bool lazy) { bool for_jmp_slot = reloc_result == NULL; @@ -259,7 +259,7 @@ _dl_audit_symbind (struct link_map *l, struct reloc_result *reloc_result, } if (flags & LA_SYMB_ALTVALUE) - DL_FIXUP_BINDNOW_RELOC (value, new_value, sym.st_value); + DL_FIXUP_BINDNOW_RELOC (l, reloc, value, new_value, sym.st_value, lazy); } void diff --git a/elf/dl-runtime.c b/elf/dl-runtime.c index d35a725..32a8bfc 100644 --- a/elf/dl-runtime.c +++ b/elf/dl-runtime.c @@ -139,7 +139,7 @@ _dl_fixup ( unsigned int init = atomic_load_acquire (&reloc_result->init); if (init == 0) { - _dl_audit_symbind (l, reloc_result, sym, &value, result); + _dl_audit_symbind (l, reloc_result, reloc, sym, &value, result, true); /* Store the result for later runs. */ if (__glibc_likely (! GLRO(dl_bind_not))) @@ -314,7 +314,8 @@ _dl_profile_fixup ( auditing libraries the possibility to change the value and tell us whether further auditing is wanted. */ if (defsym != NULL && GLRO(dl_naudit) > 0) - _dl_audit_symbind (l, reloc_result, defsym, &value, result); + _dl_audit_symbind (l, reloc_result, reloc, defsym, &value, result, + true); #endif /* Store the result for later runs. */ diff --git a/elf/do-rel.h b/elf/do-rel.h index 7e1cc445..ea973b1 100644 --- a/elf/do-rel.h +++ b/elf/do-rel.h @@ -154,7 +154,8 @@ elf_dynamic_do_Rel (struct link_map *map, struct r_scope_elem *scope[], = RESOLVE_MAP (map, scope, &sym, rversion, ELF_MACHINE_JMP_SLOT); if (sym != NULL) - _dl_audit_symbind (map, NULL, sym, r_addr_arg, sym_map); + _dl_audit_symbind (map, NULL, r, sym, r_addr_arg, sym_map, + false); } #endif } @@ -200,7 +201,8 @@ elf_dynamic_do_Rel (struct link_map *map, struct r_scope_elem *scope[], (struct r_found_version *) NULL, ELF_MACHINE_JMP_SLOT); if (sym != NULL) - _dl_audit_symbind (map, NULL , sym,r_addr_arg, sym_map); + _dl_audit_symbind (map, NULL, r, sym,r_addr_arg, sym_map, + false); } # endif } |