]> git.ipfire.org Git - ipfire-2.x.git/blob - src/patches/glibc-2.38/0029-Revert-elf-Always-call-destructors-in-reverse-constr.patch
glibc: Import latest patches from upstream
[ipfire-2.x.git] / src / patches / glibc-2.38 / 0029-Revert-elf-Always-call-destructors-in-reverse-constr.patch
1 From 719866ab2ff0e6d514a04fb47e507d92e70ef7ee Mon Sep 17 00:00:00 2001
2 From: Florian Weimer <fweimer@redhat.com>
3 Date: Wed, 18 Oct 2023 14:25:46 +0200
4 Subject: [PATCH 29/44] Revert "elf: Always call destructors in reverse
5 constructor order (bug 30785)"
6
7 This reverts commit a3189f66a5f2fe86568286fa025fa153be04c6c0.
8
9 Reason for revert: Incompatibility with existing applications.
10 ---
11 NEWS | 1 -
12 elf/dl-close.c | 113 ++++++++++-----------------
13 elf/dl-fini.c | 152 ++++++++++++++++++++++++-------------
14 elf/dl-init.c | 16 ----
15 elf/dso-sort-tests-1.def | 19 +++--
16 elf/tst-audit23.c | 44 +++++------
17 sysdeps/generic/ldsodefs.h | 4 -
18 7 files changed, 173 insertions(+), 176 deletions(-)
19
20 diff --git a/NEWS b/NEWS
21 index bfcd46efa9..f117874e34 100644
22 --- a/NEWS
23 +++ b/NEWS
24 @@ -32,7 +32,6 @@ Security related changes:
25 The following bugs are resolved with this release:
26
27 [30723] posix_memalign repeatedly scans long bin lists
28 - [30785] Always call destructors in reverse constructor order
29 [30804] F_GETLK, F_SETLK, and F_SETLKW value change for powerpc64 with
30 -D_FILE_OFFSET_BITS=64
31 [30842] Stack read overflow in getaddrinfo in no-aaaa mode (CVE-2023-4527)
32 diff --git a/elf/dl-close.c b/elf/dl-close.c
33 index ea62d0e601..b887a44888 100644
34 --- a/elf/dl-close.c
35 +++ b/elf/dl-close.c
36 @@ -138,31 +138,30 @@ _dl_close_worker (struct link_map *map, bool force)
37
38 bool any_tls = false;
39 const unsigned int nloaded = ns->_ns_nloaded;
40 + struct link_map *maps[nloaded];
41
42 - /* Run over the list and assign indexes to the link maps. */
43 + /* Run over the list and assign indexes to the link maps and enter
44 + them into the MAPS array. */
45 int idx = 0;
46 for (struct link_map *l = ns->_ns_loaded; l != NULL; l = l->l_next)
47 {
48 l->l_map_used = 0;
49 l->l_map_done = 0;
50 l->l_idx = idx;
51 + maps[idx] = l;
52 ++idx;
53 }
54 assert (idx == nloaded);
55
56 - /* Keep marking link maps until no new link maps are found. */
57 - for (struct link_map *l = ns->_ns_loaded; l != NULL; )
58 + /* Keep track of the lowest index link map we have covered already. */
59 + int done_index = -1;
60 + while (++done_index < nloaded)
61 {
62 - /* next is reset to earlier link maps for remarking. */
63 - struct link_map *next = l->l_next;
64 - int next_idx = l->l_idx + 1; /* next->l_idx, but covers next == NULL. */
65 + struct link_map *l = maps[done_index];
66
67 if (l->l_map_done)
68 - {
69 - /* Already handled. */
70 - l = next;
71 - continue;
72 - }
73 + /* Already handled. */
74 + continue;
75
76 /* Check whether this object is still used. */
77 if (l->l_type == lt_loaded
78 @@ -172,10 +171,7 @@ _dl_close_worker (struct link_map *map, bool force)
79 acquire is sufficient and correct. */
80 && atomic_load_acquire (&l->l_tls_dtor_count) == 0
81 && !l->l_map_used)
82 - {
83 - l = next;
84 - continue;
85 - }
86 + continue;
87
88 /* We need this object and we handle it now. */
89 l->l_map_used = 1;
90 @@ -202,11 +198,8 @@ _dl_close_worker (struct link_map *map, bool force)
91 already processed it, then we need to go back
92 and process again from that point forward to
93 ensure we keep all of its dependencies also. */
94 - if ((*lp)->l_idx < next_idx)
95 - {
96 - next = *lp;
97 - next_idx = next->l_idx;
98 - }
99 + if ((*lp)->l_idx - 1 < done_index)
100 + done_index = (*lp)->l_idx - 1;
101 }
102 }
103
104 @@ -226,65 +219,44 @@ _dl_close_worker (struct link_map *map, bool force)
105 if (!jmap->l_map_used)
106 {
107 jmap->l_map_used = 1;
108 - if (jmap->l_idx < next_idx)
109 - {
110 - next = jmap;
111 - next_idx = next->l_idx;
112 - }
113 + if (jmap->l_idx - 1 < done_index)
114 + done_index = jmap->l_idx - 1;
115 }
116 }
117 }
118 -
119 - l = next;
120 }
121
122 - /* Call the destructors in reverse constructor order, and remove the
123 - closed link maps from the list. */
124 - for (struct link_map **init_called_head = &_dl_init_called_list;
125 - *init_called_head != NULL; )
126 + /* Sort the entries. We can skip looking for the binary itself which is
127 + at the front of the search list for the main namespace. */
128 + _dl_sort_maps (maps, nloaded, (nsid == LM_ID_BASE), true);
129 +
130 + /* Call all termination functions at once. */
131 + bool unload_any = false;
132 + bool scope_mem_left = false;
133 + unsigned int unload_global = 0;
134 + unsigned int first_loaded = ~0;
135 + for (unsigned int i = 0; i < nloaded; ++i)
136 {
137 - struct link_map *imap = *init_called_head;
138 + struct link_map *imap = maps[i];
139
140 - /* _dl_init_called_list is global, to produce a global odering.
141 - Ignore the other namespaces (and link maps that are still used). */
142 - if (imap->l_ns != nsid || imap->l_map_used)
143 - init_called_head = &imap->l_init_called_next;
144 - else
145 + /* All elements must be in the same namespace. */
146 + assert (imap->l_ns == nsid);
147 +
148 + if (!imap->l_map_used)
149 {
150 assert (imap->l_type == lt_loaded && !imap->l_nodelete_active);
151
152 - /* _dl_init_called_list is updated at the same time as
153 - l_init_called. */
154 - assert (imap->l_init_called);
155 -
156 - if (imap->l_info[DT_FINI_ARRAY] != NULL
157 - || imap->l_info[DT_FINI] != NULL)
158 + /* Call its termination function. Do not do it for
159 + half-cooked objects. Temporarily disable exception
160 + handling, so that errors are fatal. */
161 + if (imap->l_init_called)
162 _dl_catch_exception (NULL, _dl_call_fini, imap);
163
164 #ifdef SHARED
165 /* Auditing checkpoint: we remove an object. */
166 _dl_audit_objclose (imap);
167 #endif
168 - /* Unlink this link map. */
169 - *init_called_head = imap->l_init_called_next;
170 - }
171 - }
172 -
173 -
174 - bool unload_any = false;
175 - bool scope_mem_left = false;
176 - unsigned int unload_global = 0;
177 -
178 - /* For skipping un-unloadable link maps in the second loop. */
179 - struct link_map *first_loaded = ns->_ns_loaded;
180
181 - /* Iterate over the namespace to find objects to unload. Some
182 - unloadable objects may not be on _dl_init_called_list due to
183 - dlopen failure. */
184 - for (struct link_map *imap = first_loaded; imap != NULL; imap = imap->l_next)
185 - {
186 - if (!imap->l_map_used)
187 - {
188 /* This object must not be used anymore. */
189 imap->l_removed = 1;
190
191 @@ -295,8 +267,8 @@ _dl_close_worker (struct link_map *map, bool force)
192 ++unload_global;
193
194 /* Remember where the first dynamically loaded object is. */
195 - if (first_loaded == NULL)
196 - first_loaded = imap;
197 + if (i < first_loaded)
198 + first_loaded = i;
199 }
200 /* Else imap->l_map_used. */
201 else if (imap->l_type == lt_loaded)
202 @@ -432,8 +404,8 @@ _dl_close_worker (struct link_map *map, bool force)
203 imap->l_loader = NULL;
204
205 /* Remember where the first dynamically loaded object is. */
206 - if (first_loaded == NULL)
207 - first_loaded = imap;
208 + if (i < first_loaded)
209 + first_loaded = i;
210 }
211 }
212
213 @@ -504,11 +476,10 @@ _dl_close_worker (struct link_map *map, bool force)
214
215 /* Check each element of the search list to see if all references to
216 it are gone. */
217 - for (struct link_map *imap = first_loaded; imap != NULL; )
218 + for (unsigned int i = first_loaded; i < nloaded; ++i)
219 {
220 - if (imap->l_map_used)
221 - imap = imap->l_next;
222 - else
223 + struct link_map *imap = maps[i];
224 + if (!imap->l_map_used)
225 {
226 assert (imap->l_type == lt_loaded);
227
228 @@ -719,9 +690,7 @@ _dl_close_worker (struct link_map *map, bool force)
229 if (imap == GL(dl_initfirst))
230 GL(dl_initfirst) = NULL;
231
232 - struct link_map *next = imap->l_next;
233 free (imap);
234 - imap = next;
235 }
236 }
237
238 diff --git a/elf/dl-fini.c b/elf/dl-fini.c
239 index e201d36651..9acb64f47c 100644
240 --- a/elf/dl-fini.c
241 +++ b/elf/dl-fini.c
242 @@ -24,68 +24,116 @@
243 void
244 _dl_fini (void)
245 {
246 - /* Call destructors strictly in the reverse order of constructors.
247 - This causes fewer surprises than some arbitrary reordering based
248 - on new (relocation) dependencies. None of the objects are
249 - unmapped, so applications can deal with this if their DSOs remain
250 - in a consistent state after destructors have run. */
251 -
252 - /* Protect against concurrent loads and unloads. */
253 - __rtld_lock_lock_recursive (GL(dl_load_lock));
254 -
255 - /* Ignore objects which are opened during shutdown. */
256 - struct link_map *local_init_called_list = _dl_init_called_list;
257 -
258 - for (struct link_map *l = local_init_called_list; l != NULL;
259 - l = l->l_init_called_next)
260 - /* Bump l_direct_opencount of all objects so that they
261 - are not dlclose()ed from underneath us. */
262 - ++l->l_direct_opencount;
263 -
264 - /* After this point, everything linked from local_init_called_list
265 - cannot be unloaded because of the reference counter update. */
266 - __rtld_lock_unlock_recursive (GL(dl_load_lock));
267 -
268 - /* Perform two passes: One for non-audit modules, one for audit
269 - modules. This way, audit modules receive unload notifications
270 - for non-audit objects, and the destructors for audit modules
271 - still run. */
272 + /* Lots of fun ahead. We have to call the destructors for all still
273 + loaded objects, in all namespaces. The problem is that the ELF
274 + specification now demands that dependencies between the modules
275 + are taken into account. I.e., the destructor for a module is
276 + called before the ones for any of its dependencies.
277 +
278 + To make things more complicated, we cannot simply use the reverse
279 + order of the constructors. Since the user might have loaded objects
280 + using `dlopen' there are possibly several other modules with its
281 + dependencies to be taken into account. Therefore we have to start
282 + determining the order of the modules once again from the beginning. */
283 +
284 + /* We run the destructors of the main namespaces last. As for the
285 + other namespaces, we pick run the destructors in them in reverse
286 + order of the namespace ID. */
287 +#ifdef SHARED
288 + int do_audit = 0;
289 + again:
290 +#endif
291 + for (Lmid_t ns = GL(dl_nns) - 1; ns >= 0; --ns)
292 + {
293 + /* Protect against concurrent loads and unloads. */
294 + __rtld_lock_lock_recursive (GL(dl_load_lock));
295 +
296 + unsigned int nloaded = GL(dl_ns)[ns]._ns_nloaded;
297 + /* No need to do anything for empty namespaces or those used for
298 + auditing DSOs. */
299 + if (nloaded == 0
300 +#ifdef SHARED
301 + || GL(dl_ns)[ns]._ns_loaded->l_auditing != do_audit
302 +#endif
303 + )
304 + __rtld_lock_unlock_recursive (GL(dl_load_lock));
305 + else
306 + {
307 #ifdef SHARED
308 - int last_pass = GLRO(dl_naudit) > 0;
309 - Lmid_t last_ns = -1;
310 - for (int do_audit = 0; do_audit <= last_pass; ++do_audit)
311 + _dl_audit_activity_nsid (ns, LA_ACT_DELETE);
312 #endif
313 - for (struct link_map *l = local_init_called_list; l != NULL;
314 - l = l->l_init_called_next)
315 - {
316 +
317 + /* Now we can allocate an array to hold all the pointers and
318 + copy the pointers in. */
319 + struct link_map *maps[nloaded];
320 +
321 + unsigned int i;
322 + struct link_map *l;
323 + assert (nloaded != 0 || GL(dl_ns)[ns]._ns_loaded == NULL);
324 + for (l = GL(dl_ns)[ns]._ns_loaded, i = 0; l != NULL; l = l->l_next)
325 + /* Do not handle ld.so in secondary namespaces. */
326 + if (l == l->l_real)
327 + {
328 + assert (i < nloaded);
329 +
330 + maps[i] = l;
331 + l->l_idx = i;
332 + ++i;
333 +
334 + /* Bump l_direct_opencount of all objects so that they
335 + are not dlclose()ed from underneath us. */
336 + ++l->l_direct_opencount;
337 + }
338 + assert (ns != LM_ID_BASE || i == nloaded);
339 + assert (ns == LM_ID_BASE || i == nloaded || i == nloaded - 1);
340 + unsigned int nmaps = i;
341 +
342 + /* Now we have to do the sorting. We can skip looking for the
343 + binary itself which is at the front of the search list for
344 + the main namespace. */
345 + _dl_sort_maps (maps, nmaps, (ns == LM_ID_BASE), true);
346 +
347 + /* We do not rely on the linked list of loaded object anymore
348 + from this point on. We have our own list here (maps). The
349 + various members of this list cannot vanish since the open
350 + count is too high and will be decremented in this loop. So
351 + we release the lock so that some code which might be called
352 + from a destructor can directly or indirectly access the
353 + lock. */
354 + __rtld_lock_unlock_recursive (GL(dl_load_lock));
355 +
356 + /* 'maps' now contains the objects in the right order. Now
357 + call the destructors. We have to process this array from
358 + the front. */
359 + for (i = 0; i < nmaps; ++i)
360 + {
361 + struct link_map *l = maps[i];
362 +
363 + if (l->l_init_called)
364 + {
365 + _dl_call_fini (l);
366 #ifdef SHARED
367 - if (GL(dl_ns)[l->l_ns]._ns_loaded->l_auditing != do_audit)
368 - continue;
369 -
370 - /* Avoid back-to-back calls of _dl_audit_activity_nsid for the
371 - same namespace. */
372 - if (last_ns != l->l_ns)
373 - {
374 - if (last_ns >= 0)
375 - _dl_audit_activity_nsid (last_ns, LA_ACT_CONSISTENT);
376 - _dl_audit_activity_nsid (l->l_ns, LA_ACT_DELETE);
377 - last_ns = l->l_ns;
378 - }
379 + /* Auditing checkpoint: another object closed. */
380 + _dl_audit_objclose (l);
381 #endif
382 + }
383
384 - /* There is no need to re-enable exceptions because _dl_fini
385 - is not called from a context where exceptions are caught. */
386 - _dl_call_fini (l);
387 + /* Correct the previous increment. */
388 + --l->l_direct_opencount;
389 + }
390
391 #ifdef SHARED
392 - /* Auditing checkpoint: another object closed. */
393 - _dl_audit_objclose (l);
394 + _dl_audit_activity_nsid (ns, LA_ACT_CONSISTENT);
395 #endif
396 - }
397 + }
398 + }
399
400 #ifdef SHARED
401 - if (last_ns >= 0)
402 - _dl_audit_activity_nsid (last_ns, LA_ACT_CONSISTENT);
403 + if (! do_audit && GLRO(dl_naudit) > 0)
404 + {
405 + do_audit = 1;
406 + goto again;
407 + }
408
409 if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_STATISTICS))
410 _dl_debug_printf ("\nruntime linker statistics:\n"
411 diff --git a/elf/dl-init.c b/elf/dl-init.c
412 index ffd05b7806..ba4d2fdc85 100644
413 --- a/elf/dl-init.c
414 +++ b/elf/dl-init.c
415 @@ -21,7 +21,6 @@
416 #include <ldsodefs.h>
417 #include <elf-initfini.h>
418
419 -struct link_map *_dl_init_called_list;
420
421 static void
422 call_init (struct link_map *l, int argc, char **argv, char **env)
423 @@ -43,21 +42,6 @@ call_init (struct link_map *l, int argc, char **argv, char **env)
424 dependency. */
425 l->l_init_called = 1;
426
427 - /* Help an already-running dlclose: The just-loaded object must not
428 - be removed during the current pass. (No effect if no dlclose in
429 - progress.) */
430 - l->l_map_used = 1;
431 -
432 - /* Record execution before starting any initializers. This way, if
433 - the initializers themselves call dlopen, their ELF destructors
434 - will eventually be run before this object is destructed, matching
435 - that their ELF constructors have run before this object was
436 - constructed. _dl_fini uses this list for audit callbacks, so
437 - register objects on the list even if they do not have a
438 - constructor. */
439 - l->l_init_called_next = _dl_init_called_list;
440 - _dl_init_called_list = l;
441 -
442 /* Check for object which constructors we do not run here. */
443 if (__builtin_expect (l->l_name[0], 'a') == '\0'
444 && l->l_type == lt_executable)
445 diff --git a/elf/dso-sort-tests-1.def b/elf/dso-sort-tests-1.def
446 index 61dc54f8ae..4bf9052db1 100644
447 --- a/elf/dso-sort-tests-1.def
448 +++ b/elf/dso-sort-tests-1.def
449 @@ -53,14 +53,21 @@ tst-dso-ordering10: {}->a->b->c;soname({})=c
450 output: b>a>{}<a<b
451
452 # Complex example from Bugzilla #15311, under-linked and with circular
453 -# relocation(dynamic) dependencies. For both sorting algorithms, the
454 -# destruction order is the reverse of the construction order, and
455 -# relocation dependencies are not taken into account.
456 +# relocation(dynamic) dependencies. While this is technically unspecified, the
457 +# presumed reasonable practical behavior is for the destructor order to respect
458 +# the static DT_NEEDED links (here this means the a->b->c->d order).
459 +# The older dynamic_sort=1 algorithm does not achieve this, while the DFS-based
460 +# dynamic_sort=2 algorithm does, although it is still arguable whether going
461 +# beyond spec to do this is the right thing to do.
462 +# The below expected outputs are what the two algorithms currently produce
463 +# respectively, for regression testing purposes.
464 tst-bz15311: {+a;+e;+f;+g;+d;%d;-d;-g;-f;-e;-a};a->b->c->d;d=>[ba];c=>a;b=>e=>a;c=>f=>b;d=>g=>c
465 -output: {+a[d>c>b>a>];+e[e>];+f[f>];+g[g>];+d[];%d(b(e(a()))a()g(c(a()f(b(e(a()))))));-d[];-g[];-f[];-e[];-a[<g<f<e<a<b<c<d];}
466 +output(glibc.rtld.dynamic_sort=1): {+a[d>c>b>a>];+e[e>];+f[f>];+g[g>];+d[];%d(b(e(a()))a()g(c(a()f(b(e(a()))))));-d[];-g[];-f[];-e[];-a[<a<c<d<g<f<b<e];}
467 +output(glibc.rtld.dynamic_sort=2): {+a[d>c>b>a>];+e[e>];+f[f>];+g[g>];+d[];%d(b(e(a()))a()g(c(a()f(b(e(a()))))));-d[];-g[];-f[];-e[];-a[<g<f<a<b<c<d<e];}
468
469 # Test that even in the presence of dependency loops involving dlopen'ed
470 # object, that object is initialized last (and not unloaded prematurely).
471 -# Final destructor order is the opposite of constructor order.
472 +# Final destructor order is indeterminate due to the cycle.
473 tst-bz28937: {+a;+b;-b;+c;%c};a->a1;a->a2;a2->a;b->b1;c->a1;c=>a1
474 -output: {+a[a2>a1>a>];+b[b1>b>];-b[<b<b1];+c[c>];%c(a1());}<c<a<a1<a2
475 +output(glibc.rtld.dynamic_sort=1): {+a[a2>a1>a>];+b[b1>b>];-b[<b<b1];+c[c>];%c(a1());}<a<a2<c<a1
476 +output(glibc.rtld.dynamic_sort=2): {+a[a2>a1>a>];+b[b1>b>];-b[<b<b1];+c[c>];%c(a1());}<a2<a<c<a1
477 diff --git a/elf/tst-audit23.c b/elf/tst-audit23.c
478 index 503699c36a..bb7d66c385 100644
479 --- a/elf/tst-audit23.c
480 +++ b/elf/tst-audit23.c
481 @@ -98,8 +98,6 @@ do_test (int argc, char *argv[])
482 char *lname;
483 uintptr_t laddr;
484 Lmid_t lmid;
485 - uintptr_t cookie;
486 - uintptr_t namespace;
487 bool closed;
488 } objs[max_objs] = { [0 ... max_objs-1] = { .closed = false } };
489 size_t nobjs = 0;
490 @@ -119,9 +117,6 @@ do_test (int argc, char *argv[])
491 size_t buffer_length = 0;
492 while (xgetline (&buffer, &buffer_length, out))
493 {
494 - *strchrnul (buffer, '\n') = '\0';
495 - printf ("info: subprocess output: %s\n", buffer);
496 -
497 if (startswith (buffer, "la_activity: "))
498 {
499 uintptr_t cookie;
500 @@ -130,26 +125,29 @@ do_test (int argc, char *argv[])
501 &cookie);
502 TEST_COMPARE (r, 2);
503
504 + /* The cookie identifies the object at the head of the link map,
505 + so we only add a new namespace if it changes from the previous
506 + one. This works since dlmopen is the last in the test body. */
507 + if (cookie != last_act_cookie && last_act_cookie != -1)
508 + TEST_COMPARE (last_act, LA_ACT_CONSISTENT);
509 +
510 if (this_act == LA_ACT_ADD && acts[nacts] != cookie)
511 {
512 - /* The cookie identifies the object at the head of the
513 - link map, so we only add a new namespace if it
514 - changes from the previous one. This works since
515 - dlmopen is the last in the test body. */
516 - if (cookie != last_act_cookie && last_act_cookie != -1)
517 - TEST_COMPARE (last_act, LA_ACT_CONSISTENT);
518 -
519 acts[nacts++] = cookie;
520 last_act_cookie = cookie;
521 }
522 - /* LA_ACT_DELETE is called multiple times for each
523 - namespace, depending on destruction order. */
524 + /* The LA_ACT_DELETE is called in the reverse order of LA_ACT_ADD
525 + at program termination (if the tests adds a dlclose or a library
526 + with extra dependencies this will need to be adapted). */
527 else if (this_act == LA_ACT_DELETE)
528 - last_act_cookie = cookie;
529 + {
530 + last_act_cookie = acts[--nacts];
531 + TEST_COMPARE (acts[nacts], cookie);
532 + acts[nacts] = 0;
533 + }
534 else if (this_act == LA_ACT_CONSISTENT)
535 {
536 TEST_COMPARE (cookie, last_act_cookie);
537 - last_act_cookie = -1;
538
539 /* LA_ACT_DELETE must always be followed by an la_objclose. */
540 if (last_act == LA_ACT_DELETE)
541 @@ -181,8 +179,6 @@ do_test (int argc, char *argv[])
542 objs[nobjs].lname = lname;
543 objs[nobjs].laddr = laddr;
544 objs[nobjs].lmid = lmid;
545 - objs[nobjs].cookie = cookie;
546 - objs[nobjs].namespace = last_act_cookie;
547 objs[nobjs].closed = false;
548 nobjs++;
549
550 @@ -205,12 +201,6 @@ do_test (int argc, char *argv[])
551 if (strcmp (lname, objs[i].lname) == 0 && lmid == objs[i].lmid)
552 {
553 TEST_COMPARE (objs[i].closed, false);
554 - TEST_COMPARE (objs[i].cookie, cookie);
555 - if (objs[i].namespace == -1)
556 - /* No LA_ACT_ADD before the first la_objopen call. */
557 - TEST_COMPARE (acts[0], last_act_cookie);
558 - else
559 - TEST_COMPARE (objs[i].namespace, last_act_cookie);
560 objs[i].closed = true;
561 break;
562 }
563 @@ -219,7 +209,11 @@ do_test (int argc, char *argv[])
564 /* la_objclose should be called after la_activity(LA_ACT_DELETE) for
565 the closed object's namespace. */
566 TEST_COMPARE (last_act, LA_ACT_DELETE);
567 - seen_first_objclose = true;
568 + if (!seen_first_objclose)
569 + {
570 + TEST_COMPARE (last_act_cookie, cookie);
571 + seen_first_objclose = true;
572 + }
573 }
574 }
575
576 diff --git a/sysdeps/generic/ldsodefs.h b/sysdeps/generic/ldsodefs.h
577 index 9ea9389a39..e8b7359b04 100644
578 --- a/sysdeps/generic/ldsodefs.h
579 +++ b/sysdeps/generic/ldsodefs.h
580 @@ -1037,10 +1037,6 @@ extern int _dl_check_map_versions (struct link_map *map, int verbose,
581 extern void _dl_init (struct link_map *main_map, int argc, char **argv,
582 char **env) attribute_hidden;
583
584 -/* List of ELF objects in reverse order of their constructor
585 - invocation. */
586 -extern struct link_map *_dl_init_called_list attribute_hidden;
587 -
588 /* Call the finalizer functions of all shared objects whose
589 initializer functions have completed. */
590 extern void _dl_fini (void) attribute_hidden;
591 --
592 2.39.2
593