wok-undigest annotate glibc/stuff/glibc-2.14.1-fixes-1.patch @ rev 1235

compile alsa-lib
author Hans-G?nter Theisgen
date Sat Aug 06 17:22:27 2022 +0100 (23 months ago)
parents
children
rev   line source
pankso@674 1 Submitted By: Matt Burgess <matthew_at_linuxfromscratch_dot_org>
pankso@674 2 Date: 2011-10-07
pankso@674 3 Initial Package Version: 2.14.1
pankso@674 4 Upstream Status: From upstream
pankso@674 5 Origin: Matt Burgess
pankso@674 6 Description: Fixes Firefox crashes and a bug when programs link to
pankso@674 7 SDL.
pankso@674 8
pankso@674 9 diff -Naur glibc-2.14.1.orig/elf/dl-close.c glibc-2.14.1/elf/dl-close.c
pankso@674 10 --- glibc-2.14.1.orig/elf/dl-close.c 2011-10-07 09:48:55.000000000 +0000
pankso@674 11 +++ glibc-2.14.1/elf/dl-close.c 2011-10-07 19:43:10.346411120 +0000
pankso@674 12 @@ -119,17 +119,8 @@
pankso@674 13 if (map->l_direct_opencount > 0 || map->l_type != lt_loaded
pankso@674 14 || dl_close_state != not_pending)
pankso@674 15 {
pankso@674 16 - if (map->l_direct_opencount == 0)
pankso@674 17 - {
pankso@674 18 - if (map->l_type == lt_loaded)
pankso@674 19 - dl_close_state = rerun;
pankso@674 20 - else if (map->l_type == lt_library)
pankso@674 21 - {
pankso@674 22 - struct link_map **oldp = map->l_initfini;
pankso@674 23 - map->l_initfini = map->l_orig_initfini;
pankso@674 24 - _dl_scope_free (oldp);
pankso@674 25 - }
pankso@674 26 - }
pankso@674 27 + if (map->l_direct_opencount == 0 && map->l_type == lt_loaded)
pankso@674 28 + dl_close_state = rerun;
pankso@674 29
pankso@674 30 /* There are still references to this object. Do nothing more. */
pankso@674 31 if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_FILES, 0))
pankso@674 32 diff -Naur glibc-2.14.1.orig/elf/dl-deps.c glibc-2.14.1/elf/dl-deps.c
pankso@674 33 --- glibc-2.14.1.orig/elf/dl-deps.c 2011-10-07 09:48:55.000000000 +0000
pankso@674 34 +++ glibc-2.14.1/elf/dl-deps.c 2011-10-07 19:43:10.348432639 +0000
pankso@674 35 @@ -478,6 +478,7 @@
pankso@674 36 nneeded * sizeof needed[0]);
pankso@674 37 atomic_write_barrier ();
pankso@674 38 l->l_initfini = l_initfini;
pankso@674 39 + l->l_free_initfini = 1;
pankso@674 40 }
pankso@674 41
pankso@674 42 /* If we have no auxiliary objects just go on to the next map. */
pankso@674 43 @@ -678,6 +679,7 @@
pankso@674 44 l_initfini[nlist] = NULL;
pankso@674 45 atomic_write_barrier ();
pankso@674 46 map->l_initfini = l_initfini;
pankso@674 47 + map->l_free_initfini = 1;
pankso@674 48 if (l_reldeps != NULL)
pankso@674 49 {
pankso@674 50 atomic_write_barrier ();
pankso@674 51 @@ -686,7 +688,7 @@
pankso@674 52 _dl_scope_free (old_l_reldeps);
pankso@674 53 }
pankso@674 54 if (old_l_initfini != NULL)
pankso@674 55 - map->l_orig_initfini = old_l_initfini;
pankso@674 56 + _dl_scope_free (old_l_initfini);
pankso@674 57
pankso@674 58 if (errno_reason)
pankso@674 59 _dl_signal_error (errno_reason == -1 ? 0 : errno_reason, objname,
pankso@674 60 diff -Naur glibc-2.14.1.orig/elf/dl-libc.c glibc-2.14.1/elf/dl-libc.c
pankso@674 61 --- glibc-2.14.1.orig/elf/dl-libc.c 2011-10-07 09:48:55.000000000 +0000
pankso@674 62 +++ glibc-2.14.1/elf/dl-libc.c 2011-10-07 19:43:10.352411141 +0000
pankso@674 63 @@ -279,6 +279,10 @@
pankso@674 64 if (! old->dont_free)
pankso@674 65 free (old);
pankso@674 66 }
pankso@674 67 +
pankso@674 68 + /* Free the initfini dependency list. */
pankso@674 69 + if (l->l_free_initfini)
pankso@674 70 + free (l->l_initfini);
pankso@674 71 }
pankso@674 72
pankso@674 73 if (__builtin_expect (GL(dl_ns)[ns]._ns_global_scope_alloc, 0) != 0
pankso@674 74 diff -Naur glibc-2.14.1.orig/elf/rtld.c glibc-2.14.1/elf/rtld.c
pankso@674 75 --- glibc-2.14.1.orig/elf/rtld.c 2011-10-07 09:48:55.000000000 +0000
pankso@674 76 +++ glibc-2.14.1/elf/rtld.c 2011-10-07 19:43:10.355406263 +0000
pankso@674 77 @@ -2263,6 +2263,7 @@
pankso@674 78 lnp->dont_free = 1;
pankso@674 79 lnp = lnp->next;
pankso@674 80 }
pankso@674 81 + l->l_free_initfini = 0;
pankso@674 82
pankso@674 83 if (l != &GL(dl_rtld_map))
pankso@674 84 _dl_relocate_object (l, l->l_scope, GLRO(dl_lazy) ? RTLD_LAZY : 0,
pankso@674 85 diff -Naur glibc-2.14.1.orig/include/link.h glibc-2.14.1/include/link.h
pankso@674 86 --- glibc-2.14.1.orig/include/link.h 2011-10-07 09:48:55.000000000 +0000
pankso@674 87 +++ glibc-2.14.1/include/link.h 2011-10-07 19:43:10.357462703 +0000
pankso@674 88 @@ -192,6 +192,9 @@
pankso@674 89 during LD_TRACE_PRELINKING=1
pankso@674 90 contains any DT_SYMBOLIC
pankso@674 91 libraries. */
pankso@674 92 + unsigned int l_free_initfini:1; /* Nonzero if l_initfini can be
pankso@674 93 + freed, ie. not allocated with
pankso@674 94 + the dummy malloc in ld.so. */
pankso@674 95
pankso@674 96 /* Collected information about own RPATH directories. */
pankso@674 97 struct r_search_path_struct l_rpath_dirs;
pankso@674 98 @@ -240,9 +243,6 @@
pankso@674 99
pankso@674 100 /* List of object in order of the init and fini calls. */
pankso@674 101 struct link_map **l_initfini;
pankso@674 102 - /* The init and fini list generated at startup, saved when the
pankso@674 103 - object is also loaded dynamically. */
pankso@674 104 - struct link_map **l_orig_initfini;
pankso@674 105
pankso@674 106 /* List of the dependencies introduced through symbol binding. */
pankso@674 107 struct link_map_reldeps
pankso@674 108 diff -Naur glibc-2.14.1.orig/resolv/res_query.c glibc-2.14.1/resolv/res_query.c
pankso@674 109 --- glibc-2.14.1.orig/resolv/res_query.c 2011-10-07 09:48:55.000000000 +0000
pankso@674 110 +++ glibc-2.14.1/resolv/res_query.c 2011-10-07 19:43:10.361412711 +0000
pankso@674 111 @@ -122,6 +122,7 @@
pankso@674 112 int *resplen2)
pankso@674 113 {
pankso@674 114 HEADER *hp = (HEADER *) answer;
pankso@674 115 + HEADER *hp2;
pankso@674 116 int n, use_malloc = 0;
pankso@674 117 u_int oflags = statp->_flags;
pankso@674 118
pankso@674 119 @@ -239,26 +240,25 @@
pankso@674 120 /* __libc_res_nsend might have reallocated the buffer. */
pankso@674 121 hp = (HEADER *) *answerp;
pankso@674 122
pankso@674 123 - /* We simplify the following tests by assigning HP to HP2. It
pankso@674 124 - is easy to verify that this is the same as ignoring all
pankso@674 125 - tests of HP2. */
pankso@674 126 - HEADER *hp2 = answerp2 ? (HEADER *) *answerp2 : hp;
pankso@674 127 -
pankso@674 128 - if (n < (int) sizeof (HEADER) && answerp2 != NULL
pankso@674 129 - && *resplen2 > (int) sizeof (HEADER))
pankso@674 130 + /* We simplify the following tests by assigning HP to HP2 or
pankso@674 131 + vice versa. It is easy to verify that this is the same as
pankso@674 132 + ignoring all tests of HP or HP2. */
pankso@674 133 + if (answerp2 == NULL || *resplen2 < (int) sizeof (HEADER))
pankso@674 134 {
pankso@674 135 - /* Special case of partial answer. */
pankso@674 136 - assert (hp != hp2);
pankso@674 137 - hp = hp2;
pankso@674 138 + hp2 = hp;
pankso@674 139 }
pankso@674 140 - else if (answerp2 != NULL && *resplen2 < (int) sizeof (HEADER)
pankso@674 141 - && n > (int) sizeof (HEADER))
pankso@674 142 + else
pankso@674 143 {
pankso@674 144 - /* Special case of partial answer. */
pankso@674 145 - assert (hp != hp2);
pankso@674 146 - hp2 = hp;
pankso@674 147 + hp2 = (HEADER *) *answerp2;
pankso@674 148 + if (n < (int) sizeof (HEADER))
pankso@674 149 + {
pankso@674 150 + hp = hp2;
pankso@674 151 + }
pankso@674 152 }
pankso@674 153
pankso@674 154 + /* Make sure both hp and hp2 are defined */
pankso@674 155 + assert((hp != NULL) && (hp2 != NULL));
pankso@674 156 +
pankso@674 157 if ((hp->rcode != NOERROR || ntohs(hp->ancount) == 0)
pankso@674 158 && (hp2->rcode != NOERROR || ntohs(hp2->ancount) == 0)) {
pankso@674 159 #ifdef DEBUG