glibc: Update patchset.

Import latest patches from RHEL6.
This commit is contained in:
Michael Tremer
2013-10-12 16:03:05 +02:00
parent 1a3dbe91b2
commit 30a4e82787
30 changed files with 10145 additions and 56 deletions

View File

@@ -227,13 +227,37 @@ endif
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/glibc/glibc-rh795498.patch
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/glibc/glibc-rh797094-1.patch
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/glibc/glibc-rh797094-2.patch
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/glibc/glibc-rh804630.patch
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/glibc/glibc-rh804686.patch
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/glibc/glibc-rh804689.patch
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/glibc/glibc-rh806404.patch
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/glibc/glibc-rh808337.patch
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/glibc/glibc-rh808545.patch
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/glibc/glibc-rh809602.patch
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/glibc/glibc-rh833716.patch
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/glibc/glibc-rh837026.patch
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/glibc/glibc-rh809726.patch
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/glibc/glibc-rh823909.patch
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/glibc/glibc-rh826149.patch
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/glibc/glibc-rh827362.patch
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/glibc/glibc-rh830127.patch
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/glibc/glibc-rh832516.patch
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/glibc/glibc-rh832694.patch
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/glibc/glibc-rh833717.patch
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/glibc/glibc-rh837695.patch
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/glibc/glibc-rh837918.patch
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/glibc/glibc-rh841787.patch
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/glibc/glibc-rh843673.patch
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/glibc/glibc-rh846342.patch
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/glibc/glibc-rh847932.patch
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/glibc/glibc-rh848082.patch
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/glibc/glibc-rh849203.patch
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/glibc/glibc-rh849651.patch
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/glibc/glibc-rh852445.patch
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/glibc/glibc-rh861167.patch
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/glibc/glibc-rh863453.patch
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/glibc/glibc-rh864322.patch
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/glibc/glibc-rh929388.patch
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/glibc/glibc-rh970992.patch
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/glibc/glibc-rh989558.patch
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/glibc/glibc-rh989558-2.patch
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/glibc-resolv-stack_chk_fail.patch
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/glibc-remove-ctors-dtors-output-sections.patch

View File

@@ -1,23 +0,0 @@
diff -rup c/resolv/res_send.c d/resolv/res_send.c
--- c/resolv/res_send.c 2012-01-01 05:16:32.000000000 -0700
+++ d/resolv/res_send.c 2012-03-30 12:39:30.862467628 -0600
@@ -409,6 +409,7 @@ __libc_res_nsend(res_state statp, const
*/
if (EXT(statp).nsinit == 0) {
unsigned char map[MAXNS];
+ unsigned int ext_total_nscount;
memset (map, MAXNS, sizeof (map));
for (n = 0; n < MAXNS; n++) {
@@ -422,8 +423,9 @@ __libc_res_nsend(res_state statp, const
}
}
n = statp->nscount;
- if (statp->nscount > EXT(statp).nscount)
- for (n = EXT(statp).nscount, ns = 0;
+ ext_total_nscount = EXT(statp).nscount + EXT(statp).nscount6;
+ if (statp->nscount > ext_total_nscount)
+ for (n = ext_total_nscount, ns = 0;
n < statp->nscount; n++) {
while (ns < MAXNS
&& EXT(statp).nsmap[ns] != MAXNS)

View File

@@ -0,0 +1,87 @@
--- a/resolv/res_query.c 2010-05-04 05:27:23.000000000 -0600
+++ a/resolv/res_query.c 2012-08-03 13:43:10.761506047 -0600
@@ -122,6 +122,7 @@ __libc_res_nquery(res_state statp,
int *resplen2)
{
HEADER *hp = (HEADER *) answer;
+ HEADER *hp2;
int n, use_malloc = 0;
u_int oflags = statp->_flags;
@@ -239,26 +240,25 @@ __libc_res_nquery(res_state statp,
/* __libc_res_nsend might have reallocated the buffer. */
hp = (HEADER *) *answerp;
- /* We simplify the following tests by assigning HP to HP2. It
- is easy to verify that this is the same as ignoring all
- tests of HP2. */
- HEADER *hp2 = answerp2 ? (HEADER *) *answerp2 : hp;
-
- if (n < (int) sizeof (HEADER) && answerp2 != NULL
- && *resplen2 > (int) sizeof (HEADER))
+ /* We simplify the following tests by assigning HP to HP2 or
+ vice versa. It is easy to verify that this is the same as
+ ignoring all tests of HP or HP2. */
+ if (answerp2 == NULL || *resplen2 < (int) sizeof (HEADER))
{
- /* Special case of partial answer. */
- assert (hp != hp2);
- hp = hp2;
+ hp2 = hp;
}
- else if (answerp2 != NULL && *resplen2 < (int) sizeof (HEADER)
- && n > (int) sizeof (HEADER))
+ else
{
- /* Special case of partial answer. */
- assert (hp != hp2);
- hp2 = hp;
+ hp2 = (HEADER *) *answerp2;
+ if (n < (int) sizeof (HEADER))
+ {
+ hp = hp2;
+ }
}
+ /* Make sure both hp and hp2 are defined */
+ assert((hp != NULL) && (hp2 != NULL));
+
if ((hp->rcode != NOERROR || ntohs(hp->ancount) == 0)
&& (hp2->rcode != NOERROR || ntohs(hp2->ancount) == 0)) {
#ifdef DEBUG
--- a/resolv/res_send.c 2012-08-03 13:31:26.622168278 -0600
+++ a/resolv/res_send.c 2012-08-03 13:43:11.881501862 -0600
@@ -549,7 +549,7 @@ __libc_res_nsend(res_state statp, const
ns, ansp, ansp2, nansp2, resplen2);
if (n < 0)
return (-1);
- if (n == 0)
+ if (n == 0 && (buf2 == NULL || *resplen2 == 0))
goto next_ns;
} else {
/* Use datagrams. */
@@ -559,7 +559,7 @@ __libc_res_nsend(res_state statp, const
ansp2, nansp2, resplen2);
if (n < 0)
return (-1);
- if (n == 0)
+ if (n == 0 && (buf2 == NULL || *resplen2 == 0))
goto next_ns;
if (v_circuit)
// XXX Check whether both requests failed or
@@ -1275,10 +1275,14 @@ send_dg(res_state statp,
(*thisresplenp > *thisanssizp)
? *thisanssizp : *thisresplenp);
- if (recvresp1 || (buf2 != NULL && recvresp2))
+ if (recvresp1 || (buf2 != NULL && recvresp2)) {
+ *resplen2 = 0;
return resplen;
+ }
if (buf2 != NULL)
{
+ /* No data from the first reply. */
+ resplen = 0;
/* We are waiting for a possible second reply. */
if (hp->id == anhp->id)
recvresp1 = 1;

View File

@@ -0,0 +1,12 @@
diff -rup a/nss/getnssent.c b/nss/getnssent.c
--- a/nss/getnssent.c 2004-12-13 14:48:34.000000000 -0700
+++ b/nss/getnssent.c 2012-03-23 13:46:54.639095121 -0600
@@ -33,7 +33,7 @@ __nss_getent (getent_r_function func, vo
*buffer = malloc (*buffer_size);
}
- while (buffer != NULL
+ while (*buffer != NULL
&& func (resbuf, *buffer, *buffer_size, &result, h_errnop) == ERANGE
&& (h_errnop == NULL || *h_errnop == NETDB_INTERNAL))
{

View File

@@ -0,0 +1,89 @@
diff -rup a/localedata/locales/fi_FI b/localedata/locales/fi_FI
--- a/localedata/locales/fi_FI 2012-07-11 14:48:45.994749607 -0600
+++ b/localedata/locales/fi_FI 2012-07-11 14:50:20.003277477 -0600
@@ -63,60 +63,65 @@ reorder-after <z>
<a-diaerisis>
<o-diaerisis>
-reorder-after <U005A>
+reorder-after <U007A>
<U00E5> <a-ring>;<BAS>;<MIN>;IGNORE
-<U00C5> <a-ring>;<BAS>;<CAP>;IGNORE
<U01FB> <a-ring>;<ACA>;<MIN>;IGNORE
-<U01FA> <a-ring>;<ACA>;<CAP>;IGNORE
<U00E4> <a-diaerisis>;<BAS>;<MIN>;IGNORE
-<U00C4> <a-diaerisis>;<BAS>;<CAP>;IGNORE
<U00E6> <a-diaerisis>;<REU>;<MIN>;IGNORE
-<U00C6> <a-diaerisis>;<REU>;<CAP>;IGNORE
<U01FD> <a-diaerisis>;<U01FD>;<MIN>;IGNORE
-<U01FC> <a-diaerisis>;<U01FD>;<CAP>;IGNORE
<U01E3> <a-diaerisis>;<MAC>;<MIN>;IGNORE
-<U01E2> <a-diaerisis>;<MAC>;<CAP>;IGNORE
<U00F6> <o-diaerisis>;<BAS>;<MIN>;IGNORE
-<U00D6> <o-diaerisis>;<BAS>;<CAP>;IGNORE
<U00F8> <o-diaerisis>;<U00D8>;<MIN>;IGNORE
-<U00D8> <o-diaerisis>;<U00D8>;<CAP>;IGNORE
<U01FF> <o-diaerisis>;<U01FF>;<MIN>;IGNORE
-<U01FE> <o-diaerisis>;<U01FF>;<CAP>;IGNORE
<U00F5> <o-diaerisis>;<TIL>;<MIN>;IGNORE
+reorder-after <U005A>
+<U00C5> <a-ring>;<BAS>;<CAP>;IGNORE
+<U01FA> <a-ring>;<ACA>;<CAP>;IGNORE
+<U00C4> <a-diaerisis>;<BAS>;<CAP>;IGNORE
+<U00C6> <a-diaerisis>;<REU>;<CAP>;IGNORE
+<U01FC> <a-diaerisis>;<U01FD>;<CAP>;IGNORE
+<U01E2> <a-diaerisis>;<MAC>;<CAP>;IGNORE
+<U00D6> <o-diaerisis>;<BAS>;<CAP>;IGNORE
+<U00D8> <o-diaerisis>;<U00D8>;<CAP>;IGNORE
+<U01FE> <o-diaerisis>;<U01FF>;<CAP>;IGNORE
<U00D5> <o-diaerisis>;<TIL>;<CAP>;IGNORE
-reorder-after <U016A>
+reorder-after <U016B>
<U0076> <v>;<U0056>;<BAS>;<MIN>
-<U0056> <v>;<U0056>;<BAS>;<CAP>
<U1E7D> <v>;<U0056>;<TIL>;<MIN>
-<U1E7C> <v>;<U0056>;<TIL>;<CAP>
<U0077> <w>;<U0057>;<BAS>;<MIN>
-<U0057> <w>;<U0057>;<BAS>;<CAP>
<U1E83> <w>;<U0057>;<ACA>;<MIN>
-<U1E82> <w>;<U0057>;<ACA>;<CAP>
<U1E81> <w>;<U0057>;<GRA>;<MIN>
-<U1E80> <w>;<U0057>;<GRA>;<CAP>
<U0175> <w>;<U0057>;<CIR>;<MIN>
-<U0174> <w>;<U0057>;<CIR>;<CAP>
<U1E85> <w>;<U0057>;<REU>;<MIN>
-<U1E84> <w>;<U0057>;<REU>;<CAP>
<U1E87> <w>;<U0057>;<PCT>;<MIN>
+reorder-after <U016A>
+<U0056> <v>;<U0056>;<BAS>;<CAP>
+<U1E7C> <v>;<U0056>;<TIL>;<CAP>
+<U0057> <w>;<U0057>;<BAS>;<CAP>
+<U1E82> <w>;<U0057>;<ACA>;<CAP>
+<U1E80> <w>;<U0057>;<GRA>;<CAP>
+<U0174> <w>;<U0057>;<CIR>;<CAP>
+<U1E84> <w>;<U0057>;<REU>;<CAP>
<U1E86> <w>;<U0057>;<PCT>;<CAP>
reorder-after <U00FF>
<U00FC> <y>;<DTT>;<MIN>;IGNORE
+reorder-after <U0178>
<U00DC> <y>;<DTT>;<CAP>;IGNORE
% Present in iso14651_t1, but these definitions seem to have been
% removed from latest iso14651 tables.
-reorder-after <U0162>
+reorder-after <U0163>
<U00FE> "<t><h>";"<LIG><LIG>";"<MIN><MIN>";IGNORE
+reorder-after <U0162>
<U00DE> "<t><h>";"<LIG><LIG>";"<CAP><CAP>";IGNORE
reorder-after <U0064>
<U00F0> <d>;<PCL>;<MIN>;IGNORE
-<U00D0> <d>;<PCL>;<CAP>;IGNORE
<U0111> <d>;<OBL>;<MIN>;IGNORE
+reorder-after <U0044>
+<U00D0> <d>;<PCL>;<CAP>;IGNORE
<U0110> <d>;<OBL>;<CAP>;IGNORE
reorder-end

View File

@@ -0,0 +1,25 @@
diff --git a/iconvdata/ibm930.c b/iconvdata/ibm930.c
index 25a9be0..6f758eb 100644
--- a/iconvdata/ibm930.c
+++ b/iconvdata/ibm930.c
@@ -162,7 +162,8 @@ enum
while (ch > rp2->end) \
++rp2; \
\
- if (__builtin_expect (ch < rp2->start, 0) \
+ if (__builtin_expect (rp2->start == 0xffff, 0) \
+ || __builtin_expect (ch < rp2->start, 0) \
|| (res = __ibm930db_to_ucs4[ch + rp2->idx], \
__builtin_expect (res, L'\1') == L'\0' && ch != '\0')) \
{ \
@@ -215,7 +216,8 @@ enum
while (ch > rp2->end) \
++rp2; \
\
- if (__builtin_expect (ch < rp2->start, 0) \
+ if (__builtin_expect (rp2->start == 0xffff, 0) \
+ || __builtin_expect (ch < rp2->start, 0) \
|| (cp = __ucs4_to_ibm930db[ch + rp2->idx], \
__builtin_expect (cp[0], L'\1')== L'\0' && ch != '\0')) \
{ \

View File

@@ -0,0 +1,80 @@
diff -Nrup a/posix/fnmatch.c b/posix/fnmatch.c
--- a/posix/fnmatch.c 2012-05-25 12:37:26.566678872 -0400
+++ b/posix/fnmatch.c 2012-05-25 13:08:44.451972286 -0400
@@ -333,6 +333,7 @@ fnmatch (pattern, string, flags)
# if HANDLE_MULTIBYTE
if (__builtin_expect (MB_CUR_MAX, 1) != 1)
{
+ const char *orig_pattern = pattern;
mbstate_t ps;
size_t n;
const char *p;
@@ -356,10 +357,9 @@ fnmatch (pattern, string, flags)
alloca_used);
n = mbsrtowcs (wpattern, &p, n + 1, &ps);
if (__builtin_expect (n == (size_t) -1, 0))
- /* Something wrong.
- XXX Do we have to set `errno' to something which mbsrtows hasn't
- already done? */
- return -1;
+ /* Something wrong: Fall back to single byte matching. */
+ goto try_singlebyte;
+
if (p)
{
memset (&ps, '\0', sizeof (ps));
@@ -371,10 +371,8 @@ fnmatch (pattern, string, flags)
prepare_wpattern:
n = mbsrtowcs (NULL, &pattern, 0, &ps);
if (__builtin_expect (n == (size_t) -1, 0))
- /* Something wrong.
- XXX Do we have to set `errno' to something which mbsrtows hasn't
- already done? */
- return -1;
+ /* Something wrong: Fall back to single byte matching. */
+ goto try_singlebyte;
if (__builtin_expect (n >= (size_t) -1 / sizeof (wchar_t), 0))
{
__set_errno (ENOMEM);
@@ -401,14 +399,8 @@ fnmatch (pattern, string, flags)
alloca_used);
n = mbsrtowcs (wstring, &p, n + 1, &ps);
if (__builtin_expect (n == (size_t) -1, 0))
- {
- /* Something wrong.
- XXX Do we have to set `errno' to something which
- mbsrtows hasn't already done? */
- free_return:
- free (wpattern_malloc);
- return -1;
- }
+ /* Something wrong: Fall back to single byte matching. */
+ goto free_and_try_singlebyte;
if (p)
{
memset (&ps, '\0', sizeof (ps));
@@ -420,10 +412,8 @@ fnmatch (pattern, string, flags)
prepare_wstring:
n = mbsrtowcs (NULL, &string, 0, &ps);
if (__builtin_expect (n == (size_t) -1, 0))
- /* Something wrong.
- XXX Do we have to set `errno' to something which mbsrtows hasn't
- already done? */
- goto free_return;
+ /* Something wrong: Fall back to single byte matching. */
+ goto free_and_try_singlebyte;
if (__builtin_expect (n >= (size_t) -1 / sizeof (wchar_t), 0))
{
free (wpattern_malloc);
@@ -450,6 +440,11 @@ fnmatch (pattern, string, flags)
free (wpattern_malloc);
return res;
+
+ free_and_try_singlebyte:
+ free(wpattern_malloc);
+ try_singlebyte:
+ pattern = orig_pattern;
}
# endif /* mbstate_t and mbsrtowcs or _LIBC. */

View File

@@ -0,0 +1,250 @@
diff -pruN glibc-2.12-2-gc4ccff1/libio/Makefile glibc-2.12-2-gc4ccff1.fseek/libio/Makefile
--- glibc-2.12-2-gc4ccff1/libio/Makefile 2010-05-04 16:57:23.000000000 +0530
+++ glibc-2.12-2-gc4ccff1.fseek/libio/Makefile 2012-09-05 17:28:08.699360413 +0530
@@ -58,7 +58,7 @@ tests = tst_swprintf tst_wprintf tst_sws
tst-memstream1 tst-memstream2 \
tst-wmemstream1 tst-wmemstream2 \
bug-memstream1 bug-wmemstream1 \
- tst-setvbuf1 tst-popen1 tst-fgetwc bug-wsetpos
+ tst-setvbuf1 tst-popen1 tst-fgetwc bug-wsetpos tst-fseek
test-srcs = test-freopen
all: # Make this the default target; it will be defined in Rules.
diff -pruN glibc-2.12-2-gc4ccff1/libio/tst-fseek.c glibc-2.12-2-gc4ccff1.fseek/libio/tst-fseek.c
--- glibc-2.12-2-gc4ccff1/libio/tst-fseek.c 1970-01-01 05:30:00.000000000 +0530
+++ glibc-2.12-2-gc4ccff1.fseek/libio/tst-fseek.c 2012-09-05 17:27:33.606359692 +0530
@@ -0,0 +1,153 @@
+/* Verify that fseek/ftell combination works for wide chars.
+
+ Copyright (C) 2012 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <locale.h>
+#include <errno.h>
+#include <wchar.h>
+#include <unistd.h>
+#include <string.h>
+
+/* Defined in test-skeleton.c. */
+static int create_temp_file (const char *base, char **filename);
+
+
+static int
+do_seek_end (FILE *fp)
+{
+ long save;
+
+ if (fp == NULL)
+ {
+ printf ("do_seek_end: fopen: %s\n", strerror (errno));
+ return 1;
+ }
+
+ if (fputws (L"abc\n", fp) == -1)
+ {
+ printf ("do_seek_end: fputws: %s\n", strerror (errno));
+ return 1;
+ }
+
+ save = ftell (fp);
+ rewind (fp);
+
+ if (fseek (fp, 0, SEEK_END) == -1)
+ {
+ printf ("do_seek_end: fseek: %s\n", strerror (errno));
+ return 1;
+ }
+
+ if (save != ftell (fp))
+ {
+ printf ("save = %ld, ftell = %ld\n", save, ftell (fp));
+ return 1;
+ }
+
+ return 0;
+}
+
+int
+do_seek_set (FILE *fp)
+{
+ long save;
+
+ if (fputws (L"abc\n", fp) == -1)
+ {
+ printf ("seek_set: fputws: %s\n", strerror (errno));
+ return 1;
+ }
+
+ save = ftell (fp);
+
+ if (fputws (L"xyz\n", fp) == -1)
+ {
+ printf ("seek_set: fputws: %s\n", strerror (errno));
+ return 1;
+ }
+
+ if (fseek (fp, save, SEEK_SET) == -1)
+ {
+ printf ("seek_set: fseek: %s\n", strerror (errno));
+ return 1;
+ }
+
+ if (save != ftell (fp))
+ {
+ printf ("save = %ld, ftell = %ld\n", save, ftell (fp));
+ return 1;
+ }
+
+ return 0;
+}
+
+static int
+do_test (void)
+{
+ if (setlocale (LC_ALL, "en_US.utf8") == NULL)
+ {
+ printf ("Cannot set en_US.utf8 locale.\n");
+ exit (1);
+ }
+
+ int ret = 0;
+ char *filename;
+ int fd = create_temp_file ("tst-fseek.out", &filename);
+
+ if (fd == -1)
+ return 1;
+
+ FILE *fp = fdopen (fd, "w+");
+ if (fp == NULL)
+ {
+ printf ("seek_set: fopen: %s\n", strerror (errno));
+ close (fd);
+ return 1;
+ }
+
+ if (do_seek_set (fp))
+ {
+ printf ("SEEK_SET test failed\n");
+ ret = 1;
+ }
+
+ /* Reopen the file. */
+ fclose (fp);
+ fp = fopen (filename, "w+");
+ if (fp == NULL)
+ {
+ printf ("seek_end: fopen: %s\n", strerror (errno));
+ return 1;
+ }
+
+ if (do_seek_end (fp))
+ {
+ printf ("SEEK_END test failed\n");
+ ret = 1;
+ }
+
+ fclose (fp);
+
+ return ret;
+}
+
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff -pruN glibc-2.12-2-gc4ccff1/libio/wfileops.c glibc-2.12-2-gc4ccff1.fseek/libio/wfileops.c
--- glibc-2.12-2-gc4ccff1/libio/wfileops.c 2010-05-04 16:57:23.000000000 +0530
+++ glibc-2.12-2-gc4ccff1.fseek/libio/wfileops.c 2012-09-05 17:27:33.608359685 +0530
@@ -547,6 +547,55 @@ _IO_wfile_sync (fp)
}
INTDEF(_IO_wfile_sync)
+/* Adjust the internal buffer pointers to reflect the state in the external
+ buffer. The content between fp->_IO_read_base and fp->_IO_read_ptr is
+ assumed to be converted and available in the range
+ fp->_wide_data->_IO_read_base and fp->_wide_data->_IO_read_end. */
+static inline int
+adjust_wide_data (_IO_FILE *fp, bool do_convert)
+{
+ struct _IO_codecvt *cv = fp->_codecvt;
+
+ int clen = (*cv->__codecvt_do_encoding) (cv);
+
+ /* Take the easy way out for constant length encodings if we don't need to
+ convert. */
+ if (!do_convert && clen > 0)
+ {
+ fp->_wide_data->_IO_read_end += ((fp->_IO_read_ptr - fp->_IO_read_base)
+ / clen);
+ goto done;
+ }
+
+ enum __codecvt_result status;
+ const char *read_stop = (const char *) fp->_IO_read_base;
+ do
+ {
+
+ fp->_wide_data->_IO_last_state = fp->_wide_data->_IO_state;
+ status = (*cv->__codecvt_do_in) (cv, &fp->_wide_data->_IO_state,
+ fp->_IO_read_base, fp->_IO_read_ptr,
+ &read_stop,
+ fp->_wide_data->_IO_read_base,
+ fp->_wide_data->_IO_buf_end,
+ &fp->_wide_data->_IO_read_end);
+
+ /* Should we return EILSEQ? */
+ if (__builtin_expect (status == __codecvt_error, 0))
+ {
+ fp->_flags |= _IO_ERR_SEEN;
+ return -1;
+ }
+ }
+ while (__builtin_expect (status == __codecvt_partial, 0));
+
+done:
+ /* Now seek to the end of the read buffer. */
+ fp->_wide_data->_IO_read_ptr = fp->_wide_data->_IO_read_end;
+
+ return 0;
+}
+
_IO_off64_t
_IO_wfile_seekoff (fp, offset, dir, mode)
_IO_FILE *fp;
@@ -695,6 +744,10 @@ _IO_wfile_seekoff (fp, offset, dir, mode
fp->_wide_data->_IO_buf_base);
_IO_wsetp (fp, fp->_wide_data->_IO_buf_base,
fp->_wide_data->_IO_buf_base);
+
+ if (adjust_wide_data (fp, false))
+ goto dumb;
+
_IO_mask_flags (fp, 0, _IO_EOF_SEEN);
goto resync;
}
@@ -735,6 +788,10 @@ _IO_wfile_seekoff (fp, offset, dir, mode
_IO_wsetg (fp, fp->_wide_data->_IO_buf_base,
fp->_wide_data->_IO_buf_base, fp->_wide_data->_IO_buf_base);
_IO_wsetp (fp, fp->_wide_data->_IO_buf_base, fp->_wide_data->_IO_buf_base);
+
+ if (adjust_wide_data (fp, true))
+ goto dumb;
+
fp->_offset = result + count;
_IO_mask_flags (fp, 0, _IO_EOF_SEEN);
return offset;

View File

@@ -0,0 +1,403 @@
diff -Nrup a/stdio-common/bug22.c b/stdio-common/bug22.c
--- a/stdio-common/bug22.c 2010-05-04 05:27:23.000000000 -0600
+++ b/stdio-common/bug22.c 2012-08-03 13:56:40.887829210 -0600
@@ -1,12 +1,22 @@
/* BZ #5424 */
#include <stdio.h>
+#include <errno.h>
+/* INT_MAX + 1 */
#define N 2147483648
+/* (INT_MAX / 2) + 2 */
+#define N2 1073741825
+
+/* INT_MAX - 3 */
+#define N3 2147483644
+
#define STRINGIFY(S) #S
#define MAKE_STR(S) STRINGIFY(S)
#define SN MAKE_STR(N)
+#define SN2 MAKE_STR(N2)
+#define SN3 MAKE_STR(N3)
static int
do_test (void)
@@ -20,13 +30,27 @@ do_test (void)
return 1;
}
- ret = fprintf (fp, "%" SN "d%" SN "d", 1, 1);
+ ret = fprintf (fp, "%" SN "d", 1);
+ printf ("ret = %d\n", ret);
+ if (ret != -1 || errno != EOVERFLOW)
+ return 1;
+
+ ret = fprintf (fp, "%." SN "d", 1);
+ printf ("ret = %d\n", ret);
+ if (ret != -1 || errno != EOVERFLOW)
+ return 1;
+
+ ret = fprintf (fp, "%." SN3 "d", 1);
+ printf ("ret = %d\n", ret);
+ if (ret != -1 || errno != EOVERFLOW)
+ return 1;
+ ret = fprintf (fp, "%" SN2 "d%" SN2 "d", 1, 1);
printf ("ret = %d\n", ret);
- return ret != -1;
+ return ret != -1 || errno != EOVERFLOW;
}
-#define TIMEOUT 30
+#define TIMEOUT 60
#define TEST_FUNCTION do_test ()
#include "../test-skeleton.c"
diff -Nrup a/stdio-common/printf-parse.h b/stdio-common/printf-parse.h
--- a/stdio-common/printf-parse.h 2010-05-04 05:27:23.000000000 -0600
+++ b/stdio-common/printf-parse.h 2012-08-03 13:57:31.932638761 -0600
@@ -14,9 +14,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
#include <printf.h>
#include <stdint.h>
@@ -69,16 +68,27 @@ union printf_arg
#ifndef DONT_NEED_READ_INT
/* Read a simple integer from a string and update the string pointer.
It is assumed that the first character is a digit. */
-static unsigned int
+static int
read_int (const UCHAR_T * *pstr)
{
- unsigned int retval = **pstr - L_('0');
+ int retval = **pstr - L_('0');
while (ISDIGIT (*++(*pstr)))
- {
- retval *= 10;
- retval += **pstr - L_('0');
- }
+ if (retval >= 0)
+ {
+ if (INT_MAX / 10 < retval)
+ retval = -1;
+ else
+ {
+ int digit = **pstr - L_('0');
+
+ retval *= 10;
+ if (INT_MAX - digit < retval)
+ retval = -1;
+ else
+ retval += digit;
+ }
+ }
return retval;
}
diff -Nrup a/stdio-common/printf-parsemb.c b/stdio-common/printf-parsemb.c
--- a/stdio-common/printf-parsemb.c 2010-05-04 05:27:23.000000000 -0600
+++ b/stdio-common/printf-parsemb.c 2012-08-03 13:58:44.683366361 -0600
@@ -13,9 +13,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
#include <ctype.h>
#include <limits.h>
@@ -88,12 +87,15 @@ __parse_one_specmb (const UCHAR_T *forma
n = read_int (&format);
- if (n > 0 && *format == L_('$'))
+ if (n != 0 && *format == L_('$'))
/* Is positional parameter. */
{
++format; /* Skip the '$'. */
- spec->data_arg = n - 1;
- *max_ref_arg = MAX (*max_ref_arg, n);
+ if (n != -1)
+ {
+ spec->data_arg = n - 1;
+ *max_ref_arg = MAX (*max_ref_arg, n);
+ }
}
else
/* Oops; that was actually the width and/or 0 padding flag.
@@ -161,10 +163,13 @@ __parse_one_specmb (const UCHAR_T *forma
/* The width argument might be found in a positional parameter. */
n = read_int (&format);
- if (n > 0 && *format == L_('$'))
+ if (n != 0 && *format == L_('$'))
{
- spec->width_arg = n - 1;
- *max_ref_arg = MAX (*max_ref_arg, n);
+ if (n != -1)
+ {
+ spec->width_arg = n - 1;
+ *max_ref_arg = MAX (*max_ref_arg, n);
+ }
++format; /* Skip '$'. */
}
}
@@ -178,9 +183,13 @@ __parse_one_specmb (const UCHAR_T *forma
}
}
else if (ISDIGIT (*format))
- /* Constant width specification. */
- spec->info.width = read_int (&format);
+ {
+ int n = read_int (&format);
+ /* Constant width specification. */
+ if (n != -1)
+ spec->info.width = n;
+ }
/* Get the precision. */
spec->prec_arg = -1;
/* -1 means none given; 0 means explicit 0. */
@@ -197,10 +206,13 @@ __parse_one_specmb (const UCHAR_T *forma
{
n = read_int (&format);
- if (n > 0 && *format == L_('$'))
+ if (n != 0 && *format == L_('$'))
{
- spec->prec_arg = n - 1;
- *max_ref_arg = MAX (*max_ref_arg, n);
+ if (n != -1)
+ {
+ spec->prec_arg = n - 1;
+ *max_ref_arg = MAX (*max_ref_arg, n);
+ }
++format;
}
}
@@ -214,7 +226,12 @@ __parse_one_specmb (const UCHAR_T *forma
}
}
else if (ISDIGIT (*format))
- spec->info.prec = read_int (&format);
+ {
+ int n = read_int (&format);
+
+ if (n != -1)
+ spec->info.prec = n;
+ }
else
/* "%.?" is treated like "%.0?". */
spec->info.prec = 0;
@@ -295,9 +312,9 @@ __parse_one_specmb (const UCHAR_T *forma
/* We don't try to get the types for all arguments if the format
uses more than one. The normal case is covered though. If
the call returns -1 we continue with the normal specifiers. */
- || (spec->ndata_args = (*__printf_arginfo_table[spec->info.spec])
- (&spec->info, 1, &spec->data_arg_type,
- &spec->size)) < 0)
+ || (int) (spec->ndata_args = (*__printf_arginfo_table[spec->info.spec])
+ (&spec->info, 1, &spec->data_arg_type,
+ &spec->size)) < 0)
{
/* Find the data argument types of a built-in spec. */
spec->ndata_args = 1;
diff -Nrup a/stdio-common/vfprintf.c b/stdio-common/vfprintf.c
--- a/stdio-common/vfprintf.c 2012-08-03 13:31:26.605168350 -0600
+++ b/stdio-common/vfprintf.c 2012-08-03 14:09:26.836725512 -0600
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-2008, 2009 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -12,9 +12,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
#include <ctype.h>
#include <limits.h>
@@ -67,10 +66,10 @@
do { \
unsigned int _val = val; \
assert ((unsigned int) done < (unsigned int) INT_MAX); \
- if (__builtin_expect ((unsigned int) INT_MAX - (unsigned int) done \
- < _val, 0)) \
+ if (__builtin_expect (INT_MAX - done < _val, 0)) \
{ \
done = -1; \
+ __set_errno (EOVERFLOW); \
goto all_done; \
} \
done += _val; \
@@ -141,12 +140,17 @@
do \
{ \
assert ((size_t) done <= (size_t) INT_MAX); \
- if ((size_t) PUT (s, (String), (Len)) != (size_t) (Len) \
- || (size_t) INT_MAX - (size_t) done < (size_t) (Len)) \
+ if ((size_t) PUT (s, (String), (Len)) != (size_t) (Len)) \
{ \
done = -1; \
goto all_done; \
} \
+ if (__builtin_expect (INT_MAX - done < (Len), 0)) \
+ { \
+ done = -1; \
+ __set_errno (EOVERFLOW); \
+ goto all_done; \
+ } \
done += (Len); \
} \
while (0)
@@ -1435,10 +1439,21 @@ vfprintf (FILE *s, const CHAR_T *format,
const UCHAR_T *tmp; /* Temporary value. */
tmp = ++f;
- if (ISDIGIT (*tmp) && read_int (&tmp) && *tmp == L_('$'))
- /* The width comes from a positional parameter. */
- goto do_positional;
+ if (ISDIGIT (*tmp))
+ {
+ int pos = read_int (&tmp);
+ if (pos == -1)
+ {
+ __set_errno (EOVERFLOW);
+ done = -1;
+ goto all_done;
+ }
+
+ if (pos && *tmp == L_('$'))
+ /* The width comes from a positional parameter. */
+ goto do_positional;
+ }
width = va_arg (ap, int);
/* Negative width means left justified. */
@@ -1449,9 +1464,9 @@ vfprintf (FILE *s, const CHAR_T *format,
left = 1;
}
- if (__builtin_expect (width >= (size_t) -1 / sizeof (CHAR_T) - 32, 0))
+ if (__builtin_expect (width >= INT_MAX / sizeof (CHAR_T) - 32, 0))
{
- __set_errno (ERANGE);
+ __set_errno (EOVERFLOW);
done = -1;
goto all_done;
}
@@ -1481,9 +1496,10 @@ vfprintf (FILE *s, const CHAR_T *format,
LABEL (width):
width = read_int (&f);
- if (__builtin_expect (width >= (size_t) -1 / sizeof (CHAR_T) - 32, 0))
+ if (__builtin_expect (width == -1
+ || width >= INT_MAX / sizeof (CHAR_T) - 32, 0))
{
- __set_errno (ERANGE);
+ __set_errno (EOVERFLOW);
done = -1;
goto all_done;
}
@@ -1518,10 +1534,21 @@ vfprintf (FILE *s, const CHAR_T *format,
const UCHAR_T *tmp; /* Temporary value. */
tmp = ++f;
- if (ISDIGIT (*tmp) && read_int (&tmp) > 0 && *tmp == L_('$'))
- /* The precision comes from a positional parameter. */
- goto do_positional;
+ if (ISDIGIT (*tmp))
+ {
+ int pos = read_int (&tmp);
+
+ if (pos == -1)
+ {
+ __set_errno (EOVERFLOW);
+ done = -1;
+ goto all_done;
+ }
+ if (pos && *tmp == L_('$'))
+ /* The precision comes from a positional parameter. */
+ goto do_positional;
+ }
prec = va_arg (ap, int);
/* If the precision is negative the precision is omitted. */
@@ -1529,15 +1556,26 @@ vfprintf (FILE *s, const CHAR_T *format,
prec = -1;
}
else if (ISDIGIT (*f))
- prec = read_int (&f);
+ {
+ prec = read_int (&f);
+
+ /* The precision was specified in this case as an extremely
+ large positive value. */
+ if (prec == -1)
+ {
+ __set_errno (EOVERFLOW);
+ done = -1;
+ goto all_done;
+ }
+ }
else
prec = 0;
if (prec > width
&& prec > sizeof (work_buffer) / sizeof (work_buffer[0]) - 32)
{
- if (__builtin_expect (prec >= (size_t) -1 / sizeof (CHAR_T) - 32, 0))
+ if (__builtin_expect (prec >= INT_MAX / sizeof (CHAR_T) - 32, 0))
{
- __set_errno (ERANGE);
+ __set_errno (EOVERFLOW);
done = -1;
goto all_done;
}
@@ -1722,13 +1760,13 @@ do_positional:
nargs = MAX (nargs, max_ref_arg);
/* Calculate total size needed to represent a single argument across
all three argument-related arrays. */
- bytes_per_arg = sizeof (*args_value) + sizeof (*args_size)
- + sizeof (*args_type);
+ bytes_per_arg = (sizeof (*args_value) + sizeof (*args_size)
+ + sizeof (*args_type));
/* Check for potential integer overflow. */
- if (__builtin_expect (nargs > SIZE_MAX / bytes_per_arg, 0))
+ if (__builtin_expect (nargs > INT_MAX / bytes_per_arg, 0))
{
- __set_errno (ERANGE);
+ __set_errno (EOVERFLOW);
done = -1;
goto all_done;
}
@@ -1746,6 +1784,8 @@ do_positional:
}
}
+ /* Set up the remaining two arrays to each point past the end of the
+ prior array, since space for all three has been allocated now. */
args_size = &args_value[nargs].pa_int;
args_type = &args_size[nargs];
memset (args_type, s->_flags2 & _IO_FLAGS2_FORTIFY ? '\xff' : '\0',

View File

@@ -0,0 +1,19 @@
diff -Nrup a/locale/loadlocale.c b/locale/loadlocale.c
--- a/locale/loadlocale.c 2010-05-04 07:27:23.000000000 -0400
+++ b/locale/loadlocale.c 2012-08-05 17:19:47.761384155 -0400
@@ -170,7 +170,6 @@ _nl_load_locale (struct loaded_l10nfile
int save_err;
int alloc = ld_mapped;
- file->decided = 1;
file->data = NULL;
fd = open_not_cancel_2 (file->filename, O_RDONLY);
@@ -279,6 +278,7 @@ _nl_load_locale (struct loaded_l10nfile
newdata->alloc = alloc;
file->data = newdata;
+ file->decided = 1;
}
void

View File

@@ -0,0 +1,22 @@
diff --git a/sysdeps/gnu/errlist.c b/sysdeps/gnu/errlist.c
index e3d2faf..5437ff8 100644
--- a/sysdeps/gnu/errlist.c
+++ b/sysdeps/gnu/errlist.c
@@ -780,11 +780,12 @@ TRANS The user's disk quota was exceeded. */
#endif
#ifdef ESTALE
/*
-TRANS Stale NFS file handle. This indicates an internal confusion in the NFS
-TRANS system which is due to file system rearrangements on the server host.
-TRANS Repairing this condition usually requires unmounting and remounting
-TRANS the NFS file system on the local host. */
- [ERR_REMAP (ESTALE)] = N_("Stale NFS file handle"),
+TRANS Stale file handle. This indicates an internal confusion in the
+TRANS file system which is due to file system rearrangements on the server host
+TRANS for NFS filesystems or corruption in other filesystems.
+TRANS Repairing this condition usually requires unmounting, possibly
+TRANS repairing and remounting the file system. */
+ [ERR_REMAP (ESTALE)] = N_("Stale file handle"),
# if ESTALE > ERR_MAX
# undef ERR_MAX
# define ERR_MAX ESTALE

View File

@@ -1,30 +0,0 @@
diff -rup a/resolv/res_send.c b/resolv/res_send.c
--- a/resolv/res_send.c 2012-06-28 11:55:38.361886650 -0600
+++ b/resolv/res_send.c 2012-06-28 11:51:38.253963687 -0600
@@ -424,17 +424,15 @@ __libc_res_nsend(res_state statp, const
}
n = statp->nscount;
ext_total_nscount = EXT(statp).nscount + EXT(statp).nscount6;
- if (statp->nscount > ext_total_nscount)
- for (n = ext_total_nscount, ns = 0;
- n < statp->nscount; n++) {
- while (ns < MAXNS
- && EXT(statp).nsmap[ns] != MAXNS)
- ns++;
- if (ns == MAXNS)
- break;
- EXT(statp).nsmap[ns] = n;
- map[n] = ns++;
- }
+ for (n = 0, ns = 0; n < statp->nscount - ext_total_nscount; n++) {
+ while (ns < MAXNS
+ && EXT(statp).nsmap[ns] != MAXNS)
+ ns++;
+ if (ns == MAXNS)
+ break;
+ EXT(statp).nsmap[ns] = n;
+ map[n] = ns++;
+ }
EXT(statp).nscount = n;
for (ns = 0; ns < EXT(statp).nscount; ns++) {
n = map[ns];

View File

@@ -0,0 +1,54 @@
diff -rup a/nss/nsswitch.h b/nss/nsswitch.h
--- a/nss/nsswitch.h 2010-05-04 05:27:23.000000000 -0600
+++ b/nss/nsswitch.h 2012-07-05 11:28:15.316585117 -0600
@@ -182,4 +182,8 @@ extern int __nss_hostname_digits_dots (c
int *h_errnop);
libc_hidden_proto (__nss_hostname_digits_dots)
+/* Maximum number of aliases we allow. */
+#define MAX_NR_ALIASES 48
+#define MAX_NR_ADDRS 48
+
#endif /* nsswitch.h */
Only in b/nss: nsswitch.h.orig
diff -rup a/resolv/nss_dns/dns-host.c b/resolv/nss_dns/dns-host.c
--- a/resolv/nss_dns/dns-host.c 2012-07-05 11:27:39.298760961 -0600
+++ b/resolv/nss_dns/dns-host.c 2012-07-05 11:28:15.317585112 -0600
@@ -89,10 +89,6 @@
#define RESOLVSORT
-/* Maximum number of aliases we allow. */
-#define MAX_NR_ALIASES 48
-#define MAX_NR_ADDRS 48
-
#if PACKETSZ > 65536
# define MAXPACKET PACKETSZ
#else
Only in b/resolv/nss_dns: dns-host.c.orig
diff -rup a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c
--- a/sysdeps/posix/getaddrinfo.c 2012-07-05 11:27:39.284761028 -0600
+++ b/sysdeps/posix/getaddrinfo.c 2012-07-05 14:15:39.785546125 -0600
@@ -565,7 +565,10 @@ gaih_inet (const char *name, const struc
IPv6 scope ids. */
if (req->ai_family == AF_INET)
{
- size_t tmpbuflen = 512;
+ /* Add room for struct host_data in resolv/nss_dns/dns-host.c */
+ size_t tmpbuflen = 512 + (MAX_NR_ALIASES+MAX_NR_ADDRS+1)*sizeof(char*)
+ + 16 * sizeof(char);
+
assert (tmpbuf == NULL);
tmpbuf = alloca_account (tmpbuflen, alloca_used);
int rc;
@@ -807,7 +810,7 @@ gaih_inet (const char *name, const struc
old_res_options = _res.options;
_res.options &= ~RES_USE_INET6;
- size_t tmpbuflen = 1024;
+ size_t tmpbuflen = 1024 + sizeof(struct gaih_addrtuple);
malloc_tmpbuf = !__libc_use_alloca (alloca_used + tmpbuflen);
assert (tmpbuf == NULL);
if (!malloc_tmpbuf)
Only in b/sysdeps/posix: getaddrinfo.c.orig
Only in b/sysdeps/posix: getaddrinfo.c.rej

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,42 @@
diff -rup a/resolv/res_init.c b/resolv/res_init.c
--- a/resolv/res_init.c 2012-07-26 15:10:45.655638776 -0600
+++ b/resolv/res_init.c 2012-07-26 15:11:27.731423002 -0600
@@ -314,9 +314,9 @@ __res_vinit(res_state statp, int preinit
cp++;
if ((*cp != '\0') && (*cp != '\n')
&& __inet_aton(cp, &a)) {
- statp->nsaddr_list[nservall].sin_addr = a;
- statp->nsaddr_list[nservall].sin_family = AF_INET;
- statp->nsaddr_list[nservall].sin_port =
+ statp->nsaddr_list[nserv].sin_addr = a;
+ statp->nsaddr_list[nserv].sin_family = AF_INET;
+ statp->nsaddr_list[nserv].sin_port =
htons(NAMESERVER_PORT);
nserv++;
#ifdef _LIBC
diff -rup a/resolv/res_send.c b/resolv/res_send.c
--- a/resolv/res_send.c 2010-05-04 05:27:23.000000000 -0600
+++ b/resolv/res_send.c 2012-07-26 15:34:58.398261659 -0600
@@ -421,10 +421,10 @@ __libc_res_nsend(res_state statp, const
EXT(statp).nsmap[n] = MAXNS;
}
}
- n = statp->nscount;
- if (statp->nscount > EXT(statp).nscount)
+ n = statp->nscount - EXT(statp).nscount6;
+ if (n > EXT(statp).nscount)
for (n = EXT(statp).nscount, ns = 0;
- n < statp->nscount; n++) {
+ n < statp->nscount - EXT(statp).nscount6; n++) {
while (ns < MAXNS
&& EXT(statp).nsmap[ns] != MAXNS)
ns++;
@@ -441,7 +441,7 @@ __libc_res_nsend(res_state statp, const
malloc(sizeof (struct sockaddr_in6));
if (EXT(statp).nsaddrs[n] != NULL) {
memset (mempcpy(EXT(statp).nsaddrs[n],
- &statp->nsaddr_list[n],
+ &statp->nsaddr_list[ns],
sizeof (struct sockaddr_in)),
'\0',
sizeof (struct sockaddr_in6)

View File

@@ -0,0 +1,31 @@
diff -Brup a/stdlib/msort.c b/stdlib/msort.c
--- a/stdlib/msort.c 2010-05-04 07:27:23.000000000 -0400
+++ b/stdlib/msort.c 2012-08-07 13:30:14.131765346 -0400
@@ -25,6 +25,8 @@
#include <unistd.h>
#include <memcopy.h>
#include <errno.h>
+#include <atomic.h>
+
struct msort_param
{
@@ -182,7 +184,7 @@ qsort_r (void *b, size_t n, size_t s, __
static long int phys_pages;
static int pagesize;
- if (phys_pages == 0)
+ if (pagesize == 0)
{
phys_pages = __sysconf (_SC_PHYS_PAGES);
@@ -197,6 +199,9 @@ qsort_r (void *b, size_t n, size_t s, __
a quarter of the physical memory. */
phys_pages /= 4;
+ /* Make sure phys_pages is written to memory. */
+ atomic_write_barrier ();
+
pagesize = __sysconf (_SC_PAGESIZE);
}

View File

@@ -0,0 +1,48 @@
This is a workaround for broken code which issues memcpy requests with
overlapping arguments. With this patch installed, if the file
/etc/sysconfig/32bit_ssse3_memcpy_via_32bit_ssse3_memmove exists then a
32bit memcpy call which normally would be handled by the SSSE3 memcpy
implementation would instead be handled by the 32bit SSSE3 memmove
implementation which is more tolerant of overlaps.
diff -Nrup a/sysdeps/i386/i686/multiarch/memcpy.S b/sysdeps/i386/i686/multiarch/memcpy.S
--- a/sysdeps/i386/i686/multiarch/memcpy.S 2010-05-04 05:27:23.000000000 -0600
+++ b/sysdeps/i386/i686/multiarch/memcpy.S 2012-11-20 14:19:52.890780415 -0700
@@ -21,6 +21,10 @@
#include <sysdep.h>
#include <init-arch.h>
+ .section .rodata
+L(magicfile):
+ .ascii "/etc/sysconfig/32bit_ssse3_memcpy_via_32bit_ssse3_memmove"
+
/* Define multiple versions only for the definition in lib and for
DSO. In static binaries we need memcpy before the initialization
happened. */
@@ -48,6 +52,26 @@ ENTRY(memcpy)
1: leal __memcpy_ia32@GOTOFF(%ebx), %eax
testl $bit_SSSE3, CPUID_OFFSET+index_SSSE3+__cpu_features@GOTOFF(%ebx)
jz 2f
+
+ /* This is an inlined access (magicfile, 0) syscall.
+
+ Note that it clobbers %ebx, so we have to save/restore
+ it around the syscall. */
+ mov %ebx, %edx
+ leal L(magicfile)@GOTOFF(%ebx), %ebx
+ xor %ecx, %ecx
+ movl $33, %eax
+ int $0x80
+ mov %edx, %ebx
+
+ /* If the file did not exist, then %eax will be -1..-4095 and we
+ do nothing special. */
+ cmpl $-4095, %eax
+ jae 4f
+
+ leal __memmove_ssse3@GOTOFF(%ebx), %eax
+ jmp 2f
+4:
leal __memcpy_ssse3@GOTOFF(%ebx), %eax
testl $bit_Fast_Rep_String, FEATURE_OFFSET+index_Fast_Rep_String+__cpu_features@GOTOFF(%ebx)
jz 2f

View File

@@ -0,0 +1,364 @@
diff -Nrup a/stdlib/Makefile b/stdlib/Makefile
--- a/stdlib/Makefile 2010-05-04 05:27:23.000000000 -0600
+++ b/stdlib/Makefile 2012-08-15 09:25:37.812443006 -0600
@@ -71,7 +71,7 @@ tests := tst-strtol tst-strtod testmb t
tst-atof1 tst-atof2 tst-strtod2 tst-strtod3 tst-rand48-2 \
tst-makecontext tst-strtod4 tst-strtod5 tst-qsort2 \
tst-makecontext2 tst-strtod6 tst-unsetenv1 \
- tst-makecontext3
+ tst-makecontext3 tst-strtod-overflow
include ../Makeconfig
diff -Nrup a/stdlib/strtod_l.c b/stdlib/strtod_l.c
--- a/stdlib/strtod_l.c 2010-05-04 05:27:23.000000000 -0600
+++ b/stdlib/strtod_l.c 2012-08-15 09:34:29.550281346 -0600
@@ -62,6 +62,7 @@ extern unsigned long long int ____strtou
#include <math.h>
#include <stdlib.h>
#include <string.h>
+#include <stdint.h>
/* The gmp headers need some configuration frobs. */
#define HAVE_ALLOCA 1
@@ -176,19 +177,19 @@ extern const mp_limb_t _tens_in_limb[MAX
/* Return a floating point number of the needed type according to the given
multi-precision number after possible rounding. */
static FLOAT
-round_and_return (mp_limb_t *retval, int exponent, int negative,
+round_and_return (mp_limb_t *retval, intmax_t exponent, int negative,
mp_limb_t round_limb, mp_size_t round_bit, int more_bits)
{
if (exponent < MIN_EXP - 1)
{
- mp_size_t shift = MIN_EXP - 1 - exponent;
-
- if (shift > MANT_DIG)
+ if (exponent < MIN_EXP - 1 - MANT_DIG)
{
__set_errno (EDOM);
return 0.0;
}
+ mp_size_t shift = MIN_EXP - 1 - exponent;
+
more_bits |= (round_limb & ((((mp_limb_t) 1) << round_bit) - 1)) != 0;
if (shift == MANT_DIG)
/* This is a special case to handle the very seldom case where
@@ -235,6 +236,9 @@ round_and_return (mp_limb_t *retval, int
__set_errno (ERANGE);
}
+ if (exponent > MAX_EXP)
+ goto overflow;
+
if ((round_limb & (((mp_limb_t) 1) << round_bit)) != 0
&& (more_bits || (retval[0] & 1) != 0
|| (round_limb & ((((mp_limb_t) 1) << round_bit) - 1)) != 0))
@@ -260,6 +264,7 @@ round_and_return (mp_limb_t *retval, int
}
if (exponent > MAX_EXP)
+ overflow:
return negative ? -FLOAT_HUGE_VAL : FLOAT_HUGE_VAL;
return MPN2FLOAT (retval, exponent, negative);
@@ -273,7 +278,7 @@ round_and_return (mp_limb_t *retval, int
factor for the resulting number (see code) multiply by it. */
static const STRING_TYPE *
str_to_mpn (const STRING_TYPE *str, int digcnt, mp_limb_t *n, mp_size_t *nsize,
- int *exponent
+ intmax_t *exponent
#ifndef USE_WIDE_CHAR
, const char *decimal, size_t decimal_len, const char *thousands
#endif
@@ -337,7 +342,7 @@ str_to_mpn (const STRING_TYPE *str, int
}
while (--digcnt > 0);
- if (*exponent > 0 && cnt + *exponent <= MAX_DIG_PER_LIMB)
+ if (*exponent > 0 && *exponent <= MAX_DIG_PER_LIMB - cnt)
{
low *= _tens_in_limb[*exponent];
start = _tens_in_limb[cnt + *exponent];
@@ -415,7 +420,7 @@ ____STRTOF_INTERNAL (nptr, endptr, group
{
int negative; /* The sign of the number. */
MPN_VAR (num); /* MP representation of the number. */
- int exponent; /* Exponent of the number. */
+ intmax_t exponent; /* Exponent of the number. */
/* Numbers starting `0X' or `0x' have to be processed with base 16. */
int base = 10;
@@ -437,7 +442,7 @@ ____STRTOF_INTERNAL (nptr, endptr, group
/* Points at the character following the integer and fractional digits. */
const STRING_TYPE *expp;
/* Total number of digit and number of digits in integer part. */
- int dig_no, int_no, lead_zero;
+ size_t dig_no, int_no, lead_zero;
/* Contains the last character read. */
CHAR_TYPE c;
@@ -769,7 +774,7 @@ ____STRTOF_INTERNAL (nptr, endptr, group
are all or any is really a fractional digit will be decided
later. */
int_no = dig_no;
- lead_zero = int_no == 0 ? -1 : 0;
+ lead_zero = int_no == 0 ? (size_t) -1 : 0;
/* Read the fractional digits. A special case are the 'american
style' numbers like `16.' i.e. with decimal point but without
@@ -791,12 +796,13 @@ ____STRTOF_INTERNAL (nptr, endptr, group
(base == 16 && ({ CHAR_TYPE lo = TOLOWER (c);
lo >= L_('a') && lo <= L_('f'); })))
{
- if (c != L_('0') && lead_zero == -1)
+ if (c != L_('0') && lead_zero == (size_t) -1)
lead_zero = dig_no - int_no;
++dig_no;
c = *++cp;
}
}
+ assert (dig_no <= (uintmax_t) INTMAX_MAX);
/* Remember start of exponent (if any). */
expp = cp;
@@ -819,24 +825,80 @@ ____STRTOF_INTERNAL (nptr, endptr, group
if (c >= L_('0') && c <= L_('9'))
{
- int exp_limit;
+ intmax_t exp_limit;
/* Get the exponent limit. */
if (base == 16)
- exp_limit = (exp_negative ?
- -MIN_EXP + MANT_DIG + 4 * int_no :
- MAX_EXP - 4 * int_no + 4 * lead_zero + 3);
+ {
+ if (exp_negative)
+ {
+ assert (int_no <= (uintmax_t) (INTMAX_MAX
+ + MIN_EXP - MANT_DIG) / 4);
+ exp_limit = -MIN_EXP + MANT_DIG + 4 * (intmax_t) int_no;
+ }
+ else
+ {
+ if (int_no)
+ {
+ assert (lead_zero == 0
+ && int_no <= (uintmax_t) INTMAX_MAX / 4);
+ exp_limit = MAX_EXP - 4 * (intmax_t) int_no + 3;
+ }
+ else if (lead_zero == (size_t) -1)
+ {
+ /* The number is zero and this limit is
+ arbitrary. */
+ exp_limit = MAX_EXP + 3;
+ }
+ else
+ {
+ assert (lead_zero
+ <= (uintmax_t) (INTMAX_MAX - MAX_EXP - 3) / 4);
+ exp_limit = (MAX_EXP
+ + 4 * (intmax_t) lead_zero
+ + 3);
+ }
+ }
+ }
else
- exp_limit = (exp_negative ?
- -MIN_10_EXP + MANT_DIG + int_no :
- MAX_10_EXP - int_no + lead_zero + 1);
+ {
+ if (exp_negative)
+ {
+ assert (int_no
+ <= (uintmax_t) (INTMAX_MAX + MIN_10_EXP - MANT_DIG));
+ exp_limit = -MIN_10_EXP + MANT_DIG + (intmax_t) int_no;
+ }
+ else
+ {
+ if (int_no)
+ {
+ assert (lead_zero == 0
+ && int_no <= (uintmax_t) INTMAX_MAX);
+ exp_limit = MAX_10_EXP - (intmax_t) int_no + 1;
+ }
+ else if (lead_zero == (size_t) -1)
+ {
+ /* The number is zero and this limit is
+ arbitrary. */
+ exp_limit = MAX_10_EXP + 1;
+ }
+ else
+ {
+ assert (lead_zero
+ <= (uintmax_t) (INTMAX_MAX - MAX_10_EXP - 1));
+ exp_limit = MAX_10_EXP + (intmax_t) lead_zero + 1;
+ }
+ }
+ }
+
+ if (exp_limit < 0)
+ exp_limit = 0;
do
{
- exponent *= 10;
- exponent += c - L_('0');
-
- if (__builtin_expect (exponent > exp_limit, 0))
+ if (__builtin_expect ((exponent > exp_limit / 10
+ || (exponent == exp_limit / 10
+ && c - L_('0') > exp_limit % 10)), 0))
/* The exponent is too large/small to represent a valid
number. */
{
@@ -845,7 +907,7 @@ ____STRTOF_INTERNAL (nptr, endptr, group
/* We have to take care for special situation: a joker
might have written "0.0e100000" which is in fact
zero. */
- if (lead_zero == -1)
+ if (lead_zero == (size_t) -1)
result = negative ? -0.0 : 0.0;
else
{
@@ -864,6 +926,9 @@ ____STRTOF_INTERNAL (nptr, endptr, group
/* NOTREACHED */
}
+ exponent *= 10;
+ exponent += c - L_('0');
+
c = *++cp;
}
while (c >= L_('0') && c <= L_('9'));
@@ -932,7 +997,14 @@ ____STRTOF_INTERNAL (nptr, endptr, group
}
#endif
startp += lead_zero + decimal_len;
- exponent -= base == 16 ? 4 * lead_zero : lead_zero;
+ assert (lead_zero <= (base == 16
+ ? (uintmax_t) INTMAX_MAX / 4
+ : (uintmax_t) INTMAX_MAX));
+ assert (lead_zero <= (base == 16
+ ? ((uintmax_t) exponent
+ - (uintmax_t) INTMAX_MIN) / 4
+ : ((uintmax_t) exponent - (uintmax_t) INTMAX_MIN)));
+ exponent -= base == 16 ? 4 * (intmax_t) lead_zero : (intmax_t) lead_zero;
dig_no -= lead_zero;
}
@@ -974,7 +1046,10 @@ ____STRTOF_INTERNAL (nptr, endptr, group
}
/* Adjust the exponent for the bits we are shifting in. */
- exponent += bits - 1 + (int_no - 1) * 4;
+ assert (int_no <= (uintmax_t) (exponent < 0
+ ? (INTMAX_MAX - bits + 1) / 4
+ : (INTMAX_MAX - exponent - bits + 1) / 4));
+ exponent += bits - 1 + ((intmax_t) int_no - 1) * 4;
while (--dig_no > 0 && idx >= 0)
{
@@ -1014,13 +1089,15 @@ ____STRTOF_INTERNAL (nptr, endptr, group
really integer digits or belong to the fractional part; i.e. we normalize
123e-2 to 1.23. */
{
- register int incr = (exponent < 0 ? MAX (-int_no, exponent)
- : MIN (dig_no - int_no, exponent));
+ register intmax_t incr = (exponent < 0
+ ? MAX (-(intmax_t) int_no, exponent)
+ : MIN ((intmax_t) dig_no - (intmax_t) int_no,
+ exponent));
int_no += incr;
exponent -= incr;
}
- if (__builtin_expect (int_no + exponent > MAX_10_EXP + 1, 0))
+ if (__builtin_expect (exponent > MAX_10_EXP + 1 - (intmax_t) int_no, 0))
{
__set_errno (ERANGE);
return negative ? -FLOAT_HUGE_VAL : FLOAT_HUGE_VAL;
@@ -1205,7 +1282,7 @@ ____STRTOF_INTERNAL (nptr, endptr, group
digits we should have enough bits for the result. The remaining
decimal digits give us the information that more bits are following.
This can be used while rounding. (Two added as a safety margin.) */
- if (dig_no - int_no > (MANT_DIG - bits + 2) / 3 + 2)
+ if ((intmax_t) dig_no > (intmax_t) int_no + (MANT_DIG - bits + 2) / 3 + 2)
{
dig_no = int_no + (MANT_DIG - bits + 2) / 3 + 2;
more_bits = 1;
@@ -1213,7 +1290,7 @@ ____STRTOF_INTERNAL (nptr, endptr, group
else
more_bits = 0;
- neg_exp = dig_no - int_no - exponent;
+ neg_exp = (intmax_t) dig_no - (intmax_t) int_no - exponent;
/* Construct the denominator. */
densize = 0;
@@ -1491,7 +1568,9 @@ ____STRTOF_INTERNAL (nptr, endptr, group
register int i;
(void) __mpn_lshift (&retval[used
/ BITS_PER_MP_LIMB],
- retval, RETURN_LIMB_SIZE,
+ retval,
+ (RETURN_LIMB_SIZE
+ - used / BITS_PER_MP_LIMB),
used % BITS_PER_MP_LIMB);
for (i = used / BITS_PER_MP_LIMB - 1; i >= 0; --i)
retval[i] = 0;
diff -Nrup a/stdlib/tst-strtod-overflow.c b/stdlib/tst-strtod-overflow.c
--- a/stdlib/tst-strtod-overflow.c 1969-12-31 17:00:00.000000000 -0700
+++ b/stdlib/tst-strtod-overflow.c 2012-08-15 09:25:01.098592764 -0600
@@ -0,0 +1,48 @@
+/* Test for integer/buffer overflow in strtod.
+ Copyright (C) 2012 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#define EXPONENT "e-2147483649"
+#define SIZE 214748364
+
+static int
+do_test (void)
+{
+ char *p = malloc (1 + SIZE + sizeof (EXPONENT));
+ if (p == NULL)
+ {
+ puts ("malloc failed, cannot test for overflow");
+ return 0;
+ }
+ p[0] = '1';
+ memset (p + 1, '0', SIZE);
+ memcpy (p + 1 + SIZE, EXPONENT, sizeof (EXPONENT));
+ double d = strtod (p, NULL);
+ if (d != 0)
+ {
+ printf ("strtod returned wrong value: %a\n", d);
+ return 1;
+ }
+ return 0;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"

View File

@@ -0,0 +1,88 @@
commit 4f031072a5055abd83717820b59efdaa463d5853
Author: Ulrich Drepper <drepper@gmail.com>
Date: Sat May 28 16:59:30 2011 -0400
Handle failure of _nl_explode_name in all cases
2011-05-28 Ulrich Drepper <drepper@gmail.com>
* locale/findlocale.c (_nl_find_locale): Return right away if
_nl_explode_name failed.
* locale/programs/locarchive.c (add_locale_to_archive): Likewise.
diff --git a/locale/findlocale.c b/locale/findlocale.c
index 6b88c96..2fec9a7 100644
--- a/locale/findlocale.c
+++ b/locale/findlocale.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-2001, 2002, 2003, 2006, 2010 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2003, 2006, 2010, 2011 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
@@ -140,6 +140,9 @@ _nl_find_locale (const char *locale_path, size_t locale_path_len,
*/
mask = _nl_explode_name (loc_name, &language, &modifier, &territory,
&codeset, &normalized_codeset);
+ if (mask == -1)
+ /* Memory allocate problem. */
+ return NULL;
/* If exactly this locale was already asked for we have an entry with
the complete name. */
diff --git a/locale/programs/locarchive.c b/locale/programs/locarchive.c
index 85ba77d..e95bcf1 100644
--- a/locale/programs/locarchive.c
+++ b/locale/programs/locarchive.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003, 2005, 2007, 2009 Free Software Foundation, Inc.
+/* Copyright (C) 2002,2003,2005,2007,2009,2011 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
@@ -1079,6 +1079,8 @@ add_locale_to_archive (ah, name, data, replace)
int mask = _nl_explode_name (strdupa (name),
&language, &modifier, &territory,
&codeset, &normalized_codeset);
+ if (mask == -1)
+ return -1;
if (mask & XPG_NORM_CODESET)
/* This name contains a codeset in unnormalized form.
@@ -1128,6 +1130,7 @@ add_locale_to_archive (ah, name, data, replace)
/* Now read the locale.alias files looking for lines whose
right hand side matches our name after normalization. */
+ int result = 0;
if (alias_file != NULL)
{
FILE *fp;
@@ -1207,6 +1210,11 @@ add_locale_to_archive (ah, name, data, replace)
&rhs_territory,
&rhs_codeset,
&rhs_normalized_codeset);
+ if (rhs_mask == 1)
+ {
+ result = -1;
+ goto out;
+ }
if (!strcmp (language, rhs_language)
&& ((rhs_mask & XPG_CODESET)
/* He has a codeset, it must match normalized. */
@@ -1240,6 +1248,7 @@ add_locale_to_archive (ah, name, data, replace)
}
}
+ out:
fclose (fp);
}
@@ -1248,7 +1257,7 @@ add_locale_to_archive (ah, name, data, replace)
if (mask & XPG_NORM_CODESET)
free ((char *) normalized_codeset);
- return 0;
+ return result;
}

View File

@@ -0,0 +1,195 @@
diff -Nrup a/intl/Makefile b/intl/Makefile
--- a/intl/Makefile 2010-05-04 05:27:23.000000000 -0600
+++ b/intl/Makefile 2012-08-17 14:40:00.457226629 -0600
@@ -74,6 +74,16 @@ ifneq (no,$(PERL))
tests: $(objpfx)mtrace-tst-gettext
endif
endif
+
+# Multiple tests use this data. Create it once to avoid racing and
+# spurious test failures.
+codeset_mo = $(objpfx)domaindir/de_DE/LC_MESSAGES/codeset.mo
+
+$(codeset_mo):
+ $(make-target-directory)
+ msgfmt -o $@T tstcodeset.po
+ mv -f $@T $@
+
$(objpfx)mtrace-tst-gettext: $(objpfx)tst-gettext.out
$(common-objpfx)malloc/mtrace $(objpfx)tst-gettext.mtrace > $@
$(objpfx)tst-gettext.out: tst-gettext.sh $(objpfx)tst-gettext
@@ -83,16 +93,14 @@ $(objpfx)tst-translit.out: tst-translit.
$(SHELL) -e $< $(common-objpfx) $(common-objpfx)intl/
$(objpfx)tst-gettext2.out: tst-gettext2.sh $(objpfx)tst-gettext2
$(SHELL) -e $< $(common-objpfx) $(common-objpfx)intl/
-$(objpfx)tst-codeset.out: tst-codeset.sh $(objpfx)tst-codeset
- $(SHELL) -e $< $(common-objpfx) $(common-objpfx)intl/
-$(objpfx)tst-gettext3.out: tst-gettext3.sh $(objpfx)tst-gettext3
- $(SHELL) -e $< $(common-objpfx) $(common-objpfx)intl/
$(objpfx)tst-gettext4.out: tst-gettext4.sh $(objpfx)tst-gettext4
$(SHELL) -e $< $(common-objpfx) '$(run-program-prefix)' $(common-objpfx)intl/
-$(objpfx)tst-gettext5.out: tst-gettext5.sh $(objpfx)tst-gettext5
- $(SHELL) -e $< $(common-objpfx) '$(run-program-prefix)' $(common-objpfx)intl/
$(objpfx)tst-gettext6.out: tst-gettext6.sh $(objpfx)tst-gettext6
$(SHELL) -e $< $(common-objpfx) '$(run-program-prefix)' $(common-objpfx)intl/
+
+$(objpfx)tst-codeset.out: $(codeset_mo)
+$(objpfx)tst-gettext3.out: $(codeset_mo)
+$(objpfx)tst-gettext5.out: $(codeset_mo)
endif
endif
@@ -109,6 +117,11 @@ CFLAGS-tst-gettext4.c = -DOBJPFX=\"$(obj
CFLAGS-tst-gettext5.c = -DOBJPFX=\"$(objpfx)\"
CFLAGS-tst-gettext6.c = -DOBJPFX=\"$(objpfx)\"
+LOCPATH-ENV = LOCPATH=$(common-objpfx)localedata
+tst-codeset-ENV = $(LOCPATH-ENV)
+tst-gettext3-ENV = $(LOCPATH-ENV)
+tst-gettext5-ENV = $(LOCPATH-ENV)
+
ifeq ($(have-thread-library),yes)
ifeq (yes,$(build-shared))
$(addprefix $(objpfx),$(multithread-test-srcs)): $(shared-thread-library)
diff -Nrup a/intl/tst-codeset.sh b/intl/tst-codeset.sh
--- a/intl/tst-codeset.sh 2010-05-04 05:27:23.000000000 -0600
+++ b/intl/tst-codeset.sh 1969-12-31 17:00:00.000000000 -0700
@@ -1,43 +0,0 @@
-#! /bin/sh
-# Test of bind_textdomain_codeset.
-# Copyright (C) 2001, 2002, 2005 Free Software Foundation, Inc.
-# This file is part of the GNU C Library.
-#
-
-# The GNU C Library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2.1 of the License, or (at your option) any later version.
-
-# The GNU C Library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Lesser General Public License for more details.
-
-# You should have received a copy of the GNU Lesser General Public
-# License along with the GNU C Library; if not, write to the Free
-# Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-# 02111-1307 USA.
-
-common_objpfx=$1
-objpfx=$2
-
-LC_ALL=C
-export LC_ALL
-
-# Generate the test data.
-msgfmt -o ${objpfx}codeset.mo.$$ tstcodeset.po || exit
-# Create the domain directories.
-mkdir -p ${objpfx}domaindir/de_DE/LC_MESSAGES
-# Populate them.
-mv -f ${objpfx}codeset.mo.$$ ${objpfx}domaindir/de_DE/LC_MESSAGES/codeset.mo
-
-GCONV_PATH=${common_objpfx}iconvdata
-export GCONV_PATH
-LOCPATH=${common_objpfx}localedata
-export LOCPATH
-
-${common_objpfx}elf/ld.so --library-path $common_objpfx \
-${objpfx}tst-codeset > ${objpfx}tst-codeset.out
-
-exit $?
diff -Nrup a/intl/tst-gettext3.sh b/intl/tst-gettext3.sh
--- a/intl/tst-gettext3.sh 2010-05-04 05:27:23.000000000 -0600
+++ b/intl/tst-gettext3.sh 1969-12-31 17:00:00.000000000 -0700
@@ -1,44 +0,0 @@
-#! /bin/sh
-# Test that the gettext() results come out in the correct encoding for
-# locales that differ only in their encoding.
-# Copyright (C) 2001, 2002, 2005 Free Software Foundation, Inc.
-# This file is part of the GNU C Library.
-#
-
-# The GNU C Library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2.1 of the License, or (at your option) any later version.
-
-# The GNU C Library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Lesser General Public License for more details.
-
-# You should have received a copy of the GNU Lesser General Public
-# License along with the GNU C Library; if not, write to the Free
-# Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-# 02111-1307 USA.
-
-common_objpfx=$1
-objpfx=$2
-
-LC_ALL=C
-export LC_ALL
-
-# Generate the test data.
-msgfmt -o ${objpfx}codeset.mo.$$ tstcodeset.po || exit
-# Create the domain directories.
-mkdir -p ${objpfx}domaindir/de_DE/LC_MESSAGES
-# Populate them.
-mv -f ${objpfx}codeset.mo.$$ ${objpfx}domaindir/de_DE/LC_MESSAGES/codeset.mo
-
-GCONV_PATH=${common_objpfx}iconvdata
-export GCONV_PATH
-LOCPATH=${common_objpfx}localedata
-export LOCPATH
-
-${common_objpfx}elf/ld.so --library-path $common_objpfx \
-${objpfx}tst-gettext3 > ${objpfx}tst-gettext3.out
-
-exit $?
diff -Nrup a/intl/tst-gettext5.sh b/intl/tst-gettext5.sh
--- a/intl/tst-gettext5.sh 2010-05-04 05:27:23.000000000 -0600
+++ b/intl/tst-gettext5.sh 1969-12-31 17:00:00.000000000 -0700
@@ -1,43 +0,0 @@
-#! /bin/sh
-# Test that gettext() in multithreaded applications works correctly if
-# different threads operate in different locales referring to the same
-# catalog file but with different encodings.
-# Copyright (C) 2001, 2002, 2005 Free Software Foundation, Inc.
-# This file is part of the GNU C Library.
-#
-
-# The GNU C Library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2.1 of the License, or (at your option) any later version.
-
-# The GNU C Library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Lesser General Public License for more details.
-
-# You should have received a copy of the GNU Lesser General Public
-# License along with the GNU C Library; if not, write to the Free
-# Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-# 02111-1307 USA.
-
-common_objpfx=$1
-run_program_prefix=$2
-objpfx=$3
-
-LC_ALL=C
-export LC_ALL
-
-# Create the domain directories.
-mkdir -p ${objpfx}domaindir/de_DE/LC_MESSAGES
-# Populate them.
-msgfmt -o ${objpfx}domaindir/de_DE/LC_MESSAGES/codeset.mo tstcodeset.po
-
-GCONV_PATH=${common_objpfx}iconvdata
-export GCONV_PATH
-LOCPATH=${common_objpfx}localedata
-export LOCPATH
-
-${run_program_prefix} ${objpfx}tst-gettext5 > ${objpfx}tst-gettext5.out
-
-exit $?

View File

@@ -0,0 +1,343 @@
diff -Nrup a/sysdeps/x86_64/fpu/e_expf.S b/sysdeps/x86_64/fpu/e_expf.S
--- a/sysdeps/x86_64/fpu/e_expf.S 1969-12-31 17:00:00.000000000 -0700
+++ b/sysdeps/x86_64/fpu/e_expf.S 2012-08-20 09:47:15.551971545 -0600
@@ -0,0 +1,339 @@
+/* Optimized __ieee754_expf function.
+ Copyright (C) 2012 Free Software Foundation, Inc.
+ Contributed by Intel Corporation.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <sysdep.h>
+
+/* Short algorithm description:
+ *
+ * Let K = 64 (table size).
+ * e^x = 2^(x/log(2)) = 2^n * T[j] * (1 + P(y))
+ * where
+ * x = m*log(2)/K + y, y in [0.0..log(2)/K]
+ * m = n*K + j, m,n,j - signed integer, j in [0..K-1]
+ * values of 2^(j/K) are tabulated as T[j].
+ *
+ * P(y) is a minimax polynomial approximation of expf(x)-1
+ * on small interval [0.0..log(2)/K].
+ *
+ * P(y) = P3*y*y*y*y + P2*y*y*y + P1*y*y + P0*y, calculated as
+ * z = y*y; P(y) = (P3*z + P1)*z + (P2*z + P0)*y
+ *
+ * Special cases:
+ * expf(NaN) = NaN
+ * expf(+INF) = +INF
+ * expf(-INF) = 0
+ * expf(x) = 1 for subnormals
+ * for finite argument, only expf(0)=1 is exact
+ * expf(x) overflows if x>88.7228317260742190
+ * expf(x) underflows if x<-103.972076416015620
+ */
+
+ .text
+ENTRY(__ieee754_expf)
+ /* Input: single precision x in %xmm0 */
+ cvtss2sd %xmm0, %xmm1 /* Convert x to double precision */
+ movd %xmm0, %ecx /* Copy x */
+ movsd L(DP_KLN2)(%rip), %xmm2 /* DP K/log(2) */
+ movsd L(DP_P2)(%rip), %xmm3 /* DP P2 */
+ movl %ecx, %eax /* x */
+ mulsd %xmm1, %xmm2 /* DP x*K/log(2) */
+ andl $0x7fffffff, %ecx /* |x| */
+ lea L(DP_T)(%rip), %rsi /* address of table T[j] */
+ cmpl $0x42ad496b, %ecx /* |x|<125*log(2) ? */
+ movsd L(DP_P3)(%rip), %xmm4 /* DP P3 */
+ addsd L(DP_RS)(%rip), %xmm2 /* DP x*K/log(2)+RS */
+ jae L(special_paths)
+
+ /* Here if |x|<125*log(2) */
+ cmpl $0x31800000, %ecx /* |x|<2^(-28) ? */
+ jb L(small_arg)
+
+ /* Main path: here if 2^(-28)<=|x|<125*log(2) */
+ cvtsd2ss %xmm2, %xmm2 /* SP x*K/log(2)+RS */
+ movd %xmm2, %eax /* bits of n*K+j with trash */
+ subss L(SP_RS)(%rip), %xmm2 /* SP t=round(x*K/log(2)) */
+ movl %eax, %edx /* n*K+j with trash */
+ cvtss2sd %xmm2, %xmm2 /* DP t */
+ andl $0x3f, %eax /* bits of j */
+ mulsd L(DP_NLN2K)(%rip), %xmm2/* DP -t*log(2)/K */
+ andl $0xffffffc0, %edx /* bits of n */
+#ifdef __AVX__
+ vaddsd %xmm1, %xmm2, %xmm0 /* DP y=x-t*log(2)/K */
+ vmulsd %xmm0, %xmm0, %xmm2 /* DP z=y*y */
+#else
+ addsd %xmm1, %xmm2 /* DP y=x-t*log(2)/K */
+ movaps %xmm2, %xmm0 /* DP y */
+ mulsd %xmm2, %xmm2 /* DP z=y*y */
+#endif
+ mulsd %xmm2, %xmm4 /* DP P3*z */
+ addl $0x1fc0, %edx /* bits of n + SP exponent bias */
+ mulsd %xmm2, %xmm3 /* DP P2*z */
+ shll $17, %edx /* SP 2^n */
+ addsd L(DP_P1)(%rip), %xmm4 /* DP P3*z+P1 */
+ addsd L(DP_P0)(%rip), %xmm3 /* DP P2*z+P0 */
+ movd %edx, %xmm1 /* SP 2^n */
+ mulsd %xmm2, %xmm4 /* DP (P3*z+P1)*z */
+ mulsd %xmm3, %xmm0 /* DP (P2*z+P0)*y */
+ addsd %xmm4, %xmm0 /* DP P(y) */
+ mulsd (%rsi,%rax,8), %xmm0 /* DP P(y)*T[j] */
+ addsd (%rsi,%rax,8), %xmm0 /* DP T[j]*(P(y)+1) */
+ cvtsd2ss %xmm0, %xmm0 /* SP T[j]*(P(y)+1) */
+ mulss %xmm1, %xmm0 /* SP result=2^n*(T[j]*(P(y)+1)) */
+ ret
+
+ .p2align 4
+L(small_arg):
+ /* Here if 0<=|x|<2^(-28) */
+ addss L(SP_ONE)(%rip), %xmm0 /* 1.0 + x */
+ /* Return 1.0 with inexact raised, except for x==0 */
+ ret
+
+ .p2align 4
+L(special_paths):
+ /* Here if 125*log(2)<=|x| */
+ shrl $31, %eax /* Get sign bit of x, and depending on it: */
+ lea L(SP_RANGE)(%rip), %rdx /* load over/underflow bound */
+ cmpl (%rdx,%rax,4), %ecx /* |x|<under/overflow bound ? */
+ jbe L(near_under_or_overflow)
+
+ /* Here if |x|>under/overflow bound */
+ cmpl $0x7f800000, %ecx /* |x| is finite ? */
+ jae L(arg_inf_or_nan)
+
+ /* Here if |x|>under/overflow bound, and x is finite */
+ testq %rax, %rax /* sign of x nonzero ? */
+ je L(res_overflow)
+
+ /* Here if -inf<x<underflow bound (x<0) */
+ movss L(SP_SMALL)(%rip), %xmm0/* load small value 2^(-100) */
+ mulss %xmm0, %xmm0 /* Return underflowed result (zero or subnormal) */
+ ret
+
+ .p2align 4
+L(res_overflow):
+ /* Here if overflow bound<x<inf (x>0) */
+ movss L(SP_LARGE)(%rip), %xmm0/* load large value 2^100 */
+ mulss %xmm0, %xmm0 /* Return overflowed result (Inf or max normal) */
+ ret
+
+ .p2align 4
+L(arg_inf_or_nan):
+ /* Here if |x| is Inf or NAN */
+ jne L(arg_nan) /* |x| is Inf ? */
+
+ /* Here if |x| is Inf */
+ lea L(SP_INF_0)(%rip), %rdx /* depending on sign of x: */
+ movss (%rdx,%rax,4), %xmm0 /* return zero or Inf */
+ ret
+
+ .p2align 4
+L(arg_nan):
+ /* Here if |x| is NaN */
+ addss %xmm0, %xmm0 /* Return x+x (raise invalid) */
+ ret
+
+ .p2align 4
+L(near_under_or_overflow):
+ /* Here if 125*log(2)<=|x|<under/overflow bound */
+ cvtsd2ss %xmm2, %xmm2 /* SP x*K/log(2)+RS */
+ movd %xmm2, %eax /* bits of n*K+j with trash */
+ subss L(SP_RS)(%rip), %xmm2 /* SP t=round(x*K/log(2)) */
+ movl %eax, %edx /* n*K+j with trash */
+ cvtss2sd %xmm2, %xmm2 /* DP t */
+ andl $0x3f, %eax /* bits of j */
+ mulsd L(DP_NLN2K)(%rip), %xmm2/* DP -t*log(2)/K */
+ andl $0xffffffc0, %edx /* bits of n */
+#ifdef __AVX__
+ vaddsd %xmm1, %xmm2, %xmm0 /* DP y=x-t*log(2)/K */
+ vmulsd %xmm0, %xmm0, %xmm2 /* DP z=y*y */
+#else
+ addsd %xmm1, %xmm2 /* DP y=x-t*log(2)/K */
+ movaps %xmm2, %xmm0 /* DP y */
+ mulsd %xmm2, %xmm2 /* DP z=y*y */
+#endif
+ mulsd %xmm2, %xmm4 /* DP P3*z */
+ addl $0xffc0, %edx /* bits of n + DP exponent bias */
+ mulsd %xmm2, %xmm3 /* DP P2*z */
+ shlq $46, %rdx /* DP 2^n */
+ addsd L(DP_P1)(%rip), %xmm4 /* DP P3*z+P1 */
+ addsd L(DP_P0)(%rip), %xmm3 /* DP P2*z+P0 */
+ movd %rdx, %xmm1 /* DP 2^n */
+ mulsd %xmm2, %xmm4 /* DP (P3*z+P1)*z */
+ mulsd %xmm3, %xmm0 /* DP (P2*z+P0)*y */
+ addsd %xmm4, %xmm0 /* DP P(y) */
+ mulsd (%rsi,%rax,8), %xmm0 /* DP P(y)*T[j] */
+ addsd (%rsi,%rax,8), %xmm0 /* DP T[j]*(P(y)+1) */
+ mulsd %xmm1, %xmm0 /* DP result=2^n*(T[j]*(P(y)+1)) */
+ cvtsd2ss %xmm0, %xmm0 /* convert result to single precision */
+ ret
+END(__ieee754_expf)
+
+ .section .rodata, "a"
+ .p2align 3
+L(DP_T): /* table of double precision values 2^(j/K) for j=[0..K-1] */
+ .long 0x00000000, 0x3ff00000
+ .long 0x3e778061, 0x3ff02c9a
+ .long 0xd3158574, 0x3ff059b0
+ .long 0x18759bc8, 0x3ff08745
+ .long 0x6cf9890f, 0x3ff0b558
+ .long 0x32d3d1a2, 0x3ff0e3ec
+ .long 0xd0125b51, 0x3ff11301
+ .long 0xaea92de0, 0x3ff1429a
+ .long 0x3c7d517b, 0x3ff172b8
+ .long 0xeb6fcb75, 0x3ff1a35b
+ .long 0x3168b9aa, 0x3ff1d487
+ .long 0x88628cd6, 0x3ff2063b
+ .long 0x6e756238, 0x3ff2387a
+ .long 0x65e27cdd, 0x3ff26b45
+ .long 0xf51fdee1, 0x3ff29e9d
+ .long 0xa6e4030b, 0x3ff2d285
+ .long 0x0a31b715, 0x3ff306fe
+ .long 0xb26416ff, 0x3ff33c08
+ .long 0x373aa9cb, 0x3ff371a7
+ .long 0x34e59ff7, 0x3ff3a7db
+ .long 0x4c123422, 0x3ff3dea6
+ .long 0x21f72e2a, 0x3ff4160a
+ .long 0x6061892d, 0x3ff44e08
+ .long 0xb5c13cd0, 0x3ff486a2
+ .long 0xd5362a27, 0x3ff4bfda
+ .long 0x769d2ca7, 0x3ff4f9b2
+ .long 0x569d4f82, 0x3ff5342b
+ .long 0x36b527da, 0x3ff56f47
+ .long 0xdd485429, 0x3ff5ab07
+ .long 0x15ad2148, 0x3ff5e76f
+ .long 0xb03a5585, 0x3ff6247e
+ .long 0x82552225, 0x3ff66238
+ .long 0x667f3bcd, 0x3ff6a09e
+ .long 0x3c651a2f, 0x3ff6dfb2
+ .long 0xe8ec5f74, 0x3ff71f75
+ .long 0x564267c9, 0x3ff75feb
+ .long 0x73eb0187, 0x3ff7a114
+ .long 0x36cf4e62, 0x3ff7e2f3
+ .long 0x994cce13, 0x3ff82589
+ .long 0x9b4492ed, 0x3ff868d9
+ .long 0x422aa0db, 0x3ff8ace5
+ .long 0x99157736, 0x3ff8f1ae
+ .long 0xb0cdc5e5, 0x3ff93737
+ .long 0x9fde4e50, 0x3ff97d82
+ .long 0x82a3f090, 0x3ff9c491
+ .long 0x7b5de565, 0x3ffa0c66
+ .long 0xb23e255d, 0x3ffa5503
+ .long 0x5579fdbf, 0x3ffa9e6b
+ .long 0x995ad3ad, 0x3ffae89f
+ .long 0xb84f15fb, 0x3ffb33a2
+ .long 0xf2fb5e47, 0x3ffb7f76
+ .long 0x904bc1d2, 0x3ffbcc1e
+ .long 0xdd85529c, 0x3ffc199b
+ .long 0x2e57d14b, 0x3ffc67f1
+ .long 0xdcef9069, 0x3ffcb720
+ .long 0x4a07897c, 0x3ffd072d
+ .long 0xdcfba487, 0x3ffd5818
+ .long 0x03db3285, 0x3ffda9e6
+ .long 0x337b9b5f, 0x3ffdfc97
+ .long 0xe78b3ff6, 0x3ffe502e
+ .long 0xa2a490da, 0x3ffea4af
+ .long 0xee615a27, 0x3ffefa1b
+ .long 0x5b6e4540, 0x3fff5076
+ .long 0x819e90d8, 0x3fffa7c1
+ .type L(DP_T), @object
+ ASM_SIZE_DIRECTIVE(L(DP_T))
+
+ .section .rodata.cst8,"aM",@progbits,8
+ .p2align 3
+L(DP_KLN2): /* double precision K/log(2) */
+ .long 0x652b82fe, 0x40571547
+ .type L(DP_KLN2), @object
+ ASM_SIZE_DIRECTIVE(L(DP_KLN2))
+
+ .p2align 3
+L(DP_NLN2K): /* double precision -log(2)/K */
+ .long 0xfefa39ef, 0xbf862e42
+ .type L(DP_NLN2K), @object
+ ASM_SIZE_DIRECTIVE(L(DP_NLN2K))
+
+ .p2align 3
+L(DP_RS): /* double precision 2^23+2^22 */
+ .long 0x00000000, 0x41680000
+ .type L(DP_RS), @object
+ ASM_SIZE_DIRECTIVE(L(DP_RS))
+
+ .p2align 3
+L(DP_P3): /* double precision polynomial coefficient P3 */
+ .long 0xeb78fa85, 0x3fa56420
+ .type L(DP_P3), @object
+ ASM_SIZE_DIRECTIVE(L(DP_P3))
+
+ .p2align 3
+L(DP_P1): /* double precision polynomial coefficient P1 */
+ .long 0x008d6118, 0x3fe00000
+ .type L(DP_P1), @object
+ ASM_SIZE_DIRECTIVE(L(DP_P1))
+
+ .p2align 3
+L(DP_P2): /* double precision polynomial coefficient P2 */
+ .long 0xda752d4f, 0x3fc55550
+ .type L(DP_P2), @object
+ ASM_SIZE_DIRECTIVE(L(DP_P2))
+
+ .p2align 3
+L(DP_P0): /* double precision polynomial coefficient P0 */
+ .long 0xffffe7c6, 0x3fefffff
+ .type L(DP_P0), @object
+ ASM_SIZE_DIRECTIVE(L(DP_P0))
+
+ .p2align 2
+L(SP_RANGE): /* single precision overflow/underflow bounds */
+ .long 0x42b17217 /* if x>this bound, then result overflows */
+ .long 0x42cff1b4 /* if x<this bound, then result underflows */
+ .type L(SP_RANGE), @object
+ ASM_SIZE_DIRECTIVE(L(SP_RANGE))
+
+ .p2align 2
+L(SP_INF_0):
+ .long 0x7f800000 /* single precision Inf */
+ .long 0 /* single precision zero */
+ .type L(SP_INF_0), @object
+ ASM_SIZE_DIRECTIVE(L(SP_INF_0))
+
+ .section .rodata.cst4,"aM",@progbits,4
+ .p2align 2
+L(SP_RS): /* single precision 2^23+2^22 */
+ .long 0x4b400000
+ .type L(SP_RS), @object
+ ASM_SIZE_DIRECTIVE(L(SP_RS))
+
+ .p2align 2
+L(SP_SMALL): /* single precision small value 2^(-100) */
+ .long 0x0d800000
+ .type L(SP_SMALL), @object
+ ASM_SIZE_DIRECTIVE(L(SP_SMALL))
+
+ .p2align 2
+L(SP_LARGE): /* single precision large value 2^100 */
+ .long 0x71800000
+ .type L(SP_LARGE), @object
+ ASM_SIZE_DIRECTIVE(L(SP_LARGE))
+
+ .p2align 2
+L(SP_ONE): /* single precision 1.0 */
+ .long 0x3f800000
+ .type L(SP_ONE), @object
+ ASM_SIZE_DIRECTIVE(L(SP_ONE))
+
+strong_alias (__ieee754_expf, __expf_finite)

View File

@@ -0,0 +1,105 @@
From libc-alpha-return-31329-listarch-libc-alpha=sources dot redhat dot com at sourceware dot org Wed Jul 11 11:36:39 2012
Return-Path: <libc-alpha-return-31329-listarch-libc-alpha=sources dot redhat dot com at sourceware dot org>
Delivered-To: listarch-libc-alpha at sources dot redhat dot com
Received: (qmail 15677 invoked by alias); 11 Jul 2012 11:36:39 -0000
Received: (qmail 15654 invoked by uid 22791); 11 Jul 2012 11:36:37 -0000
X-SWARE-Spam-Status: No, hits=-4.3 required=5.0
tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,KHOP_RCVD_TRUST,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_YE
X-Spam-Check-By: sourceware.org
Date: Wed, 11 Jul 2012 21:06:06 +0930
From: Alan Modra <amodra at gmail dot com>
To: libc-alpha at sourceware dot org
Cc: rsa at linux dot vnet dot ibm dot com
Subject: powerpc pthread_once bug fix
Message-ID: <20120711113606.GM3117@bubble.grove.modra.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
User-Agent: Mutt/1.5.21 (2010-09-15)
Mailing-List: contact libc-alpha-help at sourceware dot org; run by ezmlm
Precedence: bulk
List-Id: <libc-alpha.sourceware.org>
List-Subscribe: <mailto:libc-alpha-subscribe at sourceware dot org>
List-Archive: <http://sourceware.org/ml/libc-alpha/>
List-Post: <mailto:libc-alpha at sourceware dot org>
List-Help: <mailto:libc-alpha-help at sourceware dot org>, <http://sourceware dot org/ml/#faqs>
Sender: libc-alpha-owner at sourceware dot org
Delivered-To: mailing list libc-alpha at sourceware dot org
This fixes some bugs in the powerpc pthread_once code. Ref
gcc.gnu.org/bugzilla/show_bug.cgi?id=52839#c10
Release barriers are needed to ensure any memory written by
init_routine is seen by other threads before *once_control changes.
In the case of clear_once_control we need to flush any partially
written state.
2012-06-28 Alan Modra <amodra@gmail.com>
* sysdeps/unix/sysv/linux/powerpc/pthread_once.c (__pthread_once):
Add release barrier before setting once_control to say
initialisation is done. Add hints on lwarx. Use macro in
place of isync.
(clear_once_control): Add release barrier.
[ This was slightly edited -- the constraint for operand 0 in the last asm was changed
from "=&r" to "=&b" as using r0 in that context results in a load immediate 1 into
the target rather than incrementing the target. ]
diff --git a/nptl/sysdeps/unix/sysv/linux/powerpc/pthread_once.c b/nptl/sysdeps/unix/sysv/linux/powerpc/pthread_once.c
index 4e3d7bd..bb1ebf2 100644
--- a/nptl/sysdeps/unix/sysv/linux/powerpc/pthread_once.c
+++ b/nptl/sysdeps/unix/sysv/linux/powerpc/pthread_once.c
@@ -28,6 +28,7 @@ clear_once_control (void *arg)
{
pthread_once_t *once_control = (pthread_once_t *) arg;
+ __asm __volatile (__lll_rel_instr);
*once_control = 0;
lll_futex_wake (once_control, INT_MAX, LLL_PRIVATE);
}
@@ -47,15 +48,15 @@ __pthread_once (pthread_once_t *once_control, void (*init_routine) (void))
oldval = *once_control;
if ((oldval & 2) == 0)
*once_control = newval;
- Do this atomically.
+ Do this atomically with an acquire barrier.
*/
newval = __fork_generation | 1;
- __asm __volatile ("1: lwarx %0,0,%3\n"
+ __asm __volatile ("1: lwarx %0,0,%3" MUTEX_HINT_ACQ "\n"
" andi. %1,%0,2\n"
" bne 2f\n"
" stwcx. %4,0,%3\n"
" bne 1b\n"
- "2: isync"
+ "2: " __lll_acq_instr
: "=&r" (oldval), "=&r" (tmp), "=m" (*once_control)
: "r" (once_control), "r" (newval), "m" (*once_control)
: "cr0");
@@ -87,8 +88,18 @@ __pthread_once (pthread_once_t *once_control, void (*init_routine) (void))
pthread_cleanup_pop (0);
- /* Add one to *once_control to take the bottom 2 bits from 01 to 10. */
- atomic_increment (once_control);
+ /* Add one to *once_control to take the bottom 2 bits from 01 to 10.
+ A release barrier is needed to ensure memory written by init_routine
+ is seen in other threads before *once_control changes. */
+ int tmp;
+ __asm __volatile (__lll_rel_instr "\n"
+ "1: lwarx %0,0,%2" MUTEX_HINT_REL "\n"
+ " addi %0,%0,1\n"
+ " stwcx. %0,0,%2\n"
+ " bne- 1b"
+ : "=&b" (tmp), "=m" (*once_control)
+ : "r" (once_control), "m" (*once_control)
+ : "cr0");
/* Wake up all other threads. */
lll_futex_wake (once_control, INT_MAX, LLL_PRIVATE);
--
Alan Modra
Australia Development Lab, IBM

View File

@@ -0,0 +1,86 @@
commit be08eda54c7cf833ccfa4b8d1f1b1d668c26af66
Author: Andreas Jaeger <aj@suse.de>
Date: Wed May 23 09:27:39 2012 +0200
Update from Linux 3.4
[ Partial, unrelated bits not included. ]
2012-05-23 Andreas Jaeger <aj@suse.de>
* sysdeps/unix/sysv/linux/powerpc/bits/mman.h
(MADV_DONTDUMP,MADV_DODUMP): New macros from Linux 3.4.
macro.
* sysdeps/unix/sysv/linux/s390/bits/mman.h
(MADV_DONTDUMP,MADV_DODUMP): Likewise.
* sysdeps/unix/sysv/linux/i386/bits/mman.h
(MADV_DONTDUMP,MADV_DODUMP): Likewise.
* sysdeps/unix/sysv/linux/x86_64/bits/mman.h
(MADV_DONTDUMP,MADV_DODUMP): Likewise.
diff -Nrup a/sysdeps/unix/sysv/linux/i386/bits/mman.h b/sysdeps/unix/sysv/linux/i386/bits/mman.h
--- a/sysdeps/unix/sysv/linux/i386/bits/mman.h 2010-05-04 05:27:23.000000000 -0600
+++ b/sysdeps/unix/sysv/linux/i386/bits/mman.h 2012-09-27 11:44:26.985150148 -0600
@@ -1,5 +1,5 @@
/* Definitions for POSIX memory map interface. Linux/i386 version.
- Copyright (C) 1997,2000,2003,2005,2006,2009 Free Software Foundation, Inc.
+ Copyright (C) 1997-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -94,6 +94,9 @@
# define MADV_DOFORK 11 /* Do inherit across fork. */
# define MADV_MERGEABLE 12 /* KSM may merge identical pages. */
# define MADV_UNMERGEABLE 13 /* KSM may not merge identical pages. */
+# define MADV_DONTDUMP 16 /* Explicity exclude from the core dump,
+ overrides the coredump filter bits. */
+# define MADV_DODUMP 17 /* Clear the MADV_DONTDUMP flag. */
# define MADV_HWPOISON 100 /* Poison a page for testing. */
#endif
diff -Nrup a/sysdeps/unix/sysv/linux/powerpc/bits/mman.h b/sysdeps/unix/sysv/linux/powerpc/bits/mman.h
--- a/sysdeps/unix/sysv/linux/powerpc/bits/mman.h 2010-05-04 05:27:23.000000000 -0600
+++ b/sysdeps/unix/sysv/linux/powerpc/bits/mman.h 2012-09-27 11:43:37.161351259 -0600
@@ -96,6 +96,9 @@
# define MADV_DOFORK 11 /* Do inherit across fork. */
# define MADV_MERGEABLE 12 /* KSM may merge identical pages. */
# define MADV_UNMERGEABLE 13 /* KSM may not merge identical pages. */
+# define MADV_DONTDUMP 16 /* Explicity exclude from the core dump,
+ overrides the coredump filter bits. */
+# define MADV_DODUMP 17 /* Clear the MADV_DONTDUMP flag. */
# define MADV_HWPOISON 100 /* Poison a page for testing. */
#endif
diff -Nrup a/sysdeps/unix/sysv/linux/s390/bits/mman.h b/sysdeps/unix/sysv/linux/s390/bits/mman.h
--- a/sysdeps/unix/sysv/linux/s390/bits/mman.h 2010-05-04 05:27:23.000000000 -0600
+++ b/sysdeps/unix/sysv/linux/s390/bits/mman.h 2012-09-27 11:44:49.745059646 -0600
@@ -94,6 +94,9 @@
# define MADV_DOFORK 11 /* Do inherit across fork. */
# define MADV_MERGEABLE 12 /* KSM may merge identical pages. */
# define MADV_UNMERGEABLE 13 /* KSM may not merge identical pages. */
+# define MADV_DONTDUMP 16 /* Explicity exclude from the core dump,
+ overrides the coredump filter bits. */
+# define MADV_DODUMP 17 /* Clear the MADV_DONTDUMP flag. */
# define MADV_HWPOISON 100 /* Poison a page for testing. */
#endif
diff -Nrup a/sysdeps/unix/sysv/linux/x86_64/bits/mman.h b/sysdeps/unix/sysv/linux/x86_64/bits/mman.h
--- a/sysdeps/unix/sysv/linux/x86_64/bits/mman.h 2010-05-04 05:27:23.000000000 -0600
+++ b/sysdeps/unix/sysv/linux/x86_64/bits/mman.h 2012-09-27 11:42:08.314725733 -0600
@@ -1,5 +1,5 @@
/* Definitions for POSIX memory map interface. Linux/x86_64 version.
- Copyright (C) 2001, 2003, 2005, 2006, 2009 Free Software Foundation, Inc.
+ Copyright (C) 2001-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -95,6 +95,9 @@
# define MADV_DOFORK 11 /* Do inherit across fork. */
# define MADV_MERGEABLE 12 /* KSM may merge identical pages. */
# define MADV_UNMERGEABLE 13 /* KSM may not merge identical pages. */
+# define MADV_DONTDUMP 16 /* Explicity exclude from the core dump,
+ overrides the coredump filter bits. */
+# define MADV_DODUMP 17 /* Clear the MADV_DONTDUMP flag. */
# define MADV_HWPOISON 100 /* Poison a page for testing. */
#endif

View File

@@ -0,0 +1,81 @@
--- glibc-2.12-2-gc4ccff1/nscd/grpcache.c.lrgrpissue 2002-03-19 01:06:04.905969517 +0530
+++ glibc-2.12-2-gc4ccff1/nscd/grpcache.c 2002-03-19 01:09:46.495970850 +0530
@@ -207,10 +207,11 @@ cache_addgr (struct database_dyn *db, in
change. Allocate memory on the cache since it is likely
discarded anyway. If it turns out to be necessary to have a
new record we can still allocate real memory. */
- bool dataset_in_stack_or_freed = false;
+ bool dataset_temporary = false;
+ bool dataset_malloced = false;
dataset = NULL;
- if (he == NULL || ! __libc_use_alloca (alloca_used + total + n))
+ if (he == NULL)
dataset = (struct dataset *) mempool_alloc (db, total + n, 1);
if (dataset == NULL)
@@ -218,10 +219,16 @@ cache_addgr (struct database_dyn *db, in
/* We cannot permanently add the result in the moment. But
we can provide the result as is. Store the data in some
temporary memory. */
- dataset = (struct dataset *) alloca_account (total + n, alloca_used);
-
+ if (! __libc_use_alloca (alloca_used + total + n))
+ {
+ /* XXX What to do if malloc fails? */
+ dataset = (struct dataset *) malloc (total + n);
+ dataset_malloced = true;
+ }
+ else
+ dataset = (struct dataset *) alloca_account (total + n, alloca_used);
/* We cannot add this record to the permanent database. */
- dataset_in_stack_or_freed = true;
+ dataset_temporary = true;
}
dataset->head.allocsize = total + n;
@@ -276,13 +283,10 @@ cache_addgr (struct database_dyn *db, in
dh->timeout = dataset->head.timeout;
++dh->nreloads;
- /* If the new record was not allocated on the stack, then it must
- be freed. Note that it can no longer be used. */
- if (! dataset_in_stack_or_freed)
- {
- free (dataset);
- dataset_in_stack_or_freed = true;
- }
+ /* If the new record was allocated via malloc, then we
+ must free it here. */
+ if (dataset_malloced)
+ free (dataset);
}
else
{
@@ -298,7 +302,7 @@ cache_addgr (struct database_dyn *db, in
key_copy = (char *) newp + (key_copy - (char *) dataset);
dataset = memcpy (newp, dataset, total + n);
- dataset_in_stack_or_freed = false;
+ dataset_temporary = false;
}
/* Mark the old record as obsolete. */
@@ -313,7 +317,7 @@ cache_addgr (struct database_dyn *db, in
assert (fd != -1);
#ifdef HAVE_SENDFILE
- if (__builtin_expect (db->mmap_used, 1) && !dataset_in_stack_or_freed)
+ if (__builtin_expect (db->mmap_used, 1) && ! dataset_temporary)
{
assert (db->wr_fd != -1);
assert ((char *) &dataset->resp > (char *) db->data);
@@ -340,7 +344,7 @@ cache_addgr (struct database_dyn *db, in
/* Add the record to the database. But only if it has not been
stored on the stack. */
- if (! dataset_in_stack_or_freed)
+ if (! dataset_temporary)
{
/* If necessary, we also propagate the data to disk. */
if (db->persistent)

View File

@@ -0,0 +1,12 @@
diff -rup a/sysdeps/generic/netinet/ip.h b/sysdeps/generic/netinet/ip.h
--- a/sysdeps/generic/netinet/ip.h 2010-05-04 05:27:23.000000000 -0600
+++ b/sysdeps/generic/netinet/ip.h 2012-10-11 09:22:12.620160387 -0600
@@ -194,7 +194,7 @@ struct ip_timestamp
*/
#define IPTOS_CLASS_MASK 0xe0
-#define IPTOS_CLASS(class) ((tos) & IPTOS_CLASS_MASK)
+#define IPTOS_CLASS(class) ((class) & IPTOS_CLASS_MASK)
#define IPTOS_CLASS_CS0 0x00
#define IPTOS_CLASS_CS1 0x20
#define IPTOS_CLASS_CS2 0x40

View File

@@ -0,0 +1,21 @@
diff -pruN glibc-2.5-20061008T1257/sysdeps/x86_64/fpu/math_private.h glibc-2.5-20061008T1257.patched/sysdeps/x86_64/fpu/math_private.h
--- glibc-2.5-20061008T1257/sysdeps/x86_64/fpu/math_private.h 2013-02-12 07:05:08.000000000 -0500
+++ glibc-2.5-20061008T1257.patched/sysdeps/x86_64/fpu/math_private.h 2013-02-12 06:59:08.000000000 -0500
@@ -90,10 +90,14 @@ while (0)
#undef libc_feupdateenv
#define libc_feupdateenv(e) \
do { \
- unsigned int mxcsr; \
+ unsigned int mxcsr, new_mxcsr; \
asm volatile ("stmxcsr %0" : "=m" (*&mxcsr)); \
- asm volatile ("ldmxcsr %0" : : "m" ((e)->__mxcsr)); \
- feraiseexcept (mxcsr & FE_ALL_EXCEPT); \
+ /* Merge in the old exceptions. */ \
+ new_mxcsr = mxcsr & FE_ALL_EXCEPT | (e)->__mxcsr; \
+ asm volatile ("ldmxcsr %0" : : "m" (*&new_mxcsr)); \
+ /* Only raise exception if there are any that are not masked. */ \
+ if (~(mxcsr >> 7) & mxcsr & FE_ALL_EXCEPT) \
+ feraiseexcept (mxcsr & FE_ALL_EXCEPT); \
} while (0)
#undef libc_feupdateenvf
#define libc_feupdateenvf(e) libc_feupdateenv (e)

View File

@@ -0,0 +1,190 @@
#
# Patch provided by Ulrich Drepper in BZ#919562.
#
# Patch has not been sent upstream.
#
# 2013-03-08 Ulrich Drepper <drepper@gmail.com>
#
# * elf/rtld.c (dl_main): Correctly determine when the application
# required DSOs with TLS and bump the generation counter in that
# case. The current condition does not account for an audit
# module using TLS.
# * elf/dl-tls.c (_dl_count_modids): New function.
# (_dl_allocate_tls_init): Add assertion to check TLS
# generation.
# * sysdeps/generic/ldsodefs.h: Declare _dl_count_modids.
# * elf/Makefile: Add rules to build and run tst-audit9.
# * elf/tst-audit9.c: New file.
# * elf/tst-auditmod9a.c: New file.
# * elf/tst-auditmod9b.c: New file.
#
diff -urN glibc-2.12-2-gc4ccff1.orig/elf/dl-tls.c glibc-2.12-2-gc4ccff1/elf/dl-tls.c
--- glibc-2.12-2-gc4ccff1.orig/elf/dl-tls.c 2013-04-24 16:06:10.410756438 -0400
+++ glibc-2.12-2-gc4ccff1/elf/dl-tls.c 2013-04-24 16:06:49.092604707 -0400
@@ -109,6 +109,28 @@
}
+size_t
+internal_function
+_dl_count_modids (void)
+{
+ if (! __builtin_expect (GL(dl_tls_dtv_gaps), true))
+ return GL(dl_tls_max_dtv_idx);
+
+ size_t n = 0;
+ struct dtv_slotinfo_list *runp = GL(dl_tls_dtv_slotinfo_list);
+ while (runp != NULL)
+ {
+ for (size_t i = 0; i < runp->len; ++i)
+ if (runp->slotinfo[i].map != NULL)
+ ++n;
+
+ runp = runp->next;
+ }
+
+ return n;
+}
+
+
#ifdef SHARED
void
internal_function
@@ -411,6 +433,7 @@
/* Keep track of the maximum generation number. This might
not be the generation counter. */
+ assert (listp->slotinfo[cnt].gen <= GL(dl_tls_generation));
maxgen = MAX (maxgen, listp->slotinfo[cnt].gen);
if (map->l_tls_offset == NO_TLS_OFFSET
diff -urN glibc-2.12-2-gc4ccff1.orig/elf/Makefile glibc-2.12-2-gc4ccff1/elf/Makefile
--- glibc-2.12-2-gc4ccff1.orig/elf/Makefile 2013-04-24 16:06:10.408756448 -0400
+++ glibc-2.12-2-gc4ccff1/elf/Makefile 2013-04-24 16:07:29.475457962 -0400
@@ -97,6 +97,8 @@
tst-audit6.c tst-auditmod6a.c tst-auditmod6b.c \
tst-auditmod6c.c \
tst-audit7.c tst-auditmod7a.c tst-auditmod7b.c \
+ tst-audit9.c \
+ tst-auditmod9a.c tst-auditmod9b.c \
order2mod1.c order2mod2.c order2mod3.c order2mod4.c \
tst-stackguard1.c tst-stackguard1-static.c \
tst-array5.c tst-array5-static.c tst-array5dep.c \
@@ -198,7 +200,7 @@
tst-dlmodcount tst-dlopenrpath tst-deep1 \
tst-dlmopen1 tst-dlmopen2 tst-dlmopen3 \
unload3 unload4 unload5 unload6 unload7 unload8 tst-global1 order2 \
- tst-audit1 tst-audit2 \
+ tst-audit1 tst-audit2 tst-audit9 \
tst-stackguard1 tst-addr1 tst-thrlock \
tst-unique1 tst-unique2
# reldep9
@@ -251,7 +253,8 @@
unload8mod1 unload8mod1x unload8mod2 unload8mod3 \
order2mod1 order2mod2 order2mod3 order2mod4 \
tst-unique1mod1 tst-unique1mod2 \
- tst-unique2mod1 tst-unique2mod2
+ tst-unique2mod1 tst-unique2mod2 \
+ tst-auditmod9a tst-auditmod9b
ifeq (yes,$(have-initfini-array))
modules-names += tst-array2dep tst-array5dep
endif
@@ -574,6 +577,8 @@
ifuncmod1.so-no-z-defs = yes
ifuncmod5.so-no-z-defs = yes
ifuncmod6.so-no-z-defs = yes
+tst-auditmod9a.so-no-z-defs = yes
+tst-auditmod9b.so-no-z-defs = yes
ifeq ($(build-shared),yes)
# Build all the modules even when not actually running test programs.
@@ -1015,6 +1020,10 @@
$(objpfx)tst-audit7.out: $(objpfx)tst-auditmod7b.so
tst-audit7-ENV = LD_AUDIT=$(objpfx)tst-auditmod7b.so
+$(objpfx)tst-audit9: $(libdl)
+$(objpfx)tst-audit9.out: $(objpfx)tst-auditmod9a.so $(objpfx)tst-auditmod9b.so
+tst-audit9-ENV = LD_AUDIT=$(objpfx)tst-auditmod9a.so
+
$(objpfx)tst-global1: $(libdl)
$(objpfx)tst-global1.out: $(objpfx)testobj6.so $(objpfx)testobj2.so
diff -urN glibc-2.12-2-gc4ccff1.orig/elf/rtld.c glibc-2.12-2-gc4ccff1/elf/rtld.c
--- glibc-2.12-2-gc4ccff1.orig/elf/rtld.c 2013-04-24 16:06:10.410756438 -0400
+++ glibc-2.12-2-gc4ccff1/elf/rtld.c 2013-04-24 16:06:49.096604693 -0400
@@ -1637,6 +1637,10 @@
}
}
+ /* Keep track of the currently loaded modules to count how many
+ non-audit modules which use TLS are loaded. */
+ size_t count_modids = _dl_count_modids ();
+
/* Set up debugging before the debugger is notified for the first time. */
#ifdef ELF_MACHINE_DEBUG_SETUP
/* Some machines (e.g. MIPS) don't use DT_DEBUG in this way. */
@@ -2281,7 +2285,8 @@
# define NONTLS_INIT_TP do { } while (0)
#endif
- if (!was_tls_init_tp_called && GL(dl_tls_max_dtv_idx) > 0)
+ if ((!was_tls_init_tp_called && GL(dl_tls_max_dtv_idx) > 0)
+ || count_modids != _dl_count_modids ())
++GL(dl_tls_generation);
/* Now that we have completed relocation, the initializer data
diff -urN glibc-2.12-2-gc4ccff1.orig/elf/tst-audit9.c glibc-2.12-2-gc4ccff1/elf/tst-audit9.c
--- glibc-2.12-2-gc4ccff1.orig/elf/tst-audit9.c 1969-12-31 19:00:00.000000000 -0500
+++ glibc-2.12-2-gc4ccff1/elf/tst-audit9.c 2013-04-24 16:06:49.096604693 -0400
@@ -0,0 +1,8 @@
+#include <dlfcn.h>
+
+int main(void)
+{
+ void *h = dlopen("$ORIGIN/tst-auditmod9b.so", RTLD_LAZY);
+ int (*fp)(void) = dlsym(h, "f");
+ return fp() - 1;
+}
diff -urN glibc-2.12-2-gc4ccff1.orig/elf/tst-auditmod9a.c glibc-2.12-2-gc4ccff1/elf/tst-auditmod9a.c
--- glibc-2.12-2-gc4ccff1.orig/elf/tst-auditmod9a.c 1969-12-31 19:00:00.000000000 -0500
+++ glibc-2.12-2-gc4ccff1/elf/tst-auditmod9a.c 2013-04-24 16:06:49.097604689 -0400
@@ -0,0 +1,16 @@
+#include <stdint.h>
+
+__thread int var;
+
+unsigned int
+la_version (unsigned int v)
+{
+ return v;
+}
+
+void
+la_activity (uintptr_t *cookie, unsigned int flag)
+{
+ ++var;
+}
+
diff -urN glibc-2.12-2-gc4ccff1.orig/elf/tst-auditmod9b.c glibc-2.12-2-gc4ccff1/elf/tst-auditmod9b.c
--- glibc-2.12-2-gc4ccff1.orig/elf/tst-auditmod9b.c 1969-12-31 19:00:00.000000000 -0500
+++ glibc-2.12-2-gc4ccff1/elf/tst-auditmod9b.c 2013-04-24 16:06:49.097604689 -0400
@@ -0,0 +1,6 @@
+__thread int a;
+
+int f(void)
+{
+ return ++a;
+}
diff -urN glibc-2.12-2-gc4ccff1.orig/sysdeps/generic/ldsodefs.h glibc-2.12-2-gc4ccff1/sysdeps/generic/ldsodefs.h
--- glibc-2.12-2-gc4ccff1.orig/sysdeps/generic/ldsodefs.h 2013-04-24 16:06:10.545755798 -0400
+++ glibc-2.12-2-gc4ccff1/sysdeps/generic/ldsodefs.h 2013-04-24 16:06:49.098604686 -0400
@@ -1031,6 +1031,9 @@
/* Determine next available module ID. */
extern size_t _dl_next_tls_modid (void) internal_function attribute_hidden;
+/* Count the modules with TLS segments. */
+extern size_t _dl_count_modids (void) internal_function attribute_hidden;
+
/* Calculate offset of the TLS blocks in the static TLS block. */
extern void _dl_determine_tlsoffset (void) internal_function attribute_hidden;

View File

@@ -0,0 +1,107 @@
2013-05-03 Carlos O'Donell <carlos at redhat.com>
* intl/dcigettext.c (DCIGETTEXT): Skip translating if _nl_find_msg returns -1.
(_nl_find_msg): Return -1 if recursive call returned -1. If newmem is null
return -1.
* intl/loadmsgcat.c (_nl_load_domain): If _nl_find_msg returns -1 abort
loading the domain.
diff -Nrup a/intl/dcigettext.c b/intl/dcigettext.c
--- a/intl/dcigettext.c 2010-05-04 07:27:23.000000000 -0400
+++ b/intl/dcigettext.c 2013-08-01 00:11:54.616363264 -0400
@@ -640,6 +640,11 @@ DCIGETTEXT (domainname, msgid1, msgid2,
retval = _nl_find_msg (domain->successor[cnt], binding,
msgid1, 1, &retlen);
+ /* Resource problems are not fatal, instead we return no
+ translation. */
+ if (__builtin_expect (retval == (char *) -1, 0))
+ goto no_translation;
+
if (retval != NULL)
{
domain = domain->successor[cnt];
@@ -943,6 +948,11 @@ _nl_find_msg (domain_file, domainbinding
nullentry =
_nl_find_msg (domain_file, domainbinding, "", 0, &nullentrylen);
+ /* Resource problems are fatal. If we continue onwards we will
+ only attempt to calloc a new conv_tab and fail later. */
+ if (__builtin_expect (nullentry == (char *) -1, 0))
+ return (char *) -1;
+
if (nullentry != NULL)
{
const char *charsetstr;
@@ -1156,7 +1166,7 @@ _nl_find_msg (domain_file, domainbinding
freemem_size);
# ifdef _LIBC
if (newmem != NULL)
- transmem_list = transmem_list->next;
+ transmem_list = newmem;
else
{
struct transmem_list *old = transmem_list;
@@ -1171,6 +1181,16 @@ _nl_find_msg (domain_file, domainbinding
malloc_count = 1;
freemem_size = INITIAL_BLOCK_SIZE;
newmem = (transmem_block_t *) malloc (freemem_size);
+# ifdef _LIBC
+ if (newmem != NULL)
+ {
+ /* Add the block to the list of blocks we have to free
+ at some point. */
+ newmem->next = transmem_list;
+ transmem_list = newmem;
+ }
+ /* Fall through and return -1. */
+# endif
}
if (__builtin_expect (newmem == NULL, 0))
{
@@ -1181,11 +1201,6 @@ _nl_find_msg (domain_file, domainbinding
}
# ifdef _LIBC
- /* Add the block to the list of blocks we have to free
- at some point. */
- newmem->next = transmem_list;
- transmem_list = newmem;
-
freemem = (unsigned char *) newmem->data;
freemem_size -= offsetof (struct transmem_list, data);
# else
@@ -1402,7 +1417,7 @@ get_output_charset (domainbinding)
return _NL_CURRENT (LC_CTYPE, CODESET);
# else
# if HAVE_ICONV
- extern const char *locale_charset PARAMS ((void);
+ extern const char *locale_charset PARAMS ((void));
return locale_charset ();
# endif
# endif
diff -Nrup a/intl/loadmsgcat.c b/intl/loadmsgcat.c
--- a/intl/loadmsgcat.c 2010-05-04 07:27:23.000000000 -0400
+++ b/intl/loadmsgcat.c 2013-08-01 00:12:48.448237849 -0400
@@ -1235,7 +1235,7 @@ _nl_load_domain (domain_file, domainbind
default:
/* This is an invalid revision. */
invalid:
- /* This is an invalid .mo file. */
+ /* This is an invalid .mo file or we ran out of resources. */
free (domain->malloced);
#ifdef HAVE_MMAP
if (use_mmap)
@@ -1255,6 +1255,12 @@ _nl_load_domain (domain_file, domainbind
/* Get the header entry and look for a plural specification. */
nullentry = _nl_find_msg (domain_file, domainbinding, "", 0, &nullentrylen);
+ if (__builtin_expect (nullentry == (char *) -1, 0))
+ {
+ __libc_rwlock_fini (domain->conversions_lock);
+ goto invalid;
+ }
+
EXTRACT_PLURAL_EXPRESSION (nullentry, &domain->plural, &domain->nplurals);
out:

View File

@@ -0,0 +1,181 @@
#
# Red Hat BZ:
# https://bugzilla.redhat.com/show_bug.cgi?id=816647
#
# ChangeLog
#
#2013-04-30 Patsy Franklin <pfrankli@redhat.com>
#
# * iconv/gconv_cache.c (find_module): Demangle init_fct before
# checking for NULL. Mangle __btowc_fct if init_fct is non-NULL.
# * iconv/gconv_db.c (free_derivation): Check that __shlib_handle
# is non-NULL before demangling the end_fct. Check for NULL
# end_fct after demangling.
# (__gconv_release_step): Demangle the end_fct before checking
# it for NULL. Remove assert on __shlibc_handle != NULL.
# (gen_steps): Don't check btowc_fct for NULL before mangling.
# Demangle init_fct before checking for NULL.
# (increment_counter): Likewise
# * gconv_dl.c (__gconv_find_shlib): Don't check init_fct or
# end_fct for NULL before mangling.
# * wcsmbs/btowc.c (__btowc): Demangle btowc_fct before checking
# for NULL.
#
diff -Nrup a/iconv/gconv_cache.c b/iconv/gconv_cache.c
--- a/iconv/gconv_cache.c 2012-12-24 22:02:13.000000000 -0500
+++ b/iconv/gconv_cache.c 2013-04-30 11:34:20.112389987 -0400
@@ -207,17 +207,16 @@ find_module (const char *directory, cons
result->__data = NULL;
/* Call the init function. */
- if (result->__init_fct != NULL)
- {
- __gconv_init_fct init_fct = result->__init_fct;
+ __gconv_init_fct init_fct = result->__init_fct;
#ifdef PTR_DEMANGLE
- PTR_DEMANGLE (init_fct);
+ PTR_DEMANGLE (init_fct);
#endif
+ if (init_fct != NULL)
+ {
status = DL_CALL_FCT (init_fct, (result));
#ifdef PTR_MANGLE
- if (result->__btowc_fct != NULL)
- PTR_MANGLE (result->__btowc_fct);
+ PTR_MANGLE (result->__btowc_fct);
#endif
}
}
diff -Nrup a/iconv/gconv_db.c b/iconv/gconv_db.c
--- a/iconv/gconv_db.c 2012-12-24 22:02:13.000000000 -0500
+++ b/iconv/gconv_db.c 2013-04-30 11:32:42.700592914 -0400
@@ -179,16 +179,15 @@ free_derivation (void *p)
size_t cnt;
for (cnt = 0; cnt < deriv->nsteps; ++cnt)
- if (deriv->steps[cnt].__counter > 0
- && deriv->steps[cnt].__end_fct != NULL)
+ if ((deriv->steps[cnt].__counter > 0)
+ && (deriv->steps[cnt].__shlib_handle != NULL))
{
- assert (deriv->steps[cnt].__shlib_handle != NULL);
-
__gconv_end_fct end_fct = deriv->steps[cnt].__end_fct;
#ifdef PTR_DEMANGLE
PTR_DEMANGLE (end_fct);
#endif
- DL_CALL_FCT (end_fct, (&deriv->steps[cnt]));
+ if (end_fct != NULL)
+ DL_CALL_FCT (end_fct, (&deriv->steps[cnt]));
}
/* Free the name strings. */
@@ -212,16 +211,12 @@ __gconv_release_step (struct __gconv_ste
if (step->__shlib_handle != NULL && --step->__counter == 0)
{
/* Call the destructor. */
- if (step->__end_fct != NULL)
- {
- assert (step->__shlib_handle != NULL);
-
- __gconv_end_fct end_fct = step->__end_fct;
+ __gconv_end_fct end_fct = step->__end_fct;
#ifdef PTR_DEMANGLE
- PTR_DEMANGLE (end_fct);
+ PTR_DEMANGLE (end_fct);
#endif
- DL_CALL_FCT (end_fct, (step));
- }
+ if (end_fct != NULL)
+ DL_CALL_FCT (end_fct, (step));
#ifndef STATIC_GCONV
/* Release the loaded module. */
@@ -293,13 +288,11 @@ gen_steps (struct derivation_step *best,
/* Call the init function. */
__gconv_init_fct init_fct = result[step_cnt].__init_fct;
- if (init_fct != NULL)
- {
- assert (result[step_cnt].__shlib_handle != NULL);
-
# ifdef PTR_DEMANGLE
- PTR_DEMANGLE (init_fct);
+ PTR_DEMANGLE (init_fct);
# endif
+ if (init_fct != NULL)
+ {
status = DL_CALL_FCT (init_fct, (&result[step_cnt]));
if (__builtin_expect (status, __GCONV_OK) != __GCONV_OK)
@@ -312,8 +305,7 @@ gen_steps (struct derivation_step *best,
}
# ifdef PTR_MANGLE
- if (result[step_cnt].__btowc_fct != NULL)
- PTR_MANGLE (result[step_cnt].__btowc_fct);
+ PTR_MANGLE (result[step_cnt].__btowc_fct);
# endif
}
}
@@ -393,16 +385,15 @@ increment_counter (struct __gconv_step *
/* Call the init function. */
__gconv_init_fct init_fct = step->__init_fct;
- if (init_fct != NULL)
- {
#ifdef PTR_DEMANGLE
- PTR_DEMANGLE (init_fct);
+ PTR_DEMANGLE (init_fct);
#endif
+ if (init_fct != NULL)
+ {
DL_CALL_FCT (init_fct, (step));
#ifdef PTR_MANGLE
- if (step->__btowc_fct != NULL)
- PTR_MANGLE (step->__btowc_fct);
+ PTR_MANGLE (step->__btowc_fct);
#endif
}
}
diff -Nrup a/iconv/gconv_dl.c b/iconv/gconv_dl.c
--- a/iconv/gconv_dl.c 2012-12-24 22:02:13.000000000 -0500
+++ b/iconv/gconv_dl.c 2013-04-30 11:32:42.701592922 -0400
@@ -132,10 +132,8 @@ __gconv_find_shlib (const char *name)
#ifdef PTR_MANGLE
PTR_MANGLE (found->fct);
- if (found->init_fct != NULL)
- PTR_MANGLE (found->init_fct);
- if (found->end_fct != NULL)
- PTR_MANGLE (found->end_fct);
+ PTR_MANGLE (found->init_fct);
+ PTR_MANGLE (found->end_fct);
#endif
/* We have succeeded in loading the shared object. */
diff -Nrup a/wcsmbs/btowc.c b/wcsmbs/btowc.c
--- a/wcsmbs/btowc.c 2012-12-24 22:02:13.000000000 -0500
+++ b/wcsmbs/btowc.c 2013-04-30 11:32:42.701592922 -0400
@@ -47,15 +47,15 @@ __btowc (c)
/* Get the conversion functions. */
fcts = get_gconv_fcts (_NL_CURRENT_DATA (LC_CTYPE));
__gconv_btowc_fct btowc_fct = fcts->towc->__btowc_fct;
+#ifdef PTR_DEMANGLE
+ if (fcts->towc->__shlib_handle != NULL)
+ PTR_DEMANGLE (btowc_fct);
+#endif
if (__builtin_expect (fcts->towc_nsteps == 1, 1)
&& __builtin_expect (btowc_fct != NULL, 1))
{
/* Use the shortcut function. */
-#ifdef PTR_DEMANGLE
- if (fcts->towc->__shlib_handle != NULL)
- PTR_DEMANGLE (btowc_fct);
-#endif
return DL_CALL_FCT (btowc_fct, (fcts->towc, (unsigned char) c));
}
else