ALT Linux Bugzilla
– Attachment 13969 Details for
Bug 47098
glibc: поддержка архитектуры LoongArch (lp64d ABI)
New bug
|
Search
|
[?]
|
Help
Register
|
Log In
[x]
|
Forgot Password
Login:
[x]
|
EN
|
RU
[patch]
патч для ld.so
0001-LoongArch-rtld-avoid-segfaults-when-tracing.patch (text/plain), 2.01 KB, created by
Alexey Sheplyakov
on 2023-08-02 15:41:09 MSK
(
hide
)
Description:
патч для ld.so
Filename:
MIME Type:
Creator:
Alexey Sheplyakov
Created:
2023-08-02 15:41:09 MSK
Size:
2.01 KB
patch
obsolete
>From d5e4a13128d47e852b47a1b4c86c1a97bbd7da4c Mon Sep 17 00:00:00 2001 >From: Alexey Sheplyakov <asheplyakov@basealt.ru> >Date: Thu, 20 Jul 2023 08:56:17 +0400 >Subject: [PATCH 1/2] LoongArch: rtld: avoid segfaults when tracing > >cat > test.c <<EOF >struct THD; >extern __thread struct THD *current_thd; >void *test() { return current_thd; } >EOF > >gcc -ftls-model=initial-exec -shared -fPIC -o libtest.so test.c >env LD_TRACE_LOADED_OBJECTS=1 LD_WARN=1 LD_BIND_NOW=1 /lib64/ld-linux-loongarch-lp64d.so.1 ./libtest.so > statically linked >undefined symbol: current_thd (./libtest.so) >Segmentation fault > >This failure is particularly annoying since the above tracing command >is used when building RPM packages. > >This patch adds missing checks for NULL in LoongArch specific >elf_machine_rela function to avoid the problem. >--- > sysdeps/loongarch/dl-machine.h | 13 +++++++++---- > 1 file changed, 9 insertions(+), 4 deletions(-) > >diff --git a/sysdeps/loongarch/dl-machine.h b/sysdeps/loongarch/dl-machine.h >index 1e07d124f9..0bd158f0af 100644 >--- a/sysdeps/loongarch/dl-machine.h >+++ b/sysdeps/loongarch/dl-machine.h >@@ -175,16 +175,21 @@ elf_machine_rela (struct link_map *map, struct r_scope_elem *scope[], > > #ifndef RTLD_BOOTSTRAP > case __WORDSIZE == 64 ? R_LARCH_TLS_DTPMOD64 : R_LARCH_TLS_DTPMOD32: >- *addr_field = sym_map->l_tls_modid; >+ if (sym_map) >+ *addr_field = sym_map->l_tls_modid; > break; > > case __WORDSIZE == 64 ? R_LARCH_TLS_DTPREL64 : R_LARCH_TLS_DTPREL32: >- *addr_field = TLS_DTPREL_VALUE (sym) + reloc->r_addend; >+ if (sym != NULL) >+ *addr_field = TLS_DTPREL_VALUE (sym) + reloc->r_addend; > break; > > case __WORDSIZE == 64 ? R_LARCH_TLS_TPREL64 : R_LARCH_TLS_TPREL32: >- CHECK_STATIC_TLS (map, sym_map); >- *addr_field = TLS_TPREL_VALUE (sym_map, sym) + reloc->r_addend; >+ if (sym != NULL && sym_map != NULL) >+ { >+ CHECK_STATIC_TLS (map, sym_map); >+ *addr_field = TLS_TPREL_VALUE (sym_map, sym) + reloc->r_addend; >+ } > break; > > case R_LARCH_COPY: >-- >2.33.8 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 47098
: 13969 |
13970