[57b3f19] | 1 | Submitted By: Jonathan Norman (jonathan at bluesquarelinux dot co dot uk)
|
---|
| 2 | Date: 2012-02-16
|
---|
| 3 | Initial Package Version: 2.15
|
---|
| 4 | Origin: http://sourceware.org/ml/libc-alpha/2011-06/msg00010.html
|
---|
| 5 | Upstream Status: Submitted
|
---|
| 6 | Description: Fixes segfault with sound devices / output.
|
---|
| 7 |
|
---|
| 8 | diff -Naur eglibc-2_15.orig/elf/dl-close.c eglibc-2_15/elf/dl-close.c
|
---|
| 9 | --- eglibc-2_15.orig/elf/dl-close.c 2012-02-16 09:31:47.478224779 +0000
|
---|
| 10 | +++ eglibc-2_15/elf/dl-close.c 2012-02-16 09:37:17.287098571 +0000
|
---|
| 11 | @@ -119,17 +119,8 @@
|
---|
| 12 | if (map->l_direct_opencount > 0 || map->l_type != lt_loaded
|
---|
| 13 | || dl_close_state != not_pending)
|
---|
| 14 | {
|
---|
| 15 | - if (map->l_direct_opencount == 0)
|
---|
| 16 | - {
|
---|
| 17 | - if (map->l_type == lt_loaded)
|
---|
| 18 | - dl_close_state = rerun;
|
---|
| 19 | - else if (map->l_type == lt_library)
|
---|
| 20 | - {
|
---|
| 21 | - struct link_map **oldp = map->l_initfini;
|
---|
| 22 | - map->l_initfini = map->l_orig_initfini;
|
---|
| 23 | - _dl_scope_free (oldp);
|
---|
| 24 | - }
|
---|
| 25 | - }
|
---|
| 26 | + if (map->l_direct_opencount == 0 && map->l_type == lt_loaded)
|
---|
| 27 | + dl_close_state = rerun;
|
---|
| 28 |
|
---|
| 29 | /* There are still references to this object. Do nothing more. */
|
---|
| 30 | if (__builtin_expect (GLRO_dl_debug_mask & DL_DEBUG_FILES, 0))
|
---|
| 31 | diff -Naur eglibc-2_15.orig/elf/dl-deps.c eglibc-2_15/elf/dl-deps.c
|
---|
| 32 | --- eglibc-2_15.orig/elf/dl-deps.c 2012-02-16 09:31:47.474224671 +0000
|
---|
| 33 | +++ eglibc-2_15/elf/dl-deps.c 2012-02-16 09:39:54.791335897 +0000
|
---|
| 34 | @@ -489,6 +489,8 @@
|
---|
| 35 | nneeded * sizeof needed[0]);
|
---|
| 36 | atomic_write_barrier ();
|
---|
| 37 | l->l_initfini = l_initfini;
|
---|
| 38 | + l->l_free_initfini = 1;
|
---|
| 39 | +
|
---|
| 40 | }
|
---|
| 41 |
|
---|
| 42 | /* If we have no auxiliary objects just go on to the next map. */
|
---|
| 43 | @@ -689,6 +691,7 @@
|
---|
| 44 | l_initfini[nlist] = NULL;
|
---|
| 45 | atomic_write_barrier ();
|
---|
| 46 | map->l_initfini = l_initfini;
|
---|
| 47 | + map->l_free_initfini = 1;
|
---|
| 48 | if (l_reldeps != NULL)
|
---|
| 49 | {
|
---|
| 50 | atomic_write_barrier ();
|
---|
| 51 | @@ -697,7 +700,7 @@
|
---|
| 52 | _dl_scope_free (old_l_reldeps);
|
---|
| 53 | }
|
---|
| 54 | if (old_l_initfini != NULL)
|
---|
| 55 | - map->l_orig_initfini = old_l_initfini;
|
---|
| 56 | + _dl_scope_free (old_l_initfini);
|
---|
| 57 |
|
---|
| 58 | if (errno_reason)
|
---|
| 59 | _dl_signal_error (errno_reason == -1 ? 0 : errno_reason, objname,
|
---|
| 60 | diff -Naur eglibc-2_15.orig/elf/dl-libc.c eglibc-2_15/elf/dl-libc.c
|
---|
| 61 | --- eglibc-2_15.orig/elf/dl-libc.c 2012-02-16 09:31:47.478224779 +0000
|
---|
| 62 | +++ eglibc-2_15/elf/dl-libc.c 2012-02-16 09:32:43.619735410 +0000
|
---|
| 63 | @@ -284,6 +284,10 @@
|
---|
| 64 | if (! old->dont_free)
|
---|
| 65 | free (old);
|
---|
| 66 | }
|
---|
| 67 | +
|
---|
| 68 | + /* Free the initfini dependency list. */
|
---|
| 69 | + if (l->l_free_initfini)
|
---|
| 70 | + free (l->l_initfini);
|
---|
| 71 | }
|
---|
| 72 |
|
---|
| 73 | if (__builtin_expect (GL(dl_ns)[ns]._ns_global_scope_alloc, 0) != 0
|
---|
| 74 | diff -Naur eglibc-2_15.orig/elf/rtld.c eglibc-2_15/elf/rtld.c
|
---|
| 75 | --- eglibc-2_15.orig/elf/rtld.c 2012-02-16 09:31:47.470224563 +0000
|
---|
| 76 | +++ eglibc-2_15/elf/rtld.c 2012-02-16 09:35:01.611448263 +0000
|
---|
| 77 | @@ -2277,6 +2277,7 @@
|
---|
| 78 | lnp->dont_free = 1;
|
---|
| 79 | lnp = lnp->next;
|
---|
| 80 | }
|
---|
| 81 | + l->l_free_initfini = 0;
|
---|
| 82 |
|
---|
| 83 | if (l != &GL(dl_rtld_map))
|
---|
| 84 | _dl_relocate_object (l, l->l_scope, GLRO(dl_lazy) ? RTLD_LAZY : 0,
|
---|
| 85 | diff -Naur eglibc-2_15.orig/include/link.h eglibc-2_15/include/link.h
|
---|
| 86 | --- eglibc-2_15.orig/include/link.h 2012-02-16 09:31:47.710231021 +0000
|
---|
| 87 | +++ eglibc-2_15/include/link.h 2012-02-16 09:42:04.610828212 +0000
|
---|
| 88 | @@ -192,6 +192,9 @@
|
---|
| 89 | during LD_TRACE_PRELINKING=1
|
---|
| 90 | contains any DT_SYMBOLIC
|
---|
| 91 | libraries. */
|
---|
| 92 | + unsigned int l_free_initfini:1; /* Nonzero if l_initfini can be
|
---|
| 93 | + freed, ie. not allocated with
|
---|
| 94 | + the dummy malloc in ld.so. */
|
---|
| 95 |
|
---|
| 96 | /* Collected information about own RPATH directories. */
|
---|
| 97 | struct r_search_path_struct l_rpath_dirs;
|
---|
| 98 | @@ -240,9 +243,6 @@
|
---|
| 99 |
|
---|
| 100 | /* List of object in order of the init and fini calls. */
|
---|
| 101 | struct link_map **l_initfini;
|
---|
| 102 | - /* The init and fini list generated at startup, saved when the
|
---|
| 103 | - object is also loaded dynamically. */
|
---|
| 104 | - struct link_map **l_orig_initfini;
|
---|
| 105 |
|
---|
| 106 | /* List of the dependencies introduced through symbol binding. */
|
---|
| 107 | struct link_map_reldeps
|
---|