wok-6.x view glibc/stuff/glibc-2.14.1-fixes-1.patch @ rev 20892
Remove ashism ==
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Tue Feb 26 09:14:07 2019 +0100 (2019-02-26) |
parents | |
children |
line source
1 Submitted By: Matt Burgess <matthew_at_linuxfromscratch_dot_org>
2 Date: 2011-10-07
3 Initial Package Version: 2.14.1
4 Upstream Status: From upstream
5 Origin: Matt Burgess
6 Description: Fixes Firefox crashes and a bug when programs link to
7 SDL.
9 diff -Naur glibc-2.14.1.orig/elf/dl-close.c glibc-2.14.1/elf/dl-close.c
10 --- glibc-2.14.1.orig/elf/dl-close.c 2011-10-07 09:48:55.000000000 +0000
11 +++ glibc-2.14.1/elf/dl-close.c 2011-10-07 19:43:10.346411120 +0000
12 @@ -119,17 +119,8 @@
13 if (map->l_direct_opencount > 0 || map->l_type != lt_loaded
14 || dl_close_state != not_pending)
15 {
16 - if (map->l_direct_opencount == 0)
17 - {
18 - if (map->l_type == lt_loaded)
19 - dl_close_state = rerun;
20 - else if (map->l_type == lt_library)
21 - {
22 - struct link_map **oldp = map->l_initfini;
23 - map->l_initfini = map->l_orig_initfini;
24 - _dl_scope_free (oldp);
25 - }
26 - }
27 + if (map->l_direct_opencount == 0 && map->l_type == lt_loaded)
28 + dl_close_state = rerun;
30 /* There are still references to this object. Do nothing more. */
31 if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_FILES, 0))
32 diff -Naur glibc-2.14.1.orig/elf/dl-deps.c glibc-2.14.1/elf/dl-deps.c
33 --- glibc-2.14.1.orig/elf/dl-deps.c 2011-10-07 09:48:55.000000000 +0000
34 +++ glibc-2.14.1/elf/dl-deps.c 2011-10-07 19:43:10.348432639 +0000
35 @@ -478,6 +478,7 @@
36 nneeded * sizeof needed[0]);
37 atomic_write_barrier ();
38 l->l_initfini = l_initfini;
39 + l->l_free_initfini = 1;
40 }
42 /* If we have no auxiliary objects just go on to the next map. */
43 @@ -678,6 +679,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 @@ -686,7 +688,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);
58 if (errno_reason)
59 _dl_signal_error (errno_reason == -1 ? 0 : errno_reason, objname,
60 diff -Naur glibc-2.14.1.orig/elf/dl-libc.c glibc-2.14.1/elf/dl-libc.c
61 --- glibc-2.14.1.orig/elf/dl-libc.c 2011-10-07 09:48:55.000000000 +0000
62 +++ glibc-2.14.1/elf/dl-libc.c 2011-10-07 19:43:10.352411141 +0000
63 @@ -279,6 +279,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 }
73 if (__builtin_expect (GL(dl_ns)[ns]._ns_global_scope_alloc, 0) != 0
74 diff -Naur glibc-2.14.1.orig/elf/rtld.c glibc-2.14.1/elf/rtld.c
75 --- glibc-2.14.1.orig/elf/rtld.c 2011-10-07 09:48:55.000000000 +0000
76 +++ glibc-2.14.1/elf/rtld.c 2011-10-07 19:43:10.355406263 +0000
77 @@ -2263,6 +2263,7 @@
78 lnp->dont_free = 1;
79 lnp = lnp->next;
80 }
81 + l->l_free_initfini = 0;
83 if (l != &GL(dl_rtld_map))
84 _dl_relocate_object (l, l->l_scope, GLRO(dl_lazy) ? RTLD_LAZY : 0,
85 diff -Naur glibc-2.14.1.orig/include/link.h glibc-2.14.1/include/link.h
86 --- glibc-2.14.1.orig/include/link.h 2011-10-07 09:48:55.000000000 +0000
87 +++ glibc-2.14.1/include/link.h 2011-10-07 19:43:10.357462703 +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. */
96 /* Collected information about own RPATH directories. */
97 struct r_search_path_struct l_rpath_dirs;
98 @@ -240,9 +243,6 @@
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;
106 /* List of the dependencies introduced through symbol binding. */
107 struct link_map_reldeps
108 diff -Naur glibc-2.14.1.orig/resolv/res_query.c glibc-2.14.1/resolv/res_query.c
109 --- glibc-2.14.1.orig/resolv/res_query.c 2011-10-07 09:48:55.000000000 +0000
110 +++ glibc-2.14.1/resolv/res_query.c 2011-10-07 19:43:10.361412711 +0000
111 @@ -122,6 +122,7 @@
112 int *resplen2)
113 {
114 HEADER *hp = (HEADER *) answer;
115 + HEADER *hp2;
116 int n, use_malloc = 0;
117 u_int oflags = statp->_flags;
119 @@ -239,26 +240,25 @@
120 /* __libc_res_nsend might have reallocated the buffer. */
121 hp = (HEADER *) *answerp;
123 - /* We simplify the following tests by assigning HP to HP2. It
124 - is easy to verify that this is the same as ignoring all
125 - tests of HP2. */
126 - HEADER *hp2 = answerp2 ? (HEADER *) *answerp2 : hp;
127 -
128 - if (n < (int) sizeof (HEADER) && answerp2 != NULL
129 - && *resplen2 > (int) sizeof (HEADER))
130 + /* We simplify the following tests by assigning HP to HP2 or
131 + vice versa. It is easy to verify that this is the same as
132 + ignoring all tests of HP or HP2. */
133 + if (answerp2 == NULL || *resplen2 < (int) sizeof (HEADER))
134 {
135 - /* Special case of partial answer. */
136 - assert (hp != hp2);
137 - hp = hp2;
138 + hp2 = hp;
139 }
140 - else if (answerp2 != NULL && *resplen2 < (int) sizeof (HEADER)
141 - && n > (int) sizeof (HEADER))
142 + else
143 {
144 - /* Special case of partial answer. */
145 - assert (hp != hp2);
146 - hp2 = hp;
147 + hp2 = (HEADER *) *answerp2;
148 + if (n < (int) sizeof (HEADER))
149 + {
150 + hp = hp2;
151 + }
152 }
154 + /* Make sure both hp and hp2 are defined */
155 + assert((hp != NULL) && (hp2 != NULL));
156 +
157 if ((hp->rcode != NOERROR || ntohs(hp->ancount) == 0)
158 && (hp2->rcode != NOERROR || ntohs(hp2->ancount) == 0)) {
159 #ifdef DEBUG