summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNitin A Kamble <nitin.a.kamble@intel.com>2011-07-12 11:44:39 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2011-07-13 12:34:30 +0100
commit068839698fe192d8846c0ed4db65861448e8e524 (patch)
tree611d1f1ad262b69b659760bf06dd93eaebae4b00
parentc661f8e0d5a9a9e61ee471d30b97e89ccfab4545 (diff)
downloadpoky-068839698fe192d8846c0ed4db65861448e8e524.tar.gz
eglibc: fix runtime assertion failure
This fixes bug [YOCTO #1237] Runtime assertion errors were observed: Inconsistency detected by ld.so: dl-deps.c: 622: _dl_map_object_deps: Assertion `nlist > 1' failed! A fix was available for this issue: http://sourceware.org/bugzilla/show_bug.cgi?id=12454 (From OE-Core rev: de4dc5f0741533529789a6094721f708728af386) Signed-off-by: Nitin A Kamble <nitin.a.kamble@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/recipes-core/eglibc/eglibc-2.13/glibc_bug_fix_12454.patch179
-rw-r--r--meta/recipes-core/eglibc/eglibc_2.13.bb1
2 files changed, 180 insertions, 0 deletions
diff --git a/meta/recipes-core/eglibc/eglibc-2.13/glibc_bug_fix_12454.patch b/meta/recipes-core/eglibc/eglibc-2.13/glibc_bug_fix_12454.patch
new file mode 100644
index 0000000000..71ba851773
--- /dev/null
+++ b/meta/recipes-core/eglibc/eglibc-2.13/glibc_bug_fix_12454.patch
@@ -0,0 +1,179 @@
1Upstream-Status: Inappropriate [backport]
2
3Imported by Nitin A Kamble <nitin.a.kamble@intel.com> 2011/07/12
4
5From 6b1e7d1992cd89032df431c0e0d1418b97e57cd8 Mon Sep 17 00:00:00 2001
6From: Ulrich Drepper <drepper@gmail.com>
7Date: Mon, 30 May 2011 12:31:25 -0400
8Subject: [PATCH] Handle DSOs without any dependency in ld.so
9
10---
11 ChangeLog | 6 ++++
12 NEWS | 4 +-
13 elf/dl-deps.c | 93 +++++++++++++++++++++++++++++---------------------------
14 elf/dl-fini.c | 10 ++++--
15 elf/rtld.c | 1 -
16 5 files changed, 62 insertions(+), 52 deletions(-)
17
18Index: libc/ChangeLog
19===================================================================
20--- libc.orig/ChangeLog
21+++ libc/ChangeLog
22@@ -1,3 +1,13 @@
23+2011-05-30 Ulrich Drepper <drepper@gmail.com>
24+
25+ [BZ #12454]
26+ * elf/dl-deps.c (_dl_map_object_deps): Run initializer sorting only
27+ when there are multiple maps.
28+ * elf/dl-fini.c (_dl_sort_fini): Check for list of one.
29+ (_dl_fini): Remove test here.
30+
31+ * elf/rtld.c (dl_main): Don't allow the loader to load itself.
32+
33 2010-09-28 Andreas Schwab <schwab@redhat.com>
34 Ulrich Drepper <drepper@gmail.com>
35
36Index: libc/elf/dl-deps.c
37===================================================================
38--- libc.orig/elf/dl-deps.c
39+++ libc/elf/dl-deps.c
40@@ -613,61 +613,64 @@ Filters not supported with LD_TRACE_PREL
41 map->l_searchlist.r_list[i]->l_reserved = 0;
42 }
43
44- /* Now determine the order in which the initialization has to happen. */
45+ /* Sort the initializer list to take dependencies into account. The binary
46+ itself will always be initialize last. */
47 memcpy (l_initfini, map->l_searchlist.r_list,
48 nlist * sizeof (struct link_map *));
49-
50- /* We can skip looking for the binary itself which is at the front
51- of the search list. */
52- assert (nlist > 1);
53- i = 1;
54- bool seen[nlist];
55- memset (seen, false, nlist * sizeof (seen[0]));
56- while (1)
57+ if (__builtin_expect (nlist > 1, 1))
58 {
59- /* Keep track of which object we looked at this round. */
60- seen[i] = true;
61- struct link_map *thisp = l_initfini[i];
62-
63- /* Find the last object in the list for which the current one is
64- a dependency and move the current object behind the object
65- with the dependency. */
66- unsigned int k = nlist - 1;
67- while (k > i)
68+ /* We can skip looking for the binary itself which is at the front
69+ of the search list. */
70+ i = 1;
71+ bool seen[nlist];
72+ memset (seen, false, nlist * sizeof (seen[0]));
73+ while (1)
74 {
75- struct link_map **runp = l_initfini[k]->l_initfini;
76- if (runp != NULL)
77- /* Look through the dependencies of the object. */
78- while (*runp != NULL)
79- if (__builtin_expect (*runp++ == thisp, 0))
80- {
81- /* Move the current object to the back past the last
82- object with it as the dependency. */
83- memmove (&l_initfini[i], &l_initfini[i + 1],
84- (k - i) * sizeof (l_initfini[0]));
85- l_initfini[k] = thisp;
86-
87- if (seen[i + 1])
88+ /* Keep track of which object we looked at this round. */
89+ seen[i] = true;
90+ struct link_map *thisp = l_initfini[i];
91+
92+ /* Find the last object in the list for which the current one is
93+ a dependency and move the current object behind the object
94+ with the dependency. */
95+ unsigned int k = nlist - 1;
96+ while (k > i)
97+ {
98+ struct link_map **runp = l_initfini[k]->l_initfini;
99+ if (runp != NULL)
100+ /* Look through the dependencies of the object. */
101+ while (*runp != NULL)
102+ if (__builtin_expect (*runp++ == thisp, 0))
103 {
104- ++i;
105- goto next_clear;
106+ /* Move the current object to the back past the last
107+ object with it as the dependency. */
108+ memmove (&l_initfini[i], &l_initfini[i + 1],
109+ (k - i) * sizeof (l_initfini[0]));
110+ l_initfini[k] = thisp;
111+
112+ if (seen[i + 1])
113+ {
114+ ++i;
115+ goto next_clear;
116+ }
117+
118+ memmove (&seen[i], &seen[i + 1],
119+ (k - i) * sizeof (seen[0]));
120+ seen[k] = true;
121+
122+ goto next;
123 }
124
125- memmove (&seen[i], &seen[i + 1], (k - i) * sizeof (seen[0]));
126- seen[k] = true;
127+ --k;
128+ }
129
130- goto next;
131- }
132+ if (++i == nlist)
133+ break;
134+ next_clear:
135+ memset (&seen[i], false, (nlist - i) * sizeof (seen[0]));
136
137- --k;
138+ next:;
139 }
140-
141- if (++i == nlist)
142- break;
143- next_clear:
144- memset (&seen[i], false, (nlist - i) * sizeof (seen[0]));
145-
146- next:;
147 }
148
149 /* Terminate the list of dependencies. */
150Index: libc/elf/dl-fini.c
151===================================================================
152--- libc.orig/elf/dl-fini.c
153+++ libc/elf/dl-fini.c
154@@ -33,9 +33,12 @@ internal_function
155 _dl_sort_fini (struct link_map *l, struct link_map **maps, size_t nmaps,
156 char *used, Lmid_t ns)
157 {
158+ /* A list of one element need not be sorted. */
159+ if (nmaps == 1)
160+ return;
161+
162 /* We can skip looking for the binary itself which is at the front
163 of the search list for the main namespace. */
164- assert (nmaps > 1);
165 unsigned int i = ns == LM_ID_BASE;
166 bool seen[nmaps];
167 memset (seen, false, nmaps * sizeof (seen[0]));
168@@ -195,9 +198,8 @@ _dl_fini (void)
169 assert (ns == LM_ID_BASE || i == nloaded || i == nloaded - 1);
170 nmaps = i;
171
172- if (nmaps > 1)
173- /* Now we have to do the sorting. */
174- _dl_sort_fini (GL(dl_ns)[ns]._ns_loaded, maps, nmaps, NULL, ns);
175+ /* Now we have to do the sorting. */
176+ _dl_sort_fini (GL(dl_ns)[ns]._ns_loaded, maps, nmaps, NULL, ns);
177
178 /* We do not rely on the linked list of loaded object anymore from
179 this point on. We have our own list here (maps). The various
diff --git a/meta/recipes-core/eglibc/eglibc_2.13.bb b/meta/recipes-core/eglibc/eglibc_2.13.bb
index ec88d9dbfe..feaf7ca351 100644
--- a/meta/recipes-core/eglibc/eglibc_2.13.bb
+++ b/meta/recipes-core/eglibc/eglibc_2.13.bb
@@ -16,6 +16,7 @@ SRC_URI = "svn://www.eglibc.org/svn/branches/;module=${EGLIBC_BRANCH};proto=http
16 file://stack-protector-test.patch \ 16 file://stack-protector-test.patch \
17 file://etc/ld.so.conf \ 17 file://etc/ld.so.conf \
18 file://generate-supported.mk \ 18 file://generate-supported.mk \
19 file://glibc_bug_fix_12454.patch \
19 " 20 "
20LIC_FILES_CHKSUM = "file://LICENSES;md5=98a1128c4b58120182cbea3b1752d8b9 \ 21LIC_FILES_CHKSUM = "file://LICENSES;md5=98a1128c4b58120182cbea3b1752d8b9 \
21 file://COPYING;md5=393a5ca445f6965873eca0259a17f833 \ 22 file://COPYING;md5=393a5ca445f6965873eca0259a17f833 \