From patchwork Wed Oct 28 11:49:06 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "H.J. Lu" X-Patchwork-Id: 9414 Received: (qmail 4762 invoked by alias); 28 Oct 2015 11:49:11 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 4739 invoked by uid 89); 28 Oct 2015 11:49:10 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.3 required=5.0 tests=AWL, BAYES_20, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-pa0-f41.google.com X-Received: by 10.67.1.34 with SMTP id bd2mr33008875pad.45.1446032948125; Wed, 28 Oct 2015 04:49:08 -0700 (PDT) Date: Wed, 28 Oct 2015 04:49:06 -0700 From: "H.J. Lu" To: GNU C Library Subject: [PATCH] [BZ #19178] ELF_RTYPE_CLASS_EXTERN_PROTECTED_DATA conflict Message-ID: <20151028114906.GA7686@gmail.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.24 (2015-08-30) _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,