Bug 19178 - ELF_RTYPE_CLASS_EXTERN_PROTECTED_DATA confuses prelink
Summary: ELF_RTYPE_CLASS_EXTERN_PROTECTED_DATA confuses prelink
Status: RESOLVED FIXED
Alias: None
Product: glibc
Classification: Unclassified
Component: dynamic-link (show other bugs)
Version: 2.22
: P2 normal
Target Milestone: 2.23
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-10-28 10:33 UTC by H.J. Lu
Modified: 2021-01-27 14:40 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments
A patch (1.02 KB, patch)
2015-10-28 14:59 UTC, H.J. Lu
Details | Diff
A new patch (1.02 KB, patch)
2015-10-28 15:17 UTC, H.J. Lu
Details | Diff
Revised version of HJ Lu's patch (875 bytes, text/plain)
2015-10-28 15:54 UTC, Mark Hatle
Details
A patch (1.04 KB, patch)
2015-10-28 15:58 UTC, H.J. Lu
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description H.J. Lu 2015-10-28 10:33:14 UTC
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)
        {
Comment 1 Sourceware Commits 2015-10-28 11:48:02 UTC
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.

-----------------------------------------------------------------------
Comment 2 H.J. Lu 2015-10-28 13:41:44 UTC
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)
Comment 3 Mark Hatle 2015-10-28 14:37:33 UTC
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.
Comment 4 H.J. Lu 2015-10-28 14:59:45 UTC
Created attachment 8754 [details]
A patch
Comment 5 Sourceware Commits 2015-10-28 15:17:19 UTC
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.

-----------------------------------------------------------------------
Comment 6 H.J. Lu 2015-10-28 15:17:45 UTC
Created attachment 8755 [details]
A new patch

Please try this one.
Comment 7 Mark Hatle 2015-10-28 15:40:23 UTC
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'.
Comment 8 Mark Hatle 2015-10-28 15:43:49 UTC
What I pasted still isn't correct.  It's clearing the '4' that should be on the TLS values.
Comment 9 Mark Hatle 2015-10-28 15:54:58 UTC
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.
Comment 10 H.J. Lu 2015-10-28 15:58:50 UTC
Created attachment 8757 [details]
A patch

Please try this one.
Comment 11 Sourceware Commits 2015-10-28 17:05:08 UTC
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.

-----------------------------------------------------------------------
Comment 12 Sourceware Commits 2015-10-29 02:29:52 UTC
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.

-----------------------------------------------------------------------
Comment 13 Sourceware Commits 2015-10-31 22:08:58 UTC
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.

-----------------------------------------------------------------------
Comment 14 Sourceware Commits 2015-11-07 14:34:09 UTC
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(-)
Comment 15 Sourceware Commits 2015-11-07 14:43:27 UTC
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.

-----------------------------------------------------------------------
Comment 16 jsm-csl@polyomino.org.uk 2015-11-09 13:03:30 UTC
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.
Comment 17 H.J. Lu 2015-11-09 14:44:52 UTC
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.
Comment 18 Joseph Myers 2015-11-09 16:29:41 UTC
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.
Comment 19 Sourceware Commits 2015-11-10 21:00:57 UTC
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
Comment 20 Sourceware Commits 2015-11-10 21:46:08 UTC
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
Comment 21 H.J. Lu 2015-11-10 21:47:36 UTC
Fixed for 2.23 and backported to release/2.22/master branch.
Comment 22 Sourceware Commits 2016-02-16 19:11:13 UTC
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(-)
Comment 23 Sourceware Commits 2021-01-27 14:40:06 UTC
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>