]> git.pld-linux.org Git - packages/glibc.git/blame - glibc-git.patch
- rel 12
[packages/glibc.git] / glibc-git.patch
CommitLineData
65d1f28f
AM
1commit c8fc0c91695b1c7003c7170861274161f9224817
2Author: Ulrich Drepper <drepper@gmail.com>
3Date: Tue May 31 08:45:44 2011 -0400
4
5 Don't free non-malloced memory and fix memory leak
6
65d1f28f
AM
7diff --git a/nscd/nscd_getserv_r.c b/nscd/nscd_getserv_r.c
8index de96a57..f9ef056 100644
9--- a/nscd/nscd_getserv_r.c
10+++ b/nscd/nscd_getserv_r.c
11@@ -124,6 +124,7 @@ nscd_getserv_r (const char *crit, size_t critlen, const char *proto,
12 s_name = (char *) (&found->data[0].servdata + 1);
13 serv_resp = found->data[0].servdata;
14 s_proto = s_name + serv_resp.s_name_len;
15+ alloca_aliases_len = 1;
16 aliases_len = (uint32_t *) (s_proto + serv_resp.s_proto_len);
17 aliases_list = ((char *) aliases_len
18 + serv_resp.s_aliases_cnt * sizeof (uint32_t));
19@@ -154,7 +155,9 @@ nscd_getserv_r (const char *crit, size_t critlen, const char *proto,
20 + (serv_resp.s_aliases_cnt
21 * sizeof (uint32_t)));
22 if (alloca_aliases_len)
23- tmp = __alloca (serv_resp.s_aliases_cnt * sizeof (uint32_t));
24+ tmp = alloca_account (serv_resp.s_aliases_cnt
25+ * sizeof (uint32_t),
26+ alloca_used);
27 else
28 {
29 tmp = malloc (serv_resp.s_aliases_cnt * sizeof (uint32_t));
30@@ -249,8 +252,9 @@ nscd_getserv_r (const char *crit, size_t critlen, const char *proto,
31 + (serv_resp.s_aliases_cnt
32 * sizeof (uint32_t)));
33 if (alloca_aliases_len)
34- aliases_len = alloca (serv_resp.s_aliases_cnt
35- * sizeof (uint32_t));
36+ aliases_len = alloca_account (serv_resp.s_aliases_cnt
37+ * sizeof (uint32_t),
38+ alloca_used);
39 else
40 {
41 aliases_len = malloc (serv_resp.s_aliases_cnt
42@@ -368,7 +372,11 @@ nscd_getserv_r (const char *crit, size_t critlen, const char *proto,
43 }
44
45 if (retval != -1)
46- goto retry;
47+ {
48+ if (!alloca_aliases_len)
49+ free (aliases_len);
50+ goto retry;
51+ }
52 }
53
54 if (!alloca_aliases_len)
55commit 8c29731192565b9c917d6b97db78dcd302283df8
56Author: Ulrich Drepper <drepper@gmail.com>
57Date: Tue May 31 14:23:01 2011 -0400
58
59 Fix typo in stack guard setup code for old kernels
60
65d1f28f
AM
61diff --git a/sysdeps/unix/sysv/linux/dl-osinfo.h b/sysdeps/unix/sysv/linux/dl-osinfo.h
62index eb7fedc..28fce4f 100644
63--- a/sysdeps/unix/sysv/linux/dl-osinfo.h
64+++ b/sysdeps/unix/sysv/linux/dl-osinfo.h
65@@ -81,7 +81,7 @@ _dl_setup_stack_chk_guard (void *dl_random)
66 {
67 ssize_t reslen = read_not_cancel (fd, ret.bytes + 1, filllen);
68 close_not_cancel_no_status (fd);
69- if (reslen == (ssize_) filllen)
70+ if (reslen == (ssize_t) filllen)
71 return ret.num;
72 }
73 # endif
7c7c8e79
AM
74;2011-06-10 Andreas Schwab <schwab@redhat.com>
75;
76; * sysdeps/posix/getaddrinfo.c (gaih_inet): Fix logic allocating
77; tmpbuf.
78;
79diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c
80index 1e017b2..469abe2 100644
81--- a/sysdeps/posix/getaddrinfo.c
82+++ b/sysdeps/posix/getaddrinfo.c
83@@ -821,7 +821,7 @@ gaih_inet (const char *name, const struct gaih_service *service,
84 size_t tmpbuflen = 1024;
85 malloc_tmpbuf = !__libc_use_alloca (alloca_used + tmpbuflen);
86 assert (tmpbuf == NULL);
87- if (malloc_tmpbuf)
88+ if (!malloc_tmpbuf)
89 tmpbuf = alloca_account (tmpbuflen, alloca_used);
90 else
91 {
d45f4c86
AM
92commit 3d29045b5e8329d97693eda8d98f1d1e60b99c8f
93Author: H.J. Lu <hongjiu.lu@intel.com>
94Date: Fri Jun 3 07:01:25 2011 -0400
95
96 Assume Intel Core i3/i5/i7 processor if AVX is available
97
98diff --git a/sysdeps/x86_64/multiarch/init-arch.c b/sysdeps/x86_64/multiarch/init-arch.c
99index 34ec2df..809d105 100644
100--- a/sysdeps/x86_64/multiarch/init-arch.c
101+++ b/sysdeps/x86_64/multiarch/init-arch.c
102@@ -74,6 +74,7 @@ __init_cpu_features (void)
103 }
104 else if (family == 0x06)
105 {
106+ ecx = __cpu_features.cpuid[COMMON_CPUID_INDEX_1].ecx;
107 model += extended_model;
108 switch (model)
109 {
110@@ -83,6 +84,12 @@ __init_cpu_features (void)
111 __cpu_features.feature[index_Slow_BSF] |= bit_Slow_BSF;
112 break;
113
114+ default:
115+ /* Unknown family 0x06 processors. Assuming this is one
116+ of Core i3/i5/i7 processors if AVX is available. */
117+ if ((ecx & bit_AVX) == 0)
118+ break;
119+
120 case 0x1a:
121 case 0x1e:
122 case 0x1f:
123commit c71ca1f89c6e89d8c4145e4c2fdcce2fc78812bd
124Author: Andreas Jaeger <aj@suse.de>
125Date: Tue Jun 14 13:11:39 2011 -0700
126
127 Quash two memset undeclared warnings.
128
129diff --git a/nptl/pthread_rwlock_init.c b/nptl/pthread_rwlock_init.c
130index c0aa194..9ecd48c 100644
131--- a/nptl/pthread_rwlock_init.c
132+++ b/nptl/pthread_rwlock_init.c
133@@ -1,4 +1,4 @@
134-/* Copyright (C) 2002, 2007, 2009 Free Software Foundation, Inc.
135+/* Copyright (C) 2002,2007,2009,2011 Free Software Foundation, Inc.
136 This file is part of the GNU C Library.
137 Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
138
139@@ -18,6 +18,7 @@
140 02111-1307 USA. */
141
142 #include "pthreadP.h"
143+#include <string.h>
144 #include <kernel-features.h>
145
146
147diff --git a/sysdeps/unix/sysv/linux/check_native.c b/sysdeps/unix/sysv/linux/check_native.c
148index 6e6624a..dedce34 100644
149--- a/sysdeps/unix/sysv/linux/check_native.c
150+++ b/sysdeps/unix/sysv/linux/check_native.c
151@@ -1,5 +1,5 @@
152 /* Determine whether interfaces use native transport. Linux version.
153- Copyright (C) 2007 Free Software Foundation, Inc.
154+ Copyright (C) 2007,2011 Free Software Foundation, Inc.
155 This file is part of the GNU C Library.
156
157 The GNU C Library is free software; you can redistribute it and/or
158@@ -23,6 +23,7 @@
159 #include <stddef.h>
160 #include <stdint.h>
161 #include <stdlib.h>
162+#include <string.h>
163 #include <time.h>
164 #include <unistd.h>
165 #include <net/if.h>
166commit c5e3c2ae59cc8c5d3ad5e1adfd099c726baad862
167Author: Ulrich Drepper <drepper@gmail.com>
168Date: Tue Jun 21 13:06:42 2011 -0400
169
170 Minor optimization of getaddrinfo after recent patch
171
172diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c
173index 469abe2..d68ac83 100644
174--- a/sysdeps/posix/getaddrinfo.c
175+++ b/sysdeps/posix/getaddrinfo.c
176@@ -565,7 +565,6 @@ gaih_inet (const char *name, const struct gaih_service *service,
177 IPv6 scope ids. */
178 if (req->ai_family == AF_INET)
179 {
180- int family = req->ai_family;
181 size_t tmpbuflen = 512;
182 assert (tmpbuf == NULL);
183 tmpbuf = alloca_account (tmpbuflen, alloca_used);
184@@ -576,7 +575,7 @@ gaih_inet (const char *name, const struct gaih_service *service,
185
186 while (1)
187 {
188- rc = __gethostbyname2_r (name, family, &th, tmpbuf,
189+ rc = __gethostbyname2_r (name, AF_INET, &th, tmpbuf,
190 tmpbuflen, &h, &herrno);
191 if (rc != ERANGE || herrno != NETDB_INTERNAL)
192 break;
193@@ -638,18 +637,9 @@ gaih_inet (const char *name, const struct gaih_service *service,
194 (*pat)->scopeid = 0;
195 }
196 (*pat)->next = NULL;
197- (*pat)->family = req->ai_family;
198- if (family == req->ai_family)
199- memcpy ((*pat)->addr, h->h_addr_list[i],
200- h->h_length);
201- else
202- {
203- uint32_t *addr = (uint32_t *) (*pat)->addr;
204- addr[3] = *(uint32_t *) h->h_addr_list[i];
205- addr[2] = htonl (0xffff);
206- addr[1] = 0;
207- addr[0] = 0;
208- }
209+ (*pat)->family = AF_INET;
210+ memcpy ((*pat)->addr, h->h_addr_list[i],
211+ h->h_length);
212 pat = &((*pat)->next);
213 }
214 }
215commit c0244a9dedce43a4b950d91451b16a7cf5408476
216Author: Ulrich Drepper <drepper@gmail.com>
217Date: Tue Jun 21 17:03:38 2011 -0400
218
219 Fix IPv6-only lookups through getaddrinfo
220
221 A recent patch introduced a problem where IPv6 lookups happily returned
222 IPv4 addresses.
223
224diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c
225index d68ac83..3a2737e 100644
226--- a/sysdeps/posix/getaddrinfo.c
227+++ b/sysdeps/posix/getaddrinfo.c
228@@ -871,16 +871,44 @@ gaih_inet (const char *name, const struct gaih_service *service,
229 }
230 }
231
232- no_inet6_data = no_data;
233-
234 if (status == NSS_STATUS_SUCCESS)
235 {
236+ assert (!no_data);
237+ no_data = 1;
238+
239 if ((req->ai_flags & AI_CANONNAME) != 0 && canon == NULL)
240 canon = (*pat)->name;
241
242 while (*pat != NULL)
243- pat = &((*pat)->next);
244+ {
245+ if ((*pat)->family == AF_INET
246+ && req->ai_family == AF_INET6
247+ && (req->ai_flags & AI_V4MAPPED) != 0)
248+ {
249+ uint32_t *pataddr = (*pat)->addr;
250+ (*pat)->family = AF_INET6;
251+ pataddr[3] = pataddr[0];
252+ pataddr[2] = htonl (0xffff);
253+ pataddr[1] = 0;
254+ pataddr[0] = 0;
255+ pat = &((*pat)->next);
256+ no_data = 0;
257+ }
258+ else if ((*pat)->family == AF_UNSPEC
259+ || (*pat)->family == req->ai_family)
260+ {
261+ pat = &((*pat)->next);
262+
263+ no_data = 0;
264+ if (req->ai_family == AF_INET6)
265+ got_ipv6 = true;
266+ }
267+ else
268+ *pat = ((*pat)->next);
269+ }
270 }
271+
272+ no_inet6_data = no_data;
273 }
274 else
275 {
276commit 6e502e19455c6110dd4487d91b7b7d6d8121f9ba
277Author: Ulrich Drepper <drepper@gmail.com>
278Date: Wed Jun 22 08:32:55 2011 -0400
279
280 Clean up after kernel sigcontext header mess
281
282diff --git a/sysdeps/unix/sysv/linux/bits/sigcontext.h b/sysdeps/unix/sysv/linux/bits/sigcontext.h
283index 67dcf94..0f5b607 100644
284--- a/sysdeps/unix/sysv/linux/bits/sigcontext.h
285+++ b/sysdeps/unix/sysv/linux/bits/sigcontext.h
286@@ -1,4 +1,4 @@
287-/* Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
288+/* Copyright (C) 1996, 1997, 1998, 2011 Free Software Foundation, Inc.
289 This file is part of the GNU C Library.
290
291 The GNU C Library is free software; you can redistribute it and/or
292@@ -26,4 +26,8 @@
293 # define sigcontext_struct sigcontext
294
295 # include <asm/sigcontext.h>
296+
297+/* The Linux kernel headers redefine NULL wrongly, so cleanup afterwards. */
298+# define __need_NULL
299+# include <stddef.h>
300 #endif
301commit 852eb34d5c56bc75bdd82327fcf310d98655f6b0
302Author: Ulrich Drepper <drepper@gmail.com>
303Date: Wed Jun 22 09:50:39 2011 -0400
304
305 Rate limit expensive _SC_NPROCESSORS_ONLN computation
306
307diff --git a/sysdeps/unix/sysv/linux/getsysstats.c b/sysdeps/unix/sysv/linux/getsysstats.c
308index af454b6..a13b6e3 100644
309--- a/sysdeps/unix/sysv/linux/getsysstats.c
310+++ b/sysdeps/unix/sysv/linux/getsysstats.c
311@@ -1,5 +1,5 @@
312 /* Determine various system internal values, Linux version.
313- Copyright (C) 1996-2003,2006,2007,2009,2010 Free Software Foundation, Inc.
314+ Copyright (C) 1996-2003,2006,2007,2009,2010,2011 Free Software Foundation, Inc.
315 This file is part of the GNU C Library.
316 Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
317
318@@ -35,6 +35,16 @@
319
320 #include <atomic.h>
321 #include <not-cancel.h>
322+#include <kernel-features.h>
323+
324+#ifndef HAVE_CLOCK_GETTIME_VSYSCALL
325+# undef INTERNAL_VSYSCALL
326+# define INTERNAL_VSYSCALL INTERNAL_SYSCALL
327+# undef INLINE_VSYSCALL
328+# define INLINE_VSYSCALL INLINE_SYSCALL
329+#else
330+# include <bits/libc-vdso.h>
331+#endif
332
333
334 /* How we can determine the number of available processors depends on
335@@ -128,6 +138,22 @@ next_line (int fd, char *const buffer, char **cp, char **re,
336 int
337 __get_nprocs ()
338 {
339+ static int cached_result;
340+ static time_t timestamp;
341+
342+#ifdef __ASSUME_POSIX_TIMERS
343+ struct timespec ts;
344+ INTERNAL_SYSCALL_DECL (err);
345+ INTERNAL_VSYSCALL (clock_gettime, err, 2, CLOCK_REALTIME, &ts);
346+#else
347+ struct timeval ts;
348+ gettimeofday (&ts, NULL);
349+#endif
350+ time_t prev = timestamp;
351+ atomic_read_barrier ();
352+ if (ts.tv_sec == prev)
353+ return cached_result;
354+
355 /* XXX Here will come a test for the new system call. */
356
357 const size_t buffer_size = __libc_use_alloca (8192) ? 8192 : 512;
358@@ -169,6 +195,10 @@ __get_nprocs ()
359 }
360 }
361
362+ cached_result = result;
363+ atomic_write_barrier ();
364+ timestamp = ts.tv_sec;
365+
366 return result;
367 }
368 weak_alias (__get_nprocs, get_nprocs)
369commit 84e2a551a72c79b020694bb327e33b6d71b09b63
370Author: Ulrich Drepper <drepper@gmail.com>
371Date: Wed Jun 22 10:32:07 2011 -0400
372
373 Use a /sys/devices/system/cpu/online for _SC_NPROCESSORS_ONLN implementation
374
375diff --git a/sysdeps/unix/sysv/linux/getsysstats.c b/sysdeps/unix/sysv/linux/getsysstats.c
376index a13b6e3..b74774f 100644
377--- a/sysdeps/unix/sysv/linux/getsysstats.c
378+++ b/sysdeps/unix/sysv/linux/getsysstats.c
379@@ -161,20 +161,65 @@ __get_nprocs ()
380 char *buffer_end = buffer + buffer_size;
381 char *cp = buffer_end;
382 char *re = buffer_end;
383- int result = 1;
384
385 #ifdef O_CLOEXEC
386 const int flags = O_RDONLY | O_CLOEXEC;
387 #else
388 const int flags = O_RDONLY;
389 #endif
390+ int fd = open_not_cancel_2 ("/sys/devices/system/cpu/online", flags);
391+ char *l;
392+ int result = 0;
393+ if (fd != -1)
394+ {
395+ l = next_line (fd, buffer, &cp, &re, buffer_end);
396+ if (l != NULL)
397+ do
398+ {
399+ char *endp;
400+ unsigned long int n = strtoul (l, &endp, 10);
401+ if (l == endp)
402+ {
403+ result = 0;
404+ break;
405+ }
406+
407+ unsigned long int m = n;
408+ if (*endp == '-')
409+ {
410+ l = endp + 1;
411+ m = strtoul (l, &endp, 10);
412+ if (l == endp)
413+ {
414+ result = 0;
415+ break;
416+ }
417+ }
418+
419+ result += m - n + 1;
420+
421+ l = endp;
422+ while (l < re && isspace (*l))
423+ ++l;
424+ }
425+ while (l < re);
426+
427+ close_not_cancel_no_status (fd);
428+
429+ if (result > 0)
430+ goto out;
431+ }
432+
433+ cp = buffer_end;
434+ re = buffer_end;
435+ result = 1;
436+
437 /* The /proc/stat format is more uniform, use it by default. */
438- int fd = open_not_cancel_2 ("/proc/stat", flags);
439+ fd = open_not_cancel_2 ("/proc/stat", flags);
440 if (fd != -1)
441 {
442 result = 0;
443
444- char *l;
445 while ((l = next_line (fd, buffer, &cp, &re, buffer_end)) != NULL)
446 /* The current format of /proc/stat has all the cpu* entries
447 at the front. We assume here that stays this way. */
448@@ -195,6 +240,7 @@ __get_nprocs ()
449 }
450 }
451
452+ out:
453 cached_result = result;
454 atomic_write_barrier ();
455 timestamp = ts.tv_sec;
456commit e12df166d37522c2ed434c2d70a1b04640d2d7c6
457Author: Andreas Schwab <schwab@redhat.com>
458Date: Wed Jun 22 14:35:49 2011 -0400
459
460 Fix Ipv4&IPv6 lookup in getaddrinfo
461
462 Problem introduced in the last patch.
463
464diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c
465index 3a2737e..14e9270 100644
466--- a/sysdeps/posix/getaddrinfo.c
467+++ b/sysdeps/posix/getaddrinfo.c
468@@ -894,7 +894,7 @@ gaih_inet (const char *name, const struct gaih_service *service,
469 pat = &((*pat)->next);
470 no_data = 0;
471 }
472- else if ((*pat)->family == AF_UNSPEC
473+ else if (req->ai_family == AF_UNSPEC
474 || (*pat)->family == req->ai_family)
475 {
476 pat = &((*pat)->next);
477commit fa3fc0fe5f452d0aa7e435d8f32e992958683819
478Author: Ulrich Drepper <drepper@gmail.com>
479Date: Wed Jun 22 15:00:54 2011 -0400
480
481 Avoid __check_pf calls in getaddrinfo unless really needed
482
483diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c
484index 14e9270..05c883d 100644
485--- a/sysdeps/posix/getaddrinfo.c
486+++ b/sysdeps/posix/getaddrinfo.c
487@@ -2352,14 +2352,17 @@ getaddrinfo (const char *name, const char *service,
488 size_t in6ailen = 0;
489 bool seen_ipv4 = false;
490 bool seen_ipv6 = false;
491- /* We might need information about what interfaces are available.
492- Also determine whether we have IPv4 or IPv6 interfaces or both. We
493- cannot cache the results since new interfaces could be added at
494- any time. */
495- __check_pf (&seen_ipv4, &seen_ipv6, &in6ai, &in6ailen);
496+ bool check_pf_called = false;
497
498 if (hints->ai_flags & AI_ADDRCONFIG)
499 {
500+ /* We might need information about what interfaces are available.
501+ Also determine whether we have IPv4 or IPv6 interfaces or both. We
502+ cannot cache the results since new interfaces could be added at
503+ any time. */
504+ __check_pf (&seen_ipv4, &seen_ipv6, &in6ai, &in6ailen);
505+ check_pf_called = true;
506+
507 /* Now make a decision on what we return, if anything. */
508 if (hints->ai_family == PF_UNSPEC && (seen_ipv4 || seen_ipv6))
509 {
510@@ -2441,6 +2444,10 @@ getaddrinfo (const char *name, const char *service,
511 struct addrinfo *last = NULL;
512 char *canonname = NULL;
513
514+ /* Now we definitely need the interface information. */
515+ if (! check_pf_called)
516+ __check_pf (&seen_ipv4, &seen_ipv6, &in6ai, &in6ailen);
517+
518 /* If we have information about deprecated and temporary addresses
519 sort the array now. */
520 if (in6ai != NULL)
10441e2e
AM
521commit 034807a9cbddfa9e7d35df4cdb2ecce569a00851
522Author: Ulrich Drepper <drepper@gmail.com>
523Date: Mon Jun 27 13:10:44 2011 -0400
524
525 Fix handling of RES_USE_INET6 big in nscd
526
527 This fixes BZ #12350 also for nscd.
528
529diff --git a/nscd/aicache.c b/nscd/aicache.c
530index 3190a13..6c8d83a 100644
531--- a/nscd/aicache.c
532+++ b/nscd/aicache.c
533@@ -534,7 +534,7 @@ next_nip:
534 }
535
536 out:
537- _res.options = old_res_options;
538+ _res.options |= old_res_options & RES_USE_INET6;
539
540 if (dataset != NULL && !alloca_used)
541 {
44758a88
AM
542commit 89f654c57b3b9a6aee480e25e37f88f06c898901
543Author: Andreas Schwab <schwab@redhat.com>
544Date: Thu Jun 30 06:33:32 2011 -0400
545
546 Make sure RES_USE_INET6 is always restored
547
548diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c
549index 05c883d..6d574c5 100644
550--- a/sysdeps/posix/getaddrinfo.c
551+++ b/sysdeps/posix/getaddrinfo.c
552@@ -818,6 +818,7 @@ gaih_inet (const char *name, const struct gaih_service *service,
553 tmpbuf = malloc (tmpbuflen);
554 if (tmpbuf == NULL)
555 {
556+ _res.options |= old_res_options & RES_USE_INET6;
557 result = -EAI_MEMORY;
558 goto free_and_return;
559 }
560@@ -862,6 +863,7 @@ gaih_inet (const char *name, const struct gaih_service *service,
561 2 * tmpbuflen);
562 if (newp == NULL)
563 {
564+ _res.options |= old_res_options & RES_USE_INET6;
565 result = -EAI_MEMORY;
566 goto free_and_return;
567 }
568@@ -981,6 +983,8 @@ gaih_inet (const char *name, const struct gaih_service *service,
569 canonbuf = malloc (max_fqdn_len);
570 if (canonbuf == NULL)
571 {
572+ _res.options
573+ |= old_res_options & RES_USE_INET6;
574 result = -EAI_MEMORY;
575 goto free_and_return;
576 }
This page took 0.098957 seconds and 4 git commands to generate.