sysdeps/generic/ldsodefs.h has #define ELF_RTYPE_CLASS_PLT 1 #ifndef DL_NO_COPY_RELOCS # define ELF_RTYPE_CLASS_COPY 2 #else # define ELF_RTYPE_CLASS_COPY 0 #endif /* If DL_EXTERN_PROTECTED_DATA is defined, address of protected data defined in the shared library may be external, i.e., due to copy relocation. */ #ifdef DL_EXTERN_PROTECTED_DATA # define ELF_RTYPE_CLASS_EXTERN_PROTECTED_DATA 4 #else # define ELF_RTYPE_CLASS_EXTERN_PROTECTED_DATA 0 #endif and _dl_debug_bindings in elf/dl-lookup.c has if (value->s) { if (__glibc_unlikely (ELFW(ST_TYPE) (value->s->st_info) == STT_TLS)) type_class = 4; else if (__glibc_unlikely (ELFW(ST_TYPE) (value->s->st_info) == STT_GNU_IFUNC)) type_class |= 8; } if (conflict || GLRO(dl_trace_prelink_map) == undef_map || GLRO(dl_trace_prelink_map) == NULL || type_class >= 4) {
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GNU C Library master sources". The branch, hjl/pr19178/master has been created at 6ecf7e3fafbadcd6e8d9dcb9d115e47f4d7868fb (commit) - Log ----------------------------------------------------------------- https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=6ecf7e3fafbadcd6e8d9dcb9d115e47f4d7868fb commit 6ecf7e3fafbadcd6e8d9dcb9d115e47f4d7868fb Author: H.J. Lu <hjl.tools@gmail.com> Date: Wed Oct 28 04:43:26 2015 -0700 Define ELF_RTYPE_CLASS_TLS/ELF_RTYPE_CLASS_IFUNC _dl_debug_bindings updates relocation type class with 4 and 8. But ELF_RTYPE_CLASS_EXTERN_PROTECTED_DATA may be defined to 4. This patch adds ELF_RTYPE_CLASS_TLS/ELF_RTYPE_CLASS_IFUNC and use them in _dl_debug_bindings. [BZ #19178] * dl-lookup.c (_dl_debug_bindings): Replace 4 and 8 with ELF_RTYPE_CLASS_TLS and ELF_RTYPE_CLASS_IFUNC. * sysdeps/generic/ldsodefs.h (ELF_RTYPE_CLASS_TLS): New. (ELF_RTYPE_CLASS_IFUNC): Likewise. -----------------------------------------------------------------------
Apparently, prelink does argv[i] = NULL; envp[0] = "LD_TRACE_LOADED_OBJECTS=1"; envp[1] = "LD_BIND_NOW=1"; p = alloca (sizeof "LD_TRACE_PRELINKING=" + strlen (info->ent->filename)); strcpy (stpcpy (p, "LD_TRACE_PRELINKING="), info->ent->filename); envp[2] = p; envp[3] = NULL; ret = 2; f = execve_open (dl, (char * const *)argv, (char * const *)envp); if (f == NULL) { error (0, errno, "%s: Could not trace symbol resolving", info->ent->filename); return 0; } to get relocation type from ld.so and has #define RTYPE_CLASS_VALID 8 #define RTYPE_CLASS_PLT (8|1) #define RTYPE_CLASS_COPY (8|2) #define RTYPE_CLASS_TLS (8|4)
The interface between glibc's rtld (ld.so) and prelink is determined by the setting of the LD_TRACE_PRELINKING option. This option in turn sets: GLRO_dl_debug_mask |= DL_DEBUG_PRELINK as well as defines the GLRO(dl_trace_prelink_map). Since the thing that matters in this case is that both the prelinker and glibc agree on the common values for the 'type_class' field. It may be reasonable to do a conversion if DL_DEBUG_PRELINK is enabled to matching prelink values. This would permit the same values to be used in both older and newer prelink. The alternative is to do something like: #define ELF_RTYPE_CLASS_PLT 1 #define ELF_RTYPE_CLASS_COPY 2 #define ELF_RTYPE_CLASS_TLS 4 #define ELF_RTYPE_CLASS_IFUNC 8 #define ELF_RTYPE_CLASS_EXTERN_PROTECTED_DATA 16 (was 4) This would preserve previous behavior (glibc 2.21 and before) and add the new type as '16'. I do not know though if this is "ok", in that the users of ELF_RTYPE_CLASS_EXTERN_PROTECTED_DATA inside of glibc itself could be affected. If this value is used internally -- it shouldn't cause any problems, otherwise we've got the potential issue of other things not understanding the value was changed.
Created attachment 8754 [details] A patch
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GNU C Library master sources". The branch, hjl/pr19178/master has been created at d8952eb0d100475c74c5f282ac32519389ee3e0c (commit) - Log ----------------------------------------------------------------- https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=d8952eb0d100475c74c5f282ac32519389ee3e0c commit d8952eb0d100475c74c5f282ac32519389ee3e0c Author: H.J. Lu <hjl.tools@gmail.com> Date: Wed Oct 28 07:49:44 2015 -0700 Clear ELF_RTYPE_CLASS_EXTERN_PROTECTED_DATA for prelink prelink runs ld.so with the environment variable LD_TRACE_PRELINKING set to dump the relocation type class from _dl_debug_bindings. prelink has the following relocation type classes: where ELF_RTYPE_CLASS_EXTERN_PROTECTED_DATA has a conflict with RTYPE_CLASS_TLS. Since prelink doesn't use ELF_RTYPE_CLASS_EXTERN_PROTECTED_DATA, we should clear the ELF_RTYPE_CLASS_EXTERN_PROTECTED_DATA bit when the DL_DEBUG_PRELINK bit is set. [BZ #19178] * elf/dl-lookup.c (RTYPE_CLASS_VALID): New. (RTYPE_CLASS_PLT): Likewise. (RTYPE_CLASS_COPY): Likewise. (RTYPE_CLASS_TLS): Likewise. (_dl_debug_bindings): Use RTYPE_CLASS_TLS and RTYPE_CLASS_VALID to set relocation type class for DL_DEBUG_PRELINK. Clear the ELF_RTYPE_CLASS_EXTERN_PROTECTED_DATA bit for DL_DEBUG_PRELINK. -----------------------------------------------------------------------
Created attachment 8755 [details] A new patch Please try this one.
I think the logic in the patch isn't quite right. { if (__glibc_unlikely (ELFW(ST_TYPE) (value->s->st_info) == STT_TLS)) - type_class = 4; + type_class = (RTYPE_CLASS_TLS & ~RTYPE_CLASS_VALID); else if (__glibc_unlikely (ELFW(ST_TYPE) (value->s->st_info) == STT_GNU_IFUNC)) - type_class |= 8; + { + type_class |= RTYPE_CLASS_VALID; + } + /* Clear the ELF_RTYPE_CLASS_EXTERN_PROTECTED_DATA bit since + it isn't used by prelink. */ + type_class &= ~ELF_RTYPE_CLASS_EXTERN_PROTECTED_DATA(undef_map->machine); } With this change, I was able to verify that the ld.so results from 2.21 and 2.22 are producing the same values for me now. Otherwise, most of the previous '0' values have been replaced with '4'.
What I pasted still isn't correct. It's clearing the '4' that should be on the TLS values.
Created attachment 8756 [details] Revised version of HJ Lu's patch The patch attached is working for me. Moving the filtering of the EXTERN_PROTECTED_DATA before the other fixups ensures that it is always filtered first. We can then add the value of '4' for TLS and |= 8 (valid) as necessary.
Created attachment 8757 [details] A patch Please try this one.
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GNU C Library master sources". The branch, hjl/pr19178/master has been created at 1ed43952877eb3183a8093849e33c8dab0cf7ddf (commit) - Log ----------------------------------------------------------------- https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=1ed43952877eb3183a8093849e33c8dab0cf7ddf commit 1ed43952877eb3183a8093849e33c8dab0cf7ddf Author: H.J. Lu <hjl.tools@gmail.com> Date: Wed Oct 28 07:49:44 2015 -0700 Clear ELF_RTYPE_CLASS_EXTERN_PROTECTED_DATA for prelink prelink runs ld.so with the environment variable LD_TRACE_PRELINKING set to dump the relocation type class from _dl_debug_bindings. prelink has the following relocation type classes: where ELF_RTYPE_CLASS_EXTERN_PROTECTED_DATA has a conflict with RTYPE_CLASS_TLS. Since prelink doesn't use ELF_RTYPE_CLASS_EXTERN_PROTECTED_DATA, we should clear the ELF_RTYPE_CLASS_EXTERN_PROTECTED_DATA bit when the DL_DEBUG_PRELINK bit is set. [BZ #19178] * elf/dl-lookup.c (RTYPE_CLASS_VALID): New. (RTYPE_CLASS_PLT): Likewise. (RTYPE_CLASS_COPY): Likewise. (RTYPE_CLASS_TLS): Likewise. (_dl_debug_bindings): Use RTYPE_CLASS_TLS and RTYPE_CLASS_VALID to set relocation type class for DL_DEBUG_PRELINK. Clear the ELF_RTYPE_CLASS_EXTERN_PROTECTED_DATA bit for DL_DEBUG_PRELINK. -----------------------------------------------------------------------
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GNU C Library master sources". The branch, hjl/pr19178/master has been created at 7f16bc353495e6c2ec101abeee4ba26525e6c725 (commit) - Log ----------------------------------------------------------------- https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=7f16bc353495e6c2ec101abeee4ba26525e6c725 commit 7f16bc353495e6c2ec101abeee4ba26525e6c725 Author: H.J. Lu <hjl.tools@gmail.com> Date: Wed Oct 28 07:49:44 2015 -0700 Keep only ELF_RTYPE_CLASS_{PLT|COPY} bits for prelink prelink runs ld.so with the environment variable LD_TRACE_PRELINKING set to dump the relocation type class from _dl_debug_bindings. prelink has the following relocation type classes: #define RTYPE_CLASS_VALID 8 #define RTYPE_CLASS_PLT (8|1) #define RTYPE_CLASS_COPY (8|2) #define RTYPE_CLASS_TLS (8|4) where ELF_RTYPE_CLASS_EXTERN_PROTECTED_DATA has a conflict with RTYPE_CLASS_TLS. Since prelink only uses ELF_RTYPE_CLASS_PLT and ELF_RTYPE_CLASS_COPY bits, we should clear the other bits when the DL_DEBUG_PRELINK bit is set. [BZ #19178] * elf/dl-lookup.c (RTYPE_CLASS_VALID): New. (RTYPE_CLASS_PLT): Likewise. (RTYPE_CLASS_COPY): Likewise. (RTYPE_CLASS_TLS): Likewise. (_dl_debug_bindings): Use RTYPE_CLASS_TLS and RTYPE_CLASS_VALID to set relocation type class for DL_DEBUG_PRELINK. Keep only ELF_RTYPE_CLASS_PLT and ELF_RTYPE_CLASS_COPY bits for DL_DEBUG_PRELINK. -----------------------------------------------------------------------
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GNU C Library master sources". The branch, hjl/pr19178/master has been created at cadaf1336332ca7bcdfe4a400776e5782a20e26d (commit) - Log ----------------------------------------------------------------- https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=cadaf1336332ca7bcdfe4a400776e5782a20e26d commit cadaf1336332ca7bcdfe4a400776e5782a20e26d Author: H.J. Lu <hjl.tools@gmail.com> Date: Wed Oct 28 07:49:44 2015 -0700 Keep only ELF_RTYPE_CLASS_{PLT|COPY} bits for prelink prelink runs ld.so with the environment variable LD_TRACE_PRELINKING set to dump the relocation type class from _dl_debug_bindings. prelink has the following relocation type classes: #define RTYPE_CLASS_VALID 8 #define RTYPE_CLASS_PLT (8|1) #define RTYPE_CLASS_COPY (8|2) #define RTYPE_CLASS_TLS (8|4) where ELF_RTYPE_CLASS_EXTERN_PROTECTED_DATA has a conflict with RTYPE_CLASS_TLS. Since prelink only uses ELF_RTYPE_CLASS_PLT and ELF_RTYPE_CLASS_COPY bits, we should clear the other bits when the DL_DEBUG_PRELINK bit is set. [BZ #19178] * elf/dl-lookup.c (RTYPE_CLASS_VALID): New. (RTYPE_CLASS_PLT): Likewise. (RTYPE_CLASS_COPY): Likewise. (RTYPE_CLASS_TLS): Likewise. (_dl_debug_bindings): Use RTYPE_CLASS_TLS and RTYPE_CLASS_VALID to set relocation type class for DL_DEBUG_PRELINK. Keep only ELF_RTYPE_CLASS_PLT and ELF_RTYPE_CLASS_COPY bits for DL_DEBUG_PRELINK. -----------------------------------------------------------------------
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GNU C Library master sources". The branch, master has been updated via f3d18efb8a720121066dc3401e822043beb98cde (commit) from d699ab25d32768aaad899f9ff1e668be62c448d2 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=f3d18efb8a720121066dc3401e822043beb98cde commit f3d18efb8a720121066dc3401e822043beb98cde Author: H.J. Lu <hjl.tools@gmail.com> Date: Sat Nov 7 06:32:30 2015 -0800 Keep only ELF_RTYPE_CLASS_{PLT|COPY} bits for prelink prelink runs ld.so with the environment variable LD_TRACE_PRELINKING set to dump the relocation type class from _dl_debug_bindings. prelink has the following relocation type classes: #define RTYPE_CLASS_VALID 8 #define RTYPE_CLASS_PLT (8|1) #define RTYPE_CLASS_COPY (8|2) #define RTYPE_CLASS_TLS (8|4) where ELF_RTYPE_CLASS_EXTERN_PROTECTED_DATA has a conflict with RTYPE_CLASS_TLS. Since prelink only uses ELF_RTYPE_CLASS_PLT and ELF_RTYPE_CLASS_COPY bits, we should clear the other bits when the DL_DEBUG_PRELINK bit is set. [BZ #19178] * elf/dl-lookup.c (RTYPE_CLASS_VALID): New. (RTYPE_CLASS_PLT): Likewise. (RTYPE_CLASS_COPY): Likewise. (RTYPE_CLASS_TLS): Likewise. (_dl_debug_bindings): Use RTYPE_CLASS_TLS and RTYPE_CLASS_VALID to set relocation type class for DL_DEBUG_PRELINK. Keep only ELF_RTYPE_CLASS_PLT and ELF_RTYPE_CLASS_COPY bits for DL_DEBUG_PRELINK. ----------------------------------------------------------------------- Summary of changes: ChangeLog | 12 ++++++++++++ elf/dl-lookup.c | 21 +++++++++++++++++++-- 2 files changed, 31 insertions(+), 2 deletions(-)
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GNU C Library master sources". The branch, hjl/pr19178/master has been created at 40d3a8ab0ba5a2bcb1563becaec712ed031d2ebf (commit) - Log ----------------------------------------------------------------- https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=40d3a8ab0ba5a2bcb1563becaec712ed031d2ebf commit 40d3a8ab0ba5a2bcb1563becaec712ed031d2ebf Author: H.J. Lu <hjl.tools@gmail.com> Date: Sat Nov 7 06:35:09 2015 -0800 Add a test for prelink output This test applies to i386 and x86_64 which set R_386_GLOB_DAT and R_X86_64_GLOB_DAT to ELF_RTYPE_CLASS_EXTERN_PROTECTED_DATA. [BZ #19178] * sysdeps/x86/Makefile (tests): Add tst-prelink. (tst-prelink-ENV): New. ($(objpfx)tst-prelink-conflict.out): Likewise. ($(objpfx)tst-prelink-cmp.out): Likewise. (tests-special): Add $(objpfx)tst-prelink-cmp.out. * sysdeps/x86/tst-prelink.c: New file. * sysdeps/x86/tst-prelink.exp: Likewise. -----------------------------------------------------------------------
On Sat, 7 Nov 2015, cvs-commit at gcc dot gnu.org wrote: > commit f3d18efb8a720121066dc3401e822043beb98cde > Author: H.J. Lu <hjl.tools@gmail.com> > Date: Sat Nov 7 06:32:30 2015 -0800 > > Keep only ELF_RTYPE_CLASS_{PLT|COPY} bits for prelink Is this a full fix for the bug? If so, you need to close the bug as fixed with milestone set to 2.23. If committing to master a patch that is relevant to a bug but is not a full fix for it, please say explicitly in the commit message that it's not a full fix, as requested in <https://sourceware.org/ml/libc-alpha/2015-11/msg00096.html>, so people don't need to chase things up.
I posted a patch to add a testcase: https://sourceware.org/ml/libc-alpha/2015-11/msg00141.html I will close this bug after testcase is checked in and both patches are backported to 2.22.
The milestone cannot be 2.22 if the fix wasn't in the original 2.22 release. See <https://sourceware.org/ml/libc-alpha/2015-11/msg00096.html>: milestones reflect the first mainline release with the fix, and the list of fixed bugs in NEWS must be updated manually on release branches.
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GNU C Library master sources". The branch, master has been updated via fe534fe8980fa214c410e3661a4216e781073353 (commit) from 685312298fcc5b24ed9700bcc43787d5f83553c5 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=fe534fe8980fa214c410e3661a4216e781073353 commit fe534fe8980fa214c410e3661a4216e781073353 Author: H.J. Lu <hjl.tools@gmail.com> Date: Tue Nov 10 12:27:24 2015 -0800 Add a test for prelink output This test applies to i386 and x86_64 which set R_386_GLOB_DAT and R_X86_64_GLOB_DAT to ELF_RTYPE_CLASS_EXTERN_PROTECTED_DATA. [BZ #19178] * sysdeps/x86/Makefile (tests): Add tst-prelink. (tst-prelink-ENV): New. ($(objpfx)tst-prelink-conflict.out): Likewise. ($(objpfx)tst-prelink-cmp.out): Likewise. (tests-special): Add $(objpfx)tst-prelink-cmp.out. * sysdeps/x86/tst-prelink.c: New file. * sysdeps/x86/tst-prelink.exp: Likewise. ----------------------------------------------------------------------- Summary of changes: ChangeLog | 11 +++++++++++ sysdeps/x86/Makefile | 15 +++++++++++++++ sysdeps/{x86_64/ifuncmain8.c => x86/tst-prelink.c} | 10 ++++------ sysdeps/x86/tst-prelink.exp | 1 + 4 files changed, 31 insertions(+), 6 deletions(-) copy sysdeps/{x86_64/ifuncmain8.c => x86/tst-prelink.c} (86%) create mode 100644 sysdeps/x86/tst-prelink.exp
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GNU C Library master sources". The branch, release/2.22/master has been updated via 3cdd4ce75bc4d24aca37edc3ecec2a8890ce2551 (commit) via 387011e0b6f9cbefd26691f0df8ce76bb7ddfa03 (commit) from 5b319ce2949cf6fb97862ff81558944f76c704f1 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=3cdd4ce75bc4d24aca37edc3ecec2a8890ce2551 commit 3cdd4ce75bc4d24aca37edc3ecec2a8890ce2551 Author: H.J. Lu <hjl.tools@gmail.com> Date: Tue Nov 10 12:27:24 2015 -0800 Add a test for prelink output This test applies to i386 and x86_64 which set R_386_GLOB_DAT and R_X86_64_GLOB_DAT to ELF_RTYPE_CLASS_EXTERN_PROTECTED_DATA. [BZ #19178] * sysdeps/x86/Makefile (tests): Add tst-prelink. (tst-prelink-ENV): New. ($(objpfx)tst-prelink-conflict.out): Likewise. ($(objpfx)tst-prelink-cmp.out): Likewise. (tests-special): Add $(objpfx)tst-prelink-cmp.out. * sysdeps/x86/tst-prelink.c: New file. * sysdeps/x86/tst-prelink.exp: Likewise. (cherry picked from commit fe534fe8980fa214c410e3661a4216e781073353) https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=387011e0b6f9cbefd26691f0df8ce76bb7ddfa03 commit 387011e0b6f9cbefd26691f0df8ce76bb7ddfa03 Author: H.J. Lu <hjl.tools@gmail.com> Date: Sat Nov 7 06:32:30 2015 -0800 Keep only ELF_RTYPE_CLASS_{PLT|COPY} bits for prelink prelink runs ld.so with the environment variable LD_TRACE_PRELINKING set to dump the relocation type class from _dl_debug_bindings. prelink has the following relocation type classes: #define RTYPE_CLASS_VALID 8 #define RTYPE_CLASS_PLT (8|1) #define RTYPE_CLASS_COPY (8|2) #define RTYPE_CLASS_TLS (8|4) where ELF_RTYPE_CLASS_EXTERN_PROTECTED_DATA has a conflict with RTYPE_CLASS_TLS. Since prelink only uses ELF_RTYPE_CLASS_PLT and ELF_RTYPE_CLASS_COPY bits, we should clear the other bits when the DL_DEBUG_PRELINK bit is set. [BZ #19178] * elf/dl-lookup.c (RTYPE_CLASS_VALID): New. (RTYPE_CLASS_PLT): Likewise. (RTYPE_CLASS_COPY): Likewise. (RTYPE_CLASS_TLS): Likewise. (_dl_debug_bindings): Use RTYPE_CLASS_TLS and RTYPE_CLASS_VALID to set relocation type class for DL_DEBUG_PRELINK. Keep only ELF_RTYPE_CLASS_PLT and ELF_RTYPE_CLASS_COPY bits for DL_DEBUG_PRELINK. (cherry picked from commit f3d18efb8a720121066dc3401e822043beb98cde) ----------------------------------------------------------------------- Summary of changes: ChangeLog | 23 ++++++++++++++++++++++ NEWS | 2 +- elf/dl-lookup.c | 21 ++++++++++++++++++- sysdeps/x86/Makefile | 15 ++++++++++++++ stdlib/tst-system.c => sysdeps/x86/tst-prelink.c | 12 +++++----- sysdeps/x86/tst-prelink.exp | 1 + 6 files changed, 65 insertions(+), 9 deletions(-) copy stdlib/tst-system.c => sysdeps/x86/tst-prelink.c (80%) create mode 100644 sysdeps/x86/tst-prelink.exp
Fixed for 2.23 and backported to release/2.22/master branch.
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GNU C Library master sources". The branch, gentoo/2.22 has been updated via fb3642bf3c7743da1928d01525d912ca979b468e (commit) from b4f19537f9d26dbf95bd2e7d9c056400ad1b5723 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=fb3642bf3c7743da1928d01525d912ca979b468e commit fb3642bf3c7743da1928d01525d912ca979b468e Author: H.J. Lu <hjl.tools@gmail.com> Date: Sat Nov 7 06:32:30 2015 -0800 Keep only ELF_RTYPE_CLASS_{PLT|COPY} bits for prelink prelink runs ld.so with the environment variable LD_TRACE_PRELINKING set to dump the relocation type class from _dl_debug_bindings. prelink has the following relocation type classes: #define RTYPE_CLASS_VALID 8 #define RTYPE_CLASS_PLT (8|1) #define RTYPE_CLASS_COPY (8|2) #define RTYPE_CLASS_TLS (8|4) where ELF_RTYPE_CLASS_EXTERN_PROTECTED_DATA has a conflict with RTYPE_CLASS_TLS. Since prelink only uses ELF_RTYPE_CLASS_PLT and ELF_RTYPE_CLASS_COPY bits, we should clear the other bits when the DL_DEBUG_PRELINK bit is set. [BZ #19178] * elf/dl-lookup.c (RTYPE_CLASS_VALID): New. (RTYPE_CLASS_PLT): Likewise. (RTYPE_CLASS_COPY): Likewise. (RTYPE_CLASS_TLS): Likewise. (_dl_debug_bindings): Use RTYPE_CLASS_TLS and RTYPE_CLASS_VALID to set relocation type class for DL_DEBUG_PRELINK. Keep only ELF_RTYPE_CLASS_PLT and ELF_RTYPE_CLASS_COPY bits for DL_DEBUG_PRELINK. (cherry picked from commit f3d18efb8a720121066dc3401e822043beb98cde) (cherry picked from commit 387011e0b6f9cbefd26691f0df8ce76bb7ddfa03) ----------------------------------------------------------------------- Summary of changes: elf/dl-lookup.c | 21 +++++++++++++++++++-- 1 files changed, 19 insertions(+), 2 deletions(-)
The master branch has been updated by Matheus Castanho <mscastanho@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=01cdcf783a666481133d4975b1980624b0ef4799 commit 01cdcf783a666481133d4975b1980624b0ef4799 Author: Matheus Castanho <msc@linux.ibm.com> Date: Tue Dec 15 15:35:41 2020 -0300 elf: Limit tst-prelink-cmp target archs elf/tst-prelink-cmp was initially added for x86 (commit fe534fe898) to validate the fix for Bug 19178, and later applied to all architectures that use GLOB_DAT relocations (commit 89569c8bb6). However, that bug only affected targets that handle GLOB_DAT relocations as ELF_TYPE_CLASS_EXTERN_PROTECTED_DATA, so the test should only apply to targets defining DL_EXTERN_PROTECTED_DATA, which gates the usage of the elf type class above. For all other targets not meeting that criteria, the test now returns with UNSUPPORTED status. Fixes the test on POWER10 processors, which started using R_PPC64_GLOB_DAT. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>