public inbox for openembedded-core@lists.openembedded.org
 help / color / mirror / Atom feed
From: Mark Hatle <mark.hatle@windriver.com>
To: <openembedded-core@lists.openembedded.org>
Subject: Re: [PATCH 1/2] glibc: Fix scope resolution in glibc to be breadth first.
Date: Fri, 19 Aug 2016 21:17:42 -0500	[thread overview]
Message-ID: <6fbceacd-da1d-a030-ab2c-9872ced2373b@windriver.com> (raw)
In-Reply-To: <61d6d16460deaa1e30f2cdfef80e5744e53a6290.1471657381.git.mark.hatle@windriver.com>

On 8/19/16 8:44 PM, Mark Hatle wrote:
> The ELF specification indicates symbol resolution should be breadth first, not
> depth first.
> 
> The dl-deps.c: dl_build_locale_scope function is processing in a depth first
> mode.  This is causes certain symbols to be incorrectly reported when
> LD_TRACE_PRELINKING=1 is enabled.
> 
> See glibc BZ #20488 for more information.
> 
> Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
> ---
>  .../glibc/glibc/0026-build_local_scope.patch       | 56 ++++++++++++++++++++++
>  meta/recipes-core/glibc/glibc_2.24.bb              |  1 +
>  2 files changed, 57 insertions(+)
>  create mode 100644 meta/recipes-core/glibc/glibc/0026-build_local_scope.patch
> 
> diff --git a/meta/recipes-core/glibc/glibc/0026-build_local_scope.patch b/meta/recipes-core/glibc/glibc/0026-build_local_scope.patch
> new file mode 100644
> index 0000000..435a8c8
> --- /dev/null
> +++ b/meta/recipes-core/glibc/glibc/0026-build_local_scope.patch
> @@ -0,0 +1,56 @@
> +From 6e4ec5a3c5fe63b6458036f18d43124de4a7e724 Mon Sep 17 00:00:00 2001
> +From: Mark Hatle <mark.hatle@windriver.com>
> +Date: Thu, 18 Aug 2016 14:07:58 -0500
> +Subject: [PATCH] elf/dl-deps.c: Make _dl_build_local_scope breadth first
> +
> +According to the ELF specification:
> +
> +When resolving symbolic references, the dynamic linker examines the symbol
> +tables with a breadth-first search.
> +
> +This function was using a depth first search.  By doing so the conflict
> +resolution reported to the prelinker (when LD_TRACE_PRELINKING=1 is set)
> +was incorrect.  This caused problems when their were various circular
> +dependencies between libraries.  The problem usually manifested itself by
> +the wrong IFUNC being executed.
> +
> +[BZ# 20488]
> +
> +Upstream-Status: Pending

Above can be changes to:

Upstream-Status: Submitted [libc-alpha]

> +
> +Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
> +---
> + elf/dl-deps.c | 14 ++++++++++----
> + 1 file changed, 10 insertions(+), 4 deletions(-)
> +
> +diff --git a/elf/dl-deps.c b/elf/dl-deps.c
> +index 6a82987..fc37c87 100644
> +--- a/elf/dl-deps.c
> ++++ b/elf/dl-deps.c
> +@@ -73,13 +73,19 @@ _dl_build_local_scope (struct link_map **list, struct link_map *map)
> + {
> +   struct link_map **p = list;
> +   struct link_map **q;
> ++  struct link_map **r;
> + 
> +   *p++ = map;
> +   map->l_reserved = 1;
> +-  if (map->l_initfini)
> +-    for (q = map->l_initfini + 1; *q; ++q)
> +-      if (! (*q)->l_reserved)
> +-	p += _dl_build_local_scope (p, *q);
> ++
> ++  for (r = list; r < p; ++r)
> ++    if ((*r)->l_initfini)
> ++      for (q = (*r)->l_initfini + 1; *q; ++q)
> ++	if (! (*q)->l_reserved)
> ++	  {
> ++	    *p++ = *q;
> ++	    (*q)->l_reserved = 1;
> ++	  }
> +   return p - list;
> + }
> + 
> +-- 
> +2.5.5
> +
> diff --git a/meta/recipes-core/glibc/glibc_2.24.bb b/meta/recipes-core/glibc/glibc_2.24.bb
> index e446e7a..a3ac738 100644
> --- a/meta/recipes-core/glibc/glibc_2.24.bb
> +++ b/meta/recipes-core/glibc/glibc_2.24.bb
> @@ -36,6 +36,7 @@ SRC_URI = "${GLIBC_GIT_URI};branch=${SRCBRANCH};name=glibc \
>             file://0023-eglibc-Install-PIC-archives.patch \
>             file://0024-eglibc-Forward-port-cross-locale-generation-support.patch \
>             file://0025-Define-DUMMY_LOCALE_T-if-not-defined.patch \
> +           file://0026-build_local_scope.patch \
>  "
>  
>  SRC_URI += "\
> 



  reply	other threads:[~2016-08-20  2:17 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-20  1:44 [PATCH 0/2] prelink changes Mark Hatle
2016-08-20  1:44 ` [PATCH 1/2] glibc: Fix scope resolution in glibc to be breadth first Mark Hatle
2016-08-20  2:17   ` Mark Hatle [this message]
2016-08-20  1:44 ` [PATCH 2/2] Revert "local.conf.sample: Disable ARM and PPC due to prelink test case failures" Mark Hatle

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6fbceacd-da1d-a030-ab2c-9872ced2373b@windriver.com \
    --to=mark.hatle@windriver.com \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox