This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] [BZ #19178] ELF_RTYPE_CLASS_EXTERN_PROTECTED_DATA conflict


On Wed, Oct 28, 2015 at 4:49 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
> _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.
>
> Tested on i686 and x86-64.  OK for master and 2.22 branch?
>
>
> H.J.
> --
>         [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.
> ---
>  elf/dl-lookup.c            | 6 +++---
>  sysdeps/generic/ldsodefs.h | 4 ++++
>  2 files changed, 7 insertions(+), 3 deletions(-)
>
> diff --git a/elf/dl-lookup.c b/elf/dl-lookup.c
> index 581fb20..9f2643f 100644
> --- a/elf/dl-lookup.c
> +++ b/elf/dl-lookup.c
> @@ -1073,16 +1073,16 @@ _dl_debug_bindings (const char *undef_name, struct link_map *undef_map,
>         {
>           if (__glibc_unlikely (ELFW(ST_TYPE) (value->s->st_info)
>                                 == STT_TLS))
> -           type_class = 4;
> +           type_class = ELF_RTYPE_CLASS_TLS;
>           else if (__glibc_unlikely (ELFW(ST_TYPE) (value->s->st_info)
>                                      == STT_GNU_IFUNC))
> -           type_class |= 8;
> +           type_class |= ELF_RTYPE_CLASS_IFUNC;
>         }
>
>        if (conflict
>           || GLRO(dl_trace_prelink_map) == undef_map
>           || GLRO(dl_trace_prelink_map) == NULL
> -         || type_class >= 4)
> +         || type_class >= ELF_RTYPE_CLASS_TLS)
>         {
>           _dl_printf ("%s 0x%0*Zx 0x%0*Zx -> 0x%0*Zx 0x%0*Zx ",
>                       conflict ? "conflict" : "lookup",
> diff --git a/sysdeps/generic/ldsodefs.h b/sysdeps/generic/ldsodefs.h
> index a8caf47..5f96540 100644
> --- a/sysdeps/generic/ldsodefs.h
> +++ b/sysdeps/generic/ldsodefs.h
> @@ -122,6 +122,10 @@ typedef struct link_map *lookup_t;
>  #else
>  # define ELF_RTYPE_CLASS_EXTERN_PROTECTED_DATA 0
>  #endif
> +/* ELF_RTYPE_CLASS_TLS and ELF_RTYPE_CLASS_IFUNC are only used in
> +   _dl_debug_bindings.  They must be the highest ones.  */
> +#define ELF_RTYPE_CLASS_TLS 8
> +#define ELF_RTYPE_CLASS_IFUNC 16
>
>  /* ELF uses the PF_x macros to specify the segment permissions, mmap
>     uses PROT_xxx.  In most cases the three macros have the values 1, 2,
> --
> 2.4.3
>

It doesn't work with prelink.


-- 
H.J.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]