From 8715963849c41e539b1f8bbe76a036df60cc295653ac9f84a2fce5233e997908 Mon Sep 17 00:00:00 2001 From: Andreas Schwab Date: Thu, 16 May 2013 15:57:30 +0000 Subject: [PATCH] Accepting request 175892 from home:Andreas_Schwab:Factory - big5-hkscs-update.patch.bz2: Update BIG5-HKSCS charmap to HKSCS-2008 - digits-dots.patch: Fix parsing of numeric hosts in gethostbyname_r - nss-database.patch: Properly cache the result from looking up the nss database config - strptime-W-week.patch: Properly handle %W in strptime - printf-overrun.patch: Revert problematic fixes for [BZ #11741] - glibc-aarch64-lib64.patch: Replace with upstream version - arm-ld-so-cache.patch: ARM: Support loading unmarked objects from cache - rtlddir.patch: Add support for rtld directory different from slib directory - regexp-overrun.patch: Fix buffer overrun in regexp matcher (CVE-2013-0242, bnc#801246) - getaddrinfo-overflow.patch: Fix stack overflow in getaddrinfo with many results (CVE-2013-1914, bnc#813121) - big5-hkscs-update.patch.bz2: Update BIG5-HKSCS charmap to HKSCS-2008 - digits-dots.patch: Fix parsing of numeric hosts in gethostbyname_r - nss-database.patch: Properly cache the result from looking up the nss database config - strptime-W-week.patch: Properly handle %W in strptime - printf-overrun.patch: Revert problematic fixes for [BZ #11741] - glibc-aarch64-lib64.patch: Replace with upstream version - arm-ld-so-cache.patch: ARM: Support loading unmarked objects from cache - rtlddir.patch: Add support for rtld directory different from slib directory - regexp-overrun.patch: Fix buffer overrun in regexp matcher (CVE-2013-0242, bnc#801246) - getaddrinfo-overflow.patch: Fix stack overflow in getaddrinfo with many results (CVE-2013-1914, bnc#813121) OBS-URL: https://build.opensuse.org/request/show/175892 OBS-URL: https://build.opensuse.org/package/show/Base:System/glibc?expand=0&rev=284 --- arm-ld-so-cache.patch | 94 ++++++++++++ big5-hkscs-update.patch.bz2 | 3 + digits-dots.patch | 191 ++++++++++++++++++++++++ getaddrinfo-overflow.patch | 62 ++++++++ glibc-aarch64-lib64.patch | 36 ++--- glibc-testsuite.changes | 18 +++ glibc-testsuite.spec | 48 ++++-- glibc-utils.changes | 18 +++ glibc-utils.spec | 48 ++++-- glibc.changes | 18 +++ glibc.spec | 48 ++++-- nss-database.patch | 115 ++++++++++++++ printf-overrun.patch | 179 ++++++++++++++++++++++ regexp-overrun.patch | 161 ++++++++++++++++++++ rtlddir.patch | 288 ++++++++++++++++++++++++++++++++++++ strptime-W-week.patch | 44 ++++++ 16 files changed, 1306 insertions(+), 65 deletions(-) create mode 100644 arm-ld-so-cache.patch create mode 100644 big5-hkscs-update.patch.bz2 create mode 100644 digits-dots.patch create mode 100644 getaddrinfo-overflow.patch create mode 100644 nss-database.patch create mode 100644 printf-overrun.patch create mode 100644 regexp-overrun.patch create mode 100644 rtlddir.patch create mode 100644 strptime-W-week.patch diff --git a/arm-ld-so-cache.patch b/arm-ld-so-cache.patch new file mode 100644 index 0000000..1261981 --- /dev/null +++ b/arm-ld-so-cache.patch @@ -0,0 +1,94 @@ +From b39949d21179bd0b08a083e4f7e35d0c98e11294 Mon Sep 17 00:00:00 2001 +From: Carlos O'Donell +Date: Fri, 8 Feb 2013 12:26:12 -0500 +Subject: [PATCH] ARM: Support loading unmarked objects from cache. + +ARM now supports loading unmarked objects from +the dynamic loader cache. Unmarked objects can +be used with the hard-float or soft-float ABI. +We must support loading unmarked objects during +the transition period from a binutils that does +not mark objects to one that does mark them with +the correct ELF flags. + +Signed-off-by: Carlos O'Donell +--- + ChangeLog | 5 +++++ + elf/cache.c | 4 ++++ + ports/ChangeLog.arm | 8 ++++++++ + ports/sysdeps/unix/sysv/linux/arm/dl-cache.h | 9 +++++++-- + ports/sysdeps/unix/sysv/linux/arm/readelflib.c | 6 ++++++ + sysdeps/generic/ldconfig.h | 1 + + 6 files changed, 31 insertions(+), 2 deletions(-) + +diff --git a/elf/cache.c b/elf/cache.c +index 9901952..699550b 100644 +--- a/elf/cache.c ++++ b/elf/cache.c +@@ -100,6 +100,10 @@ print_entry (const char *lib, int flag, unsigned int osversion, + case FLAG_AARCH64_LIB64: + fputs (",AArch64", stdout); + break; ++ /* Uses the ARM soft-float ABI. */ ++ case FLAG_ARM_LIBSF: ++ fputs (",soft-float", stdout); ++ break; + case 0: + break; + default: +diff --git a/ports/sysdeps/unix/sysv/linux/arm/dl-cache.h b/ports/sysdeps/unix/sysv/linux/arm/dl-cache.h +index acc4f28..504feca 100644 +--- a/ports/sysdeps/unix/sysv/linux/arm/dl-cache.h ++++ b/ports/sysdeps/unix/sysv/linux/arm/dl-cache.h +@@ -18,12 +18,17 @@ + + #include + ++/* In order to support the transition from unmarked objects ++ to marked objects we must treat unmarked objects as ++ compatible with either FLAG_ARM_LIBHF or FLAG_ARM_LIBSF. */ + #ifdef __ARM_PCS_VFP + # define _dl_cache_check_flags(flags) \ +- ((flags) == (FLAG_ARM_LIBHF | FLAG_ELF_LIBC6)) ++ ((flags) == (FLAG_ARM_LIBHF | FLAG_ELF_LIBC6) \ ++ || (flags) == FLAG_ELF_LIBC6) + #else + # define _dl_cache_check_flags(flags) \ +- ((flags) == FLAG_ELF_LIBC6) ++ ((flags) == (FLAG_ARM_LIBSF | FLAG_ELF_LIBC6) \ ++ || (flags) == FLAG_ELF_LIBC6) + #endif + + #include_next +diff --git a/ports/sysdeps/unix/sysv/linux/arm/readelflib.c b/ports/sysdeps/unix/sysv/linux/arm/readelflib.c +index 81e5ccb..3efb613 100644 +--- a/ports/sysdeps/unix/sysv/linux/arm/readelflib.c ++++ b/ports/sysdeps/unix/sysv/linux/arm/readelflib.c +@@ -46,6 +46,12 @@ process_elf_file (const char *file_name, const char *lib, int *flag, + if (elf32_header->e_flags & EF_ARM_ABI_FLOAT_HARD) + *flag = FLAG_ARM_LIBHF|FLAG_ELF_LIBC6; + else if (elf32_header->e_flags & EF_ARM_ABI_FLOAT_SOFT) ++ *flag = FLAG_ARM_LIBSF|FLAG_ELF_LIBC6; ++ else ++ /* We must assume the unmarked objects are compatible ++ with all ABI variants. Such objects may have been ++ generated in a transitional period when the ABI ++ tags were not added to all objects. */ + *flag = FLAG_ELF_LIBC6; + } + } +diff --git a/sysdeps/generic/ldconfig.h b/sysdeps/generic/ldconfig.h +index 57a9a46..91190aa 100644 +--- a/sysdeps/generic/ldconfig.h ++++ b/sysdeps/generic/ldconfig.h +@@ -36,6 +36,7 @@ + #define FLAG_X8664_LIBX32 0x0800 + #define FLAG_ARM_LIBHF 0x0900 + #define FLAG_AARCH64_LIB64 0x0a00 ++#define FLAG_ARM_LIBSF 0x0b00 + + /* Name of auxiliary cache. */ + #define _PATH_LDCONFIG_AUX_CACHE "/var/cache/ldconfig/aux-cache" +-- +1.8.2.3 + diff --git a/big5-hkscs-update.patch.bz2 b/big5-hkscs-update.patch.bz2 new file mode 100644 index 0000000..478e445 --- /dev/null +++ b/big5-hkscs-update.patch.bz2 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f397e09eec2ac12228659cd1b86ff93b501934bcedda6ca8e20557954694f21a +size 358200 diff --git a/digits-dots.patch b/digits-dots.patch new file mode 100644 index 0000000..033c914 --- /dev/null +++ b/digits-dots.patch @@ -0,0 +1,191 @@ +From 57847d6ed77fe969cc598e47452c76278a69f7bd Mon Sep 17 00:00:00 2001 +From: Andreas Schwab +Date: Mon, 21 Jan 2013 17:41:28 +0100 +Subject: [PATCH] Fix parsing of numeric hosts in gethostbyname_r + + [BZ #15014] + * nss/getXXbyYY_r.c (INTERNAL (REENTRANT_NAME)) + [HANDLE_DIGITS_DOTS]: Set any_service when digits-dots parsing was + successful. + * nss/digits_dots.c (__nss_hostname_digits_dots): Remove + redundant variable declarations and reallocation of buffer when + parsing as IPv6 address. Always set NSS status when called from + reentrant functions. Use NETDB_INTERNAL instead of TRY_AGAIN when + buffer too small. Correct computation of needed size. +--- + nss/digits_dots.c | 73 +++++++++++++++---------------------------------------- + nss/getXXbyYY_r.c | 5 +++- + 2 files changed, 24 insertions(+), 54 deletions(-) + +diff --git a/nss/digits_dots.c b/nss/digits_dots.c +index 2b86295..e007ef4 100644 +--- a/nss/digits_dots.c ++++ b/nss/digits_dots.c +@@ -46,7 +46,10 @@ __nss_hostname_digits_dots (const char *name, struct hostent *resbuf, + { + if (h_errnop) + *h_errnop = NETDB_INTERNAL; +- *result = NULL; ++ if (buffer_size == NULL) ++ *status = NSS_STATUS_TRYAGAIN; ++ else ++ *result = NULL; + return -1; + } + +@@ -83,14 +86,16 @@ __nss_hostname_digits_dots (const char *name, struct hostent *resbuf, + } + + size_needed = (sizeof (*host_addr) +- + sizeof (*h_addr_ptrs) + strlen (name) + 1); ++ + sizeof (*h_addr_ptrs) ++ + sizeof (*h_alias_ptr) + strlen (name) + 1); + + if (buffer_size == NULL) + { + if (buflen < size_needed) + { ++ *status = NSS_STATUS_TRYAGAIN; + if (h_errnop != NULL) +- *h_errnop = TRY_AGAIN; ++ *h_errnop = NETDB_INTERNAL; + __set_errno (ERANGE); + goto done; + } +@@ -109,7 +114,7 @@ __nss_hostname_digits_dots (const char *name, struct hostent *resbuf, + *buffer_size = 0; + __set_errno (save); + if (h_errnop != NULL) +- *h_errnop = TRY_AGAIN; ++ *h_errnop = NETDB_INTERNAL; + *result = NULL; + goto done; + } +@@ -149,7 +154,9 @@ __nss_hostname_digits_dots (const char *name, struct hostent *resbuf, + if (! ok) + { + *h_errnop = HOST_NOT_FOUND; +- if (buffer_size) ++ if (buffer_size == NULL) ++ *status = NSS_STATUS_NOTFOUND; ++ else + *result = NULL; + goto done; + } +@@ -190,7 +197,7 @@ __nss_hostname_digits_dots (const char *name, struct hostent *resbuf, + if (buffer_size == NULL) + *status = NSS_STATUS_SUCCESS; + else +- *result = resbuf; ++ *result = resbuf; + goto done; + } + +@@ -201,15 +208,6 @@ __nss_hostname_digits_dots (const char *name, struct hostent *resbuf, + + if ((isxdigit (name[0]) && strchr (name, ':') != NULL) || name[0] == ':') + { +- const char *cp; +- char *hostname; +- typedef unsigned char host_addr_t[16]; +- host_addr_t *host_addr; +- typedef char *host_addr_list_t[2]; +- host_addr_list_t *h_addr_ptrs; +- size_t size_needed; +- int addr_size; +- + switch (af) + { + default: +@@ -225,7 +223,10 @@ __nss_hostname_digits_dots (const char *name, struct hostent *resbuf, + /* This is not possible. We cannot represent an IPv6 address + in an `struct in_addr' variable. */ + *h_errnop = HOST_NOT_FOUND; +- *result = NULL; ++ if (buffer_size == NULL) ++ *status = NSS_STATUS_NOTFOUND; ++ else ++ *result = NULL; + goto done; + + case AF_INET6: +@@ -233,42 +234,6 @@ __nss_hostname_digits_dots (const char *name, struct hostent *resbuf, + break; + } + +- size_needed = (sizeof (*host_addr) +- + sizeof (*h_addr_ptrs) + strlen (name) + 1); +- +- if (buffer_size == NULL && buflen < size_needed) +- { +- if (h_errnop != NULL) +- *h_errnop = TRY_AGAIN; +- __set_errno (ERANGE); +- goto done; +- } +- else if (buffer_size != NULL && *buffer_size < size_needed) +- { +- char *new_buf; +- *buffer_size = size_needed; +- new_buf = realloc (*buffer, *buffer_size); +- +- if (new_buf == NULL) +- { +- save = errno; +- free (*buffer); +- __set_errno (save); +- *buffer = NULL; +- *buffer_size = 0; +- *result = NULL; +- goto done; +- } +- *buffer = new_buf; +- } +- +- memset (*buffer, '\0', size_needed); +- +- host_addr = (host_addr_t *) *buffer; +- h_addr_ptrs = (host_addr_list_t *) +- ((char *) host_addr + sizeof (*host_addr)); +- hostname = (char *) h_addr_ptrs + sizeof (*h_addr_ptrs); +- + for (cp = name;; ++cp) + { + if (!*cp) +@@ -281,7 +246,9 @@ __nss_hostname_digits_dots (const char *name, struct hostent *resbuf, + if (inet_pton (AF_INET6, name, host_addr) <= 0) + { + *h_errnop = HOST_NOT_FOUND; +- if (buffer_size) ++ if (buffer_size == NULL) ++ *status = NSS_STATUS_NOTFOUND; ++ else + *result = NULL; + goto done; + } +diff --git a/nss/getXXbyYY_r.c b/nss/getXXbyYY_r.c +index 1067744..44d00f4 100644 +--- a/nss/getXXbyYY_r.c ++++ b/nss/getXXbyYY_r.c +@@ -179,6 +179,9 @@ INTERNAL (REENTRANT_NAME) (ADD_PARAMS, LOOKUP_TYPE *resbuf, char *buffer, + case -1: + return errno; + case 1: ++#ifdef NEED_H_ERRNO ++ any_service = true; ++#endif + goto done; + } + #endif +@@ -288,7 +291,7 @@ done: + /* Either we failed to lookup the functions or the functions themselves + had a system error. Set NETDB_INTERNAL here to let the caller know + that the errno may have the real reason for failure. */ +- *h_errnop = NETDB_INTERNAL; ++ *h_errnop = NETDB_INTERNAL; + else if (status != NSS_STATUS_SUCCESS && !any_service) + /* We were not able to use any service. */ + *h_errnop = NO_RECOVERY; +-- +1.8.2.3 + diff --git a/getaddrinfo-overflow.patch b/getaddrinfo-overflow.patch new file mode 100644 index 0000000..e2ae9e6 --- /dev/null +++ b/getaddrinfo-overflow.patch @@ -0,0 +1,62 @@ +From 1cef1b19089528db11f221e938f60b9b048945d7 Mon Sep 17 00:00:00 2001 +From: Andreas Schwab +Date: Thu, 21 Mar 2013 15:50:27 +0100 +Subject: [PATCH] Fix stack overflow in getaddrinfo with many results + + [BZ #15330] + * sysdeps/posix/getaddrinfo.c (getaddrinfo): Allocate results and + order arrays from heap if bigger than alloca cutoff. + +--- + ChangeLog | 6 ++++++ + NEWS | 5 ++++- + sysdeps/posix/getaddrinfo.c | 23 +++++++++++++++++++++-- + 3 files changed, 31 insertions(+), 3 deletions(-) + +diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c +index d95c2d1..2309281 100644 +--- a/sysdeps/posix/getaddrinfo.c ++++ b/sysdeps/posix/getaddrinfo.c +@@ -2489,11 +2489,27 @@ getaddrinfo (const char *name, const char *service, + __typeof (once) old_once = once; + __libc_once (once, gaiconf_init); + /* Sort results according to RFC 3484. */ +- struct sort_result results[nresults]; +- size_t order[nresults]; ++ struct sort_result *results; ++ size_t *order; + struct addrinfo *q; + struct addrinfo *last = NULL; + char *canonname = NULL; ++ bool malloc_results; ++ ++ malloc_results ++ = !__libc_use_alloca (nresults * (sizeof (*results) + sizeof (size_t))); ++ if (malloc_results) ++ { ++ results = malloc (nresults * (sizeof (*results) + sizeof (size_t))); ++ if (results == NULL) ++ { ++ __free_in6ai (in6ai); ++ return EAI_MEMORY; ++ } ++ } ++ else ++ results = alloca (nresults * (sizeof (*results) + sizeof (size_t))); ++ order = (size_t *) (results + nresults); + + /* Now we definitely need the interface information. */ + if (! check_pf_called) +@@ -2664,6 +2680,9 @@ getaddrinfo (const char *name, const char *service, + + /* Fill in the canonical name into the new first entry. */ + p->ai_canonname = canonname; ++ ++ if (malloc_results) ++ free (results); + } + + __free_in6ai (in6ai); +-- +1.8.2.3 + diff --git a/glibc-aarch64-lib64.patch b/glibc-aarch64-lib64.patch index 836a9b0..f5fe3d2 100644 --- a/glibc-aarch64-lib64.patch +++ b/glibc-aarch64-lib64.patch @@ -1,21 +1,24 @@ +libc:cbc105f8b590fa5f5343160ef0a33dde6366c427 + +2013-03-14 Andreas Schwab + + * sysdeps/unix/sysv/linux/aarch64/configure.in: Set + libc_cv_slibdir, libdir and libc_cv_localedir. + * sysdeps/unix/sysv/linux/aarch64/configure: Regenerate. + diff --git a/ports/sysdeps/unix/sysv/linux/aarch64/configure b/ports/sysdeps/unix/sysv/linux/aarch64/configure -index 5a22126..b806d27 100644 +index 5a22126..04b6c81 100644 --- a/ports/sysdeps/unix/sysv/linux/aarch64/configure +++ b/ports/sysdeps/unix/sysv/linux/aarch64/configure -@@ -1,3 +1,22 @@ +@@ -1,3 +1,16 @@ # This file is generated from configure.in by Autoconf. DO NOT EDIT! + # Local configure fragment for sysdeps/unix/sysv/linux/aarch64. arch_minimum_kernel=3.7.0 + ++test -n "$libc_cv_slibdir" || +case "$prefix" in -+/usr | /usr/) -+ # 64-bit libraries on bi-arch platforms go in /lib64 instead of /lib. -+ # Allow earlier configure scripts to handle libc_cv_slibdir, libdir, -+ # and libc_cv_localedir. -+ test -n "$libc_cv_slibdir" || -+ case $machine in -+ aarch64*) ++ /usr | /usr/) + libc_cv_slibdir="/lib64" + if test "$libdir" = '${exec_prefix}/lib'; then + libdir='${exec_prefix}/lib64'; @@ -23,25 +26,19 @@ index 5a22126..b806d27 100644 + libc_cv_localedir='${exec_prefix}/lib/locale' + fi + ;; -+ esac +esac diff --git a/ports/sysdeps/unix/sysv/linux/aarch64/configure.in b/ports/sysdeps/unix/sysv/linux/aarch64/configure.in -index d1995d4..e93fb3a 100644 +index d1995d4..6596a15 100644 --- a/ports/sysdeps/unix/sysv/linux/aarch64/configure.in +++ b/ports/sysdeps/unix/sysv/linux/aarch64/configure.in -@@ -2,3 +2,21 @@ GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory. +@@ -2,3 +2,15 @@ GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory. # Local configure fragment for sysdeps/unix/sysv/linux/aarch64. arch_minimum_kernel=3.7.0 + ++test -n "$libc_cv_slibdir" || +case "$prefix" in -+/usr | /usr/) -+ # 64-bit libraries on bi-arch platforms go in /lib64 instead of /lib. -+ # Allow earlier configure scripts to handle libc_cv_slibdir, libdir, -+ # and libc_cv_localedir. -+ test -n "$libc_cv_slibdir" || -+ case $machine in -+ aarch64*) ++ /usr | /usr/) + libc_cv_slibdir="/lib64" + if test "$libdir" = '${exec_prefix}/lib'; then + libdir='${exec_prefix}/lib64'; @@ -49,5 +46,4 @@ index d1995d4..e93fb3a 100644 + libc_cv_localedir='${exec_prefix}/lib/locale' + fi + ;; -+ esac +esac diff --git a/glibc-testsuite.changes b/glibc-testsuite.changes index 39f7861..682a968 100644 --- a/glibc-testsuite.changes +++ b/glibc-testsuite.changes @@ -1,3 +1,21 @@ +------------------------------------------------------------------- +Thu May 16 12:02:14 UTC 2013 - schwab@suse.de + +- big5-hkscs-update.patch.bz2: Update BIG5-HKSCS charmap to HKSCS-2008 +- digits-dots.patch: Fix parsing of numeric hosts in gethostbyname_r +- nss-database.patch: Properly cache the result from looking up the nss + database config +- strptime-W-week.patch: Properly handle %W in strptime +- printf-overrun.patch: Revert problematic fixes for [BZ #11741] +- glibc-aarch64-lib64.patch: Replace with upstream version +- arm-ld-so-cache.patch: ARM: Support loading unmarked objects from cache +- rtlddir.patch: Add support for rtld directory different from slib + directory +- regexp-overrun.patch: Fix buffer overrun in regexp matcher + (CVE-2013-0242, bnc#801246) +- getaddrinfo-overflow.patch: Fix stack overflow in getaddrinfo with many + results (CVE-2013-1914, bnc#813121) + ------------------------------------------------------------------- Thu May 16 10:04:01 UTC 2013 - schwab@suse.de diff --git a/glibc-testsuite.spec b/glibc-testsuite.spec index 507f038..c34c8fe 100644 --- a/glibc-testsuite.spec +++ b/glibc-testsuite.spec @@ -245,18 +245,36 @@ Patch306: glibc-fix-double-loopback.diff ### # Patches from upstream ### +# PATCH-FIX-UPSTREAM Extend i486 pthread_cond_timedwait to use futex syscall with absolute timeout +Patch1000: pthread-cond-timedwait-i486.patch +# PATCH-FIX-UPSTREAM Use lib64 for aarch64 +Patch1001: glibc-aarch64-lib64.patch +# PATCH-FIX-UPSTREAM ARM: Support loading unmarked objects from cache +Patch1002: arm-ld-so-cache.patch +# PATCH-FIX-UPSTREAM Add support for rtld directory different from slib directory +Patch1003: rtlddir.patch +# PATCH-FIX-UPSTREAM Fix buffer overrun in regexp matcher +Patch1004: regexp-overrun.patch +# PATCH-FIX-UPSTREAM Fix stack overflow in getaddrinfo with many results +Patch1005: getaddrinfo-overflow.patch ### # Patches awaiting upstream approval ### # PATCH-FIX-OPENSUSE Fix LD_PROFILE (glibc bug#13818) - aj@suse.de Patch2008: glibc-ld-profile.patch -# PATCH-FIX-OPENSUSE Extend i486 pthread_cond_timedwait to use futex syscall with absolute timeout -Patch2009: pthread-cond-timedwait-i486.patch # PATCH-FIX-OPENSUSE Properly check for short writes when sending the response in nscd Patch2010: nscd-short-write.patch -# PATCH-FIX-OPENSUSE Use lib64 for aarch64 -Patch2011: glibc-aarch64-lib64.patch +# PATCH-FIX-OPENSUSE Update BIG5-HKSCS charmap to HKSCS-2008 +Patch2011: big5-hkscs-update.patch.bz2 +# PATCH-FIX-OPENSUSE Fix parsing of numeric hosts in gethostbyname_r +Patch2012: digits-dots.patch +# PATCH-FIX-OPENSUSE Properly cache the result from looking up the nss database config +Patch2013: nss-database.patch +# PATCH-FIX-OPENSUSE Properly handle %W in strptime +Patch2014: strptime-W-week.patch +# PATCH-FIX-OPENSUSE Revert problematic fixes for [BZ #11741] +Patch2015: printf-overrun.patch # Non-glibc patches # PATCH-FIX-OPENSUSE Remove debianisms from manpages @@ -463,11 +481,21 @@ rm nscd/s-stamp %patch20 -p1 %endif +%patch1000 -p1 +%patch1001 -p1 +%patch1002 -p1 +%patch1003 -p1 +%patch1004 -p1 +%patch1005 -p1 + # XXX Disable, it breaks the testsuite, test elf/tst-audit2 # %patch2008 -p1 -%patch2009 -p1 %patch2010 -p1 %patch2011 -p1 +%patch2012 -p1 +%patch2013 -p1 +%patch2014 -p1 +%patch2015 -p1 %patch3000 @@ -829,16 +857,6 @@ mkdir -p %{buildroot}/%{_lib}/obsolete # the generic one (RH#162634) cp -av bits/stdio-lock.h %{buildroot}%{_includedir}/bits/stdio-lock.h -%ifarch s390x - # s390x is different ... - mkdir %{buildroot}/lib - ln -sf ../%{_lib}/ld-%{glibc_major_version}.so %{buildroot}/lib/ld64.so.1 -%endif -%ifarch aarch64 -mkdir %{buildroot}/lib -ln -sf ../%{_lib}/ld-%{glibc_major_version}.so %{buildroot}/lib/ld-linux-aarch64.so.1 -%endif - # Miscelanna: install -m 0700 glibc_post_upgrade %{buildroot}%{_sbindir} diff --git a/glibc-utils.changes b/glibc-utils.changes index 39f7861..682a968 100644 --- a/glibc-utils.changes +++ b/glibc-utils.changes @@ -1,3 +1,21 @@ +------------------------------------------------------------------- +Thu May 16 12:02:14 UTC 2013 - schwab@suse.de + +- big5-hkscs-update.patch.bz2: Update BIG5-HKSCS charmap to HKSCS-2008 +- digits-dots.patch: Fix parsing of numeric hosts in gethostbyname_r +- nss-database.patch: Properly cache the result from looking up the nss + database config +- strptime-W-week.patch: Properly handle %W in strptime +- printf-overrun.patch: Revert problematic fixes for [BZ #11741] +- glibc-aarch64-lib64.patch: Replace with upstream version +- arm-ld-so-cache.patch: ARM: Support loading unmarked objects from cache +- rtlddir.patch: Add support for rtld directory different from slib + directory +- regexp-overrun.patch: Fix buffer overrun in regexp matcher + (CVE-2013-0242, bnc#801246) +- getaddrinfo-overflow.patch: Fix stack overflow in getaddrinfo with many + results (CVE-2013-1914, bnc#813121) + ------------------------------------------------------------------- Thu May 16 10:04:01 UTC 2013 - schwab@suse.de diff --git a/glibc-utils.spec b/glibc-utils.spec index 3e1bdf3..57f475c 100644 --- a/glibc-utils.spec +++ b/glibc-utils.spec @@ -244,18 +244,36 @@ Patch306: glibc-fix-double-loopback.diff ### # Patches from upstream ### +# PATCH-FIX-UPSTREAM Extend i486 pthread_cond_timedwait to use futex syscall with absolute timeout +Patch1000: pthread-cond-timedwait-i486.patch +# PATCH-FIX-UPSTREAM Use lib64 for aarch64 +Patch1001: glibc-aarch64-lib64.patch +# PATCH-FIX-UPSTREAM ARM: Support loading unmarked objects from cache +Patch1002: arm-ld-so-cache.patch +# PATCH-FIX-UPSTREAM Add support for rtld directory different from slib directory +Patch1003: rtlddir.patch +# PATCH-FIX-UPSTREAM Fix buffer overrun in regexp matcher +Patch1004: regexp-overrun.patch +# PATCH-FIX-UPSTREAM Fix stack overflow in getaddrinfo with many results +Patch1005: getaddrinfo-overflow.patch ### # Patches awaiting upstream approval ### # PATCH-FIX-OPENSUSE Fix LD_PROFILE (glibc bug#13818) - aj@suse.de Patch2008: glibc-ld-profile.patch -# PATCH-FIX-OPENSUSE Extend i486 pthread_cond_timedwait to use futex syscall with absolute timeout -Patch2009: pthread-cond-timedwait-i486.patch # PATCH-FIX-OPENSUSE Properly check for short writes when sending the response in nscd Patch2010: nscd-short-write.patch -# PATCH-FIX-OPENSUSE Use lib64 for aarch64 -Patch2011: glibc-aarch64-lib64.patch +# PATCH-FIX-OPENSUSE Update BIG5-HKSCS charmap to HKSCS-2008 +Patch2011: big5-hkscs-update.patch.bz2 +# PATCH-FIX-OPENSUSE Fix parsing of numeric hosts in gethostbyname_r +Patch2012: digits-dots.patch +# PATCH-FIX-OPENSUSE Properly cache the result from looking up the nss database config +Patch2013: nss-database.patch +# PATCH-FIX-OPENSUSE Properly handle %W in strptime +Patch2014: strptime-W-week.patch +# PATCH-FIX-OPENSUSE Revert problematic fixes for [BZ #11741] +Patch2015: printf-overrun.patch # Non-glibc patches # PATCH-FIX-OPENSUSE Remove debianisms from manpages @@ -463,11 +481,21 @@ rm nscd/s-stamp %patch20 -p1 %endif +%patch1000 -p1 +%patch1001 -p1 +%patch1002 -p1 +%patch1003 -p1 +%patch1004 -p1 +%patch1005 -p1 + # XXX Disable, it breaks the testsuite, test elf/tst-audit2 # %patch2008 -p1 -%patch2009 -p1 %patch2010 -p1 %patch2011 -p1 +%patch2012 -p1 +%patch2013 -p1 +%patch2014 -p1 +%patch2015 -p1 %patch3000 @@ -829,16 +857,6 @@ mkdir -p %{buildroot}/%{_lib}/obsolete # the generic one (RH#162634) cp -av bits/stdio-lock.h %{buildroot}%{_includedir}/bits/stdio-lock.h -%ifarch s390x - # s390x is different ... - mkdir %{buildroot}/lib - ln -sf ../%{_lib}/ld-%{glibc_major_version}.so %{buildroot}/lib/ld64.so.1 -%endif -%ifarch aarch64 -mkdir %{buildroot}/lib -ln -sf ../%{_lib}/ld-%{glibc_major_version}.so %{buildroot}/lib/ld-linux-aarch64.so.1 -%endif - # Miscelanna: install -m 0700 glibc_post_upgrade %{buildroot}%{_sbindir} diff --git a/glibc.changes b/glibc.changes index 39f7861..682a968 100644 --- a/glibc.changes +++ b/glibc.changes @@ -1,3 +1,21 @@ +------------------------------------------------------------------- +Thu May 16 12:02:14 UTC 2013 - schwab@suse.de + +- big5-hkscs-update.patch.bz2: Update BIG5-HKSCS charmap to HKSCS-2008 +- digits-dots.patch: Fix parsing of numeric hosts in gethostbyname_r +- nss-database.patch: Properly cache the result from looking up the nss + database config +- strptime-W-week.patch: Properly handle %W in strptime +- printf-overrun.patch: Revert problematic fixes for [BZ #11741] +- glibc-aarch64-lib64.patch: Replace with upstream version +- arm-ld-so-cache.patch: ARM: Support loading unmarked objects from cache +- rtlddir.patch: Add support for rtld directory different from slib + directory +- regexp-overrun.patch: Fix buffer overrun in regexp matcher + (CVE-2013-0242, bnc#801246) +- getaddrinfo-overflow.patch: Fix stack overflow in getaddrinfo with many + results (CVE-2013-1914, bnc#813121) + ------------------------------------------------------------------- Thu May 16 10:04:01 UTC 2013 - schwab@suse.de diff --git a/glibc.spec b/glibc.spec index e6c7d18..6de652b 100644 --- a/glibc.spec +++ b/glibc.spec @@ -245,18 +245,36 @@ Patch306: glibc-fix-double-loopback.diff ### # Patches from upstream ### +# PATCH-FIX-UPSTREAM Extend i486 pthread_cond_timedwait to use futex syscall with absolute timeout +Patch1000: pthread-cond-timedwait-i486.patch +# PATCH-FIX-UPSTREAM Use lib64 for aarch64 +Patch1001: glibc-aarch64-lib64.patch +# PATCH-FIX-UPSTREAM ARM: Support loading unmarked objects from cache +Patch1002: arm-ld-so-cache.patch +# PATCH-FIX-UPSTREAM Add support for rtld directory different from slib directory +Patch1003: rtlddir.patch +# PATCH-FIX-UPSTREAM Fix buffer overrun in regexp matcher +Patch1004: regexp-overrun.patch +# PATCH-FIX-UPSTREAM Fix stack overflow in getaddrinfo with many results +Patch1005: getaddrinfo-overflow.patch ### # Patches awaiting upstream approval ### # PATCH-FIX-OPENSUSE Fix LD_PROFILE (glibc bug#13818) - aj@suse.de Patch2008: glibc-ld-profile.patch -# PATCH-FIX-OPENSUSE Extend i486 pthread_cond_timedwait to use futex syscall with absolute timeout -Patch2009: pthread-cond-timedwait-i486.patch # PATCH-FIX-OPENSUSE Properly check for short writes when sending the response in nscd Patch2010: nscd-short-write.patch -# PATCH-FIX-OPENSUSE Use lib64 for aarch64 -Patch2011: glibc-aarch64-lib64.patch +# PATCH-FIX-OPENSUSE Update BIG5-HKSCS charmap to HKSCS-2008 +Patch2011: big5-hkscs-update.patch.bz2 +# PATCH-FIX-OPENSUSE Fix parsing of numeric hosts in gethostbyname_r +Patch2012: digits-dots.patch +# PATCH-FIX-OPENSUSE Properly cache the result from looking up the nss database config +Patch2013: nss-database.patch +# PATCH-FIX-OPENSUSE Properly handle %W in strptime +Patch2014: strptime-W-week.patch +# PATCH-FIX-OPENSUSE Revert problematic fixes for [BZ #11741] +Patch2015: printf-overrun.patch # Non-glibc patches # PATCH-FIX-OPENSUSE Remove debianisms from manpages @@ -463,11 +481,21 @@ rm nscd/s-stamp %patch20 -p1 %endif +%patch1000 -p1 +%patch1001 -p1 +%patch1002 -p1 +%patch1003 -p1 +%patch1004 -p1 +%patch1005 -p1 + # XXX Disable, it breaks the testsuite, test elf/tst-audit2 # %patch2008 -p1 -%patch2009 -p1 %patch2010 -p1 %patch2011 -p1 +%patch2012 -p1 +%patch2013 -p1 +%patch2014 -p1 +%patch2015 -p1 %patch3000 @@ -829,16 +857,6 @@ mkdir -p %{buildroot}/%{_lib}/obsolete # the generic one (RH#162634) cp -av bits/stdio-lock.h %{buildroot}%{_includedir}/bits/stdio-lock.h -%ifarch s390x - # s390x is different ... - mkdir %{buildroot}/lib - ln -sf ../%{_lib}/ld-%{glibc_major_version}.so %{buildroot}/lib/ld64.so.1 -%endif -%ifarch aarch64 -mkdir %{buildroot}/lib -ln -sf ../%{_lib}/ld-%{glibc_major_version}.so %{buildroot}/lib/ld-linux-aarch64.so.1 -%endif - # Miscelanna: install -m 0700 glibc_post_upgrade %{buildroot}%{_sbindir} diff --git a/nss-database.patch b/nss-database.patch new file mode 100644 index 0000000..bc51781 --- /dev/null +++ b/nss-database.patch @@ -0,0 +1,115 @@ +From a6856a042a0669ac3f8bc675e8e1de14b5d09b94 Mon Sep 17 00:00:00 2001 +From: Andreas Schwab +Date: Thu, 24 Jan 2013 12:32:09 +0100 +Subject: [PATCH] Properly cache the result from looking up the nss database + config + + [BZ #15048] + * nscd/aicache.c (addhstaiX): Properly use the cache variable for + the nss database lookup. + * nscd/initgrcache.c (addinitgroupsX): Likewise. + * sysdeps/posix/getaddrinfo.c (gaih_inet): Likewise. +--- + nscd/aicache.c | 15 +++++++-------- + nscd/initgrcache.c | 15 +++++++-------- + sysdeps/posix/getaddrinfo.c | 14 ++++++-------- + 3 files changed, 20 insertions(+), 24 deletions(-) + +diff --git a/nscd/aicache.c b/nscd/aicache.c +index 23dcf80..17e06e7 100644 +--- a/nscd/aicache.c ++++ b/nscd/aicache.c +@@ -85,20 +85,19 @@ addhstaiX (struct database_dyn *db, int fd, request_header *req, + } + + static service_user *hosts_database; +- service_user *nip = NULL; ++ service_user *nip; + int no_more; + int rc6 = 0; + int rc4 = 0; + int herrno = 0; + +- if (hosts_database != NULL) +- { +- nip = hosts_database; +- no_more = 0; +- } +- else ++ if (hosts_database == NULL) + no_more = __nss_database_lookup ("hosts", NULL, +- "dns [!UNAVAIL=return] files", &nip); ++ "dns [!UNAVAIL=return] files", ++ &hosts_database); ++ else ++ no_more = 0; ++ nip = hosts_database; + + if (__res_maybe_init (&_res, 0) == -1) + no_more = 1; +diff --git a/nscd/initgrcache.c b/nscd/initgrcache.c +index 462780e..4580884 100644 +--- a/nscd/initgrcache.c ++++ b/nscd/initgrcache.c +@@ -80,17 +80,16 @@ addinitgroupsX (struct database_dyn *db, int fd, request_header *req, + } + + static service_user *group_database; +- service_user *nip = NULL; ++ service_user *nip; + int no_more; + +- if (group_database != NULL) +- { +- nip = group_database; +- no_more = 0; +- } +- else ++ if (group_database == NULL) + no_more = __nss_database_lookup ("group", NULL, +- "compat [NOTFOUND=return] files", &nip); ++ "compat [NOTFOUND=return] files", ++ &group_database); ++ else ++ no_more = 0; ++ nip = group_database; + + /* We always use sysconf even if NGROUPS_MAX is defined. That way, the + limit can be raised in the kernel configuration without having to +diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c +index d368306..4800599 100644 +--- a/sysdeps/posix/getaddrinfo.c ++++ b/sysdeps/posix/getaddrinfo.c +@@ -557,7 +557,7 @@ gaih_inet (const char *name, const struct gaih_service *service, + struct gaih_addrtuple **pat = &at; + int no_data = 0; + int no_inet6_data = 0; +- service_user *nip = NULL; ++ service_user *nip; + enum nss_status inet6_status = NSS_STATUS_UNAVAIL; + enum nss_status status = NSS_STATUS_UNAVAIL; + int no_more; +@@ -790,15 +790,13 @@ gaih_inet (const char *name, const struct gaih_service *service, + } + #endif + +- if (__nss_hosts_database != NULL) +- { +- no_more = 0; +- nip = __nss_hosts_database; +- } +- else ++ if (__nss_hosts_database == NULL) + no_more = __nss_database_lookup ("hosts", NULL, + "dns [!UNAVAIL=return] files", +- &nip); ++ &__nss_hosts_database); ++ else ++ no_more = 0; ++ nip = __nss_hosts_database; + + /* Initialize configurations. */ + if (__builtin_expect (!_res_hconf.initialized, 0)) +-- +1.8.2.3 + diff --git a/printf-overrun.patch b/printf-overrun.patch new file mode 100644 index 0000000..211c909 --- /dev/null +++ b/printf-overrun.patch @@ -0,0 +1,179 @@ +From 1aa92494e55792b568663b5aad81a58fad35490d Mon Sep 17 00:00:00 2001 +From: Eric Biggers +Date: Thu, 18 Apr 2013 17:46:08 +0200 +Subject: [PATCH] PR15362 + + [BZ #15362] + * libio/fileops.c: Revert problematic fixes for [BZ #11741] + * libio/iofwrite.c: Likewise. + * libio/iofwrite_u.c: Likewise. + * libio/iopadn.c: Likewise. + * libio/iowpadn.c: Likewise. + * stdio-common/vfprintf.c: Fix [BZ #11741] properly by checking whether + _IO_padn() returned the full count written. +--- + libio/fileops.c | 21 +++++++++------------ + libio/iofwrite.c | 10 +++++----- + libio/iofwrite_u.c | 10 +++++----- + libio/iopadn.c | 2 +- + libio/iowpadn.c | 2 +- + stdio-common/vfprintf.c | 12 ++++++------ + 6 files changed, 27 insertions(+), 30 deletions(-) + +diff --git a/libio/fileops.c b/libio/fileops.c +index 61b61b3..90d5e88 100644 +--- a/libio/fileops.c ++++ b/libio/fileops.c +@@ -1245,13 +1245,12 @@ _IO_new_file_write (f, data, n) + _IO_ssize_t n; + { + _IO_ssize_t to_do = n; +- _IO_ssize_t count = 0; + while (to_do > 0) + { +- count = (__builtin_expect (f->_flags2 +- & _IO_FLAGS2_NOTCANCEL, 0) +- ? write_not_cancel (f->_fileno, data, to_do) +- : write (f->_fileno, data, to_do)); ++ _IO_ssize_t count = (__builtin_expect (f->_flags2 ++ & _IO_FLAGS2_NOTCANCEL, 0) ++ ? write_not_cancel (f->_fileno, data, to_do) ++ : write (f->_fileno, data, to_do)); + if (count < 0) + { + f->_flags |= _IO_ERR_SEEN; +@@ -1263,7 +1262,7 @@ _IO_new_file_write (f, data, n) + n -= to_do; + if (f->_offset >= 0) + f->_offset += n; +- return count < 0 ? count : n; ++ return n; + } + + _IO_size_t +@@ -1323,13 +1322,11 @@ _IO_new_file_xsputn (f, data, n) + _IO_size_t block_size, do_write; + /* Next flush the (full) buffer. */ + if (_IO_OVERFLOW (f, EOF) == EOF) +- /* If nothing else has to be written or nothing has been written, we +- must not signal the caller that the call was even partially +- successful. */ +- return (to_do == 0 || to_do == n) ? EOF : n - to_do; ++ /* If nothing else has to be written we must not signal the ++ caller that everything has been written. */ ++ return to_do == 0 ? EOF : n - to_do; + +- /* Try to maintain alignment: write a whole number of blocks. +- dont_write is what gets left over. */ ++ /* Try to maintain alignment: write a whole number of blocks. */ + block_size = f->_IO_buf_end - f->_IO_buf_base; + do_write = to_do - (block_size >= 128 ? to_do % block_size : 0); + +diff --git a/libio/iofwrite.c b/libio/iofwrite.c +index 81596a6..66542ea 100644 +--- a/libio/iofwrite.c ++++ b/libio/iofwrite.c +@@ -42,12 +42,12 @@ _IO_fwrite (buf, size, count, fp) + if (_IO_vtable_offset (fp) != 0 || _IO_fwide (fp, -1) == -1) + written = _IO_sputn (fp, (const char *) buf, request); + _IO_release_lock (fp); +- /* We are guaranteed to have written all of the input, none of it, or +- some of it. */ +- if (written == request) ++ /* We have written all of the input in case the return value indicates ++ this or EOF is returned. The latter is a special case where we ++ simply did not manage to flush the buffer. But the data is in the ++ buffer and therefore written as far as fwrite is concerned. */ ++ if (written == request || written == EOF) + return count; +- else if (written == EOF) +- return 0; + else + return written / size; + } +diff --git a/libio/iofwrite_u.c b/libio/iofwrite_u.c +index 4a9d6ca..18dc6d0 100644 +--- a/libio/iofwrite_u.c ++++ b/libio/iofwrite_u.c +@@ -44,12 +44,12 @@ fwrite_unlocked (buf, size, count, fp) + if (_IO_fwide (fp, -1) == -1) + { + written = _IO_sputn (fp, (const char *) buf, request); +- /* We are guaranteed to have written all of the input, none of it, or +- some of it. */ +- if (written == request) ++ /* We have written all of the input in case the return value indicates ++ this or EOF is returned. The latter is a special case where we ++ simply did not manage to flush the buffer. But the data is in the ++ buffer and therefore written as far as fwrite is concerned. */ ++ if (written == request || written == EOF) + return count; +- else if (written == EOF) +- return 0; + } + + return written / size; +diff --git a/libio/iopadn.c b/libio/iopadn.c +index cc93c0f..5ebbcf4 100644 +--- a/libio/iopadn.c ++++ b/libio/iopadn.c +@@ -59,7 +59,7 @@ _IO_padn (fp, pad, count) + w = _IO_sputn (fp, padptr, PADSIZE); + written += w; + if (w != PADSIZE) +- return w == EOF ? w : written; ++ return written; + } + + if (i > 0) +diff --git a/libio/iowpadn.c b/libio/iowpadn.c +index d94db71..5600f37 100644 +--- a/libio/iowpadn.c ++++ b/libio/iowpadn.c +@@ -65,7 +65,7 @@ _IO_wpadn (fp, pad, count) + w = _IO_sputn (fp, (char *) padptr, PADSIZE); + written += w; + if (w != PADSIZE) +- return w == EOF ? w : written; ++ return written; + } + + if (i > 0) +diff --git a/stdio-common/vfprintf.c b/stdio-common/vfprintf.c +index c8bcf5a..61d9dc2 100644 +--- a/stdio-common/vfprintf.c ++++ b/stdio-common/vfprintf.c +@@ -90,13 +90,13 @@ + do { \ + if (width > 0) \ + { \ +- unsigned int d = _IO_padn (s, (Padchar), width); \ +- if (__builtin_expect (d == EOF, 0)) \ ++ _IO_ssize_t written = _IO_padn (s, (Padchar), width); \ ++ if (__builtin_expect (written != width, 0)) \ + { \ + done = -1; \ + goto all_done; \ + } \ +- done_add (d); \ ++ done_add (written); \ + } \ + } while (0) + # define PUTC(C, F) _IO_putc_unlocked (C, F) +@@ -119,13 +119,13 @@ + do { \ + if (width > 0) \ + { \ +- unsigned int d = _IO_wpadn (s, (Padchar), width); \ +- if (__builtin_expect (d == EOF, 0)) \ ++ _IO_ssize_t written = _IO_wpadn (s, (Padchar), width); \ ++ if (__builtin_expect (written != width, 0)) \ + { \ + done = -1; \ + goto all_done; \ + } \ +- done_add (d); \ ++ done_add (written); \ + } \ + } while (0) + # define PUTC(C, F) _IO_putwc_unlocked (C, F) diff --git a/regexp-overrun.patch b/regexp-overrun.patch new file mode 100644 index 0000000..8685e8a --- /dev/null +++ b/regexp-overrun.patch @@ -0,0 +1,161 @@ +From a445af0bc722d620afed7683cd320c0e4c7c6059 Mon Sep 17 00:00:00 2001 +From: Andreas Schwab +Date: Tue, 29 Jan 2013 14:45:15 +0100 +Subject: [PATCH] Fix buffer overrun in regexp matcher + + [BZ #15078] + * posix/regexec.c (extend_buffers): Add parameter min_len. + (check_matching): Pass minimum needed length. + (clean_state_log_if_needed): Likewise. + (get_subexp): Likewise. + * posix/Makefile (tests): Add bug-regex34. + (bug-regex34-ENV): Define. + * posix/bug-regex34.c: New file. + +--- + ChangeLog | 9 +++++++++ + NEWS | 3 ++- + posix/Makefile | 3 ++- + posix/bug-regex34.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++ + posix/regexec.c | 16 +++++++++------- + 5 files changed, 68 insertions(+), 9 deletions(-) + create mode 100644 posix/bug-regex34.c + +diff --git a/posix/Makefile b/posix/Makefile +index 88d409f..2cacd21 100644 +--- a/posix/Makefile ++++ b/posix/Makefile +@@ -86,7 +86,7 @@ tests := tstgetopt testfnm runtests runptests \ + tst-rfc3484-3 \ + tst-getaddrinfo3 tst-fnmatch2 tst-cpucount tst-cpuset \ + bug-getopt1 bug-getopt2 bug-getopt3 bug-getopt4 \ +- bug-getopt5 tst-getopt_long1 ++ bug-getopt5 tst-getopt_long1 bug-regex34 + xtests := bug-ga2 + ifeq (yes,$(build-shared)) + test-srcs := globtest +@@ -199,6 +199,7 @@ bug-regex26-ENV = LOCPATH=$(common-objpfx)localedata + bug-regex30-ENV = LOCPATH=$(common-objpfx)localedata + bug-regex32-ENV = LOCPATH=$(common-objpfx)localedata + bug-regex33-ENV = LOCPATH=$(common-objpfx)localedata ++bug-regex34-ENV = LOCPATH=$(common-objpfx)localedata + tst-rxspencer-ARGS = --utf8 rxspencer/tests + tst-rxspencer-ENV = LOCPATH=$(common-objpfx)localedata + tst-pcre-ARGS = PCRE.tests +diff --git a/posix/bug-regex34.c b/posix/bug-regex34.c +new file mode 100644 +index 0000000..bb3b613 +--- /dev/null ++++ b/posix/bug-regex34.c +@@ -0,0 +1,46 @@ ++/* Test re_search with multi-byte characters in UTF-8. ++ Copyright (C) 2013 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 ++ . */ ++ ++#define _GNU_SOURCE 1 ++#include ++#include ++#include ++#include ++ ++static int ++do_test (void) ++{ ++ struct re_pattern_buffer r; ++ /* ကျွန်ုပ်x */ ++ const char *s = "\xe1\x80\x80\xe1\x80\xbb\xe1\x80\xbd\xe1\x80\x94\xe1\x80\xba\xe1\x80\xaf\xe1\x80\x95\xe1\x80\xbax"; ++ ++ if (setlocale (LC_ALL, "en_US.UTF-8") == NULL) ++ { ++ puts ("setlocale failed"); ++ return 1; ++ } ++ memset (&r, 0, sizeof (r)); ++ ++ re_compile_pattern ("[^x]x", 5, &r); ++ /* This was triggering a buffer overflow. */ ++ re_search (&r, s, strlen (s), 0, strlen (s), 0); ++ return 0; ++} ++ ++#define TEST_FUNCTION do_test () ++#include "../test-skeleton.c" +diff --git a/posix/regexec.c b/posix/regexec.c +index 7f2de85..5ca2bf6 100644 +--- a/posix/regexec.c ++++ b/posix/regexec.c +@@ -197,7 +197,7 @@ static int group_nodes_into_DFAstates (const re_dfa_t *dfa, + static int check_node_accept (const re_match_context_t *mctx, + const re_token_t *node, int idx) + internal_function; +-static reg_errcode_t extend_buffers (re_match_context_t *mctx) ++static reg_errcode_t extend_buffers (re_match_context_t *mctx, int min_len) + internal_function; + + /* Entry point for POSIX code. */ +@@ -1160,7 +1160,7 @@ check_matching (re_match_context_t *mctx, int fl_longest_match, + || (BE (next_char_idx >= mctx->input.valid_len, 0) + && mctx->input.valid_len < mctx->input.len)) + { +- err = extend_buffers (mctx); ++ err = extend_buffers (mctx, next_char_idx + 1); + if (BE (err != REG_NOERROR, 0)) + { + assert (err == REG_ESPACE); +@@ -1738,7 +1738,7 @@ clean_state_log_if_needed (re_match_context_t *mctx, int next_state_log_idx) + && mctx->input.valid_len < mctx->input.len)) + { + reg_errcode_t err; +- err = extend_buffers (mctx); ++ err = extend_buffers (mctx, next_state_log_idx + 1); + if (BE (err != REG_NOERROR, 0)) + return err; + } +@@ -2792,7 +2792,7 @@ get_subexp (re_match_context_t *mctx, int bkref_node, int bkref_str_idx) + if (bkref_str_off >= mctx->input.len) + break; + +- err = extend_buffers (mctx); ++ err = extend_buffers (mctx, bkref_str_off + 1); + if (BE (err != REG_NOERROR, 0)) + return err; + +@@ -4102,7 +4102,7 @@ check_node_accept (const re_match_context_t *mctx, const re_token_t *node, + + static reg_errcode_t + internal_function __attribute_warn_unused_result__ +-extend_buffers (re_match_context_t *mctx) ++extend_buffers (re_match_context_t *mctx, int min_len) + { + reg_errcode_t ret; + re_string_t *pstr = &mctx->input; +@@ -4111,8 +4111,10 @@ extend_buffers (re_match_context_t *mctx) + if (BE (INT_MAX / 2 / sizeof (re_dfastate_t *) <= pstr->bufs_len, 0)) + return REG_ESPACE; + +- /* Double the lengthes of the buffers. */ +- ret = re_string_realloc_buffers (pstr, MIN (pstr->len, pstr->bufs_len * 2)); ++ /* Double the lengthes of the buffers, but allocate at least MIN_LEN. */ ++ ret = re_string_realloc_buffers (pstr, ++ MAX (min_len, ++ MIN (pstr->len, pstr->bufs_len * 2))); + if (BE (ret != REG_NOERROR, 0)) + return ret; + +-- +1.8.2.3 + diff --git a/rtlddir.patch b/rtlddir.patch new file mode 100644 index 0000000..6831cf8 --- /dev/null +++ b/rtlddir.patch @@ -0,0 +1,288 @@ +From aaa8cb4b43511c62b11ac6f10e9beea3d5035a68 Mon Sep 17 00:00:00 2001 +From: Andreas Schwab +Date: Mon, 18 Mar 2013 12:44:47 +0100 +Subject: [PATCH 1/3] Add support for rtld directory different from slib + directory + + * configure.in: Substitute libc_cv_rtlddir. + * configure: Regenerate. + * config.make.in (rtlddir): Set from libc_cv_rtlddir. + * Makeconfig (rtlddir, inst_rtlddir): New variables. + (rtld-LDFLAGS): Use them with $(rtld-installed-name). + * elf/Makefile (install-others, CFLAGS-interp.c) + (ldso_install, common-ldd-rewrite): Likewise. + ($(inst_rtlddir)/$(rtld-installed-name)): Renamed from + $(inst_slibdir)/$(rtld-installed-name). + * scripts/rellns-sh: Add -p option. + * Makerules (make-shlib-link): Use rellns-sh to get relative name + for source. + +--- + ChangeLog | 15 +++++++++++++++ + Makeconfig | 10 ++++++++-- + Makerules | 4 ++-- + config.make.in | 1 + + configure | 2 ++ + configure.in | 1 + + elf/Makefile | 11 ++++++----- + scripts/rellns-sh | 17 +++++++++++++++-- + 8 files changed, 50 insertions(+), 11 deletions(-) + +Index: glibc-2.17/Makeconfig +=================================================================== +--- glibc-2.17.orig/Makeconfig ++++ glibc-2.17/Makeconfig +@@ -148,12 +148,18 @@ libdir = $(exec_prefix)/lib + endif + inst_libdir = $(install_root)$(libdir) + +-# Where to install the shared library and dynamic linker. ++# Where to install the shared library. + ifndef slibdir + slibdir = $(exec_prefix)/lib + endif + inst_slibdir = $(install_root)$(slibdir) + ++# Where to install the dynamic linker. ++ifndef rtlddir ++rtlddir = $(slibdir) ++endif ++inst_rtlddir = $(install_root)$(rtlddir) ++ + # Prefix to put on files installed in $(libdir). For libraries `libNAME.a', + # the prefix is spliced between `lib' and the name, so the linker switch + # `-l$(libprefix)NAME' finds the library; for other files the prefix is +@@ -443,7 +449,7 @@ ifndef +link-bounded + endif + ifndef config-LDFLAGS + ifeq (yes,$(build-shared)) +-config-LDFLAGS = -Wl,-dynamic-linker=$(slibdir)/$(rtld-installed-name) ++config-LDFLAGS = -Wl,-dynamic-linker=$(rtlddir)/$(rtld-installed-name) + endif + endif + ifndef link-libc +Index: glibc-2.17/Makerules +=================================================================== +--- glibc-2.17.orig/Makerules ++++ glibc-2.17/Makerules +@@ -873,7 +873,7 @@ ifeq (no,$(cross-compiling)) + symbolic-link-prog := $(common-objpfx)elf/sln + symbolic-link-list := $(common-objpfx)elf/symlink.list + define make-shlib-link +-echo $(> $(symbolic-link-list) ++echo `$(..)scripts/rellns-sh -p $< $@` $@ >> $(symbolic-link-list) + endef + else # cross-compiling + # We need a definition that can be used by elf/Makefile's install rules. +@@ -883,7 +883,7 @@ endif + ifndef make-shlib-link + define make-shlib-link + rm -f $@ +-$(LN_S) $( $@.new + mv -f $@.new $@ + +Index: glibc-2.17/config.make.in +=================================================================== +--- glibc-2.17.orig/config.make.in ++++ glibc-2.17/config.make.in +@@ -11,6 +11,7 @@ exec_prefix = @exec_prefix@ + datadir = @datadir@ + libdir = @libdir@ + slibdir = @libc_cv_slibdir@ ++rtlddir = @libc_cv_rtlddir@ + localedir = @libc_cv_localedir@ + sysconfdir = @libc_cv_sysconfdir@ + libexecdir = @libexecdir@ +Index: glibc-2.17/configure +=================================================================== +--- glibc-2.17.orig/configure ++++ glibc-2.17/configure +@@ -594,6 +594,7 @@ libc_cv_rootsbindir + libc_cv_localstatedir + libc_cv_sysconfdir + libc_cv_localedir ++libc_cv_rtlddir + libc_cv_slibdir + old_glibc_headers + use_nscd +@@ -7584,6 +7585,7 @@ fi + + + ++ + + + +Index: glibc-2.17/configure.in +=================================================================== +--- glibc-2.17.orig/configure.in ++++ glibc-2.17/configure.in +@@ -2117,6 +2117,7 @@ fi + AC_SUBST(old_glibc_headers) + + AC_SUBST(libc_cv_slibdir) ++AC_SUBST(libc_cv_rtlddir) + AC_SUBST(libc_cv_localedir) + AC_SUBST(libc_cv_sysconfdir) + AC_SUBST(libc_cv_localstatedir) +Index: glibc-2.17/elf/Makefile +=================================================================== +--- glibc-2.17.orig/elf/Makefile ++++ glibc-2.17/elf/Makefile +@@ -66,7 +66,7 @@ endif + ifeq (yes,$(build-shared)) + extra-objs = $(all-rtld-routines:%=%.os) soinit.os sofini.os interp.os + generated += librtld.os dl-allobjs.os ld.so ldd +-install-others = $(inst_slibdir)/$(rtld-installed-name) ++install-others = $(inst_rtlddir)/$(rtld-installed-name) + install-bin-script = ldd + endif + +@@ -340,7 +340,7 @@ $(objpfx)ld.so: $(objpfx)librtld.os $(ld + | $(AWK) '($$7 ~ /^UND(|EF)$$/ && $$1 != "0:" && $$4 != "REGISTER") { print; p=1 } END { exit p != 0 }' + + # interp.c exists just to get this string into the libraries. +-CFLAGS-interp.c = -D'RUNTIME_LINKER="$(slibdir)/$(rtld-installed-name)"' \ ++CFLAGS-interp.c = -D'RUNTIME_LINKER="$(rtlddir)/$(rtld-installed-name)"' \ + -DNOT_IN_libc=1 + $(objpfx)interp.os: $(common-objpfx)config.make + +@@ -372,18 +372,19 @@ $(inst_slibdir)/$(rtld-version-installed + $(make-target-directory) + $(do-install-program) + +-$(inst_slibdir)/$(rtld-installed-name): \ ++$(inst_rtlddir)/$(rtld-installed-name): \ + $(inst_slibdir)/$(rtld-version-installed-name) \ + $(inst_slibdir)/libc-$(version).so ++ $(make-target-directory) + $(make-shlib-link) + + # Special target called by parent to install just the dynamic linker. + .PHONY: ldso_install +-ldso_install: $(inst_slibdir)/$(rtld-installed-name) ++ldso_install: $(inst_rtlddir)/$(rtld-installed-name) + endif + + +-common-ldd-rewrite = -e 's%@RTLD@%$(slibdir)/$(rtld-installed-name)%g' \ ++common-ldd-rewrite = -e 's%@RTLD@%$(rtlddir)/$(rtld-installed-name)%g' \ + -e 's%@VERSION@%$(version)%g' \ + -e 's|@PKGVERSION@|$(PKGVERSION)|g' \ + -e 's|@REPORT_BUGS_TO@|$(REPORT_BUGS_TO)|g' +Index: glibc-2.17/ports/sysdeps/unix/sysv/linux/aarch64/configure +=================================================================== +--- glibc-2.17.orig/ports/sysdeps/unix/sysv/linux/aarch64/configure ++++ glibc-2.17/ports/sysdeps/unix/sysv/linux/aarch64/configure +@@ -7,6 +7,7 @@ test -n "$libc_cv_slibdir" || + case "$prefix" in + /usr | /usr/) + libc_cv_slibdir="/lib64" ++ libc_cv_rtlddir="/lib" + if test "$libdir" = '${exec_prefix}/lib'; then + libdir='${exec_prefix}/lib64'; + # Locale data can be shared between 32bit and 64bit libraries +Index: glibc-2.17/ports/sysdeps/unix/sysv/linux/aarch64/configure.in +=================================================================== +--- glibc-2.17.orig/ports/sysdeps/unix/sysv/linux/aarch64/configure.in ++++ glibc-2.17/ports/sysdeps/unix/sysv/linux/aarch64/configure.in +@@ -7,6 +7,7 @@ test -n "$libc_cv_slibdir" || + case "$prefix" in + /usr | /usr/) + libc_cv_slibdir="/lib64" ++ libc_cv_rtlddir="/lib" + if test "$libdir" = '${exec_prefix}/lib'; then + libdir='${exec_prefix}/lib64'; + # Locale data can be shared between 32bit and 64bit libraries +Index: glibc-2.17/scripts/rellns-sh +=================================================================== +--- glibc-2.17.orig/scripts/rellns-sh ++++ glibc-2.17/scripts/rellns-sh +@@ -16,8 +16,17 @@ + # You should have received a copy of the GNU General Public License + # along with this program; if not, see . + ++# With -p, instead of creating the link print the computed relative link ++# name. ++do_print=false ++case $1 in ++ -p) ++ do_print=true ++ shift ++ ;; ++esac + if test $# -ne 2; then +- echo "Usage: rellns SOURCE DEST" >&2 ++ echo "Usage: rellns [-p] SOURCE DEST" >&2 + exit 1 + fi + +@@ -70,4 +79,8 @@ while test -n "$from"; do + from=`echo $from | sed 's%^[^/]*/*%%'` + done + +-ln -s $rfrom$to $2 ++if $do_print; then ++ echo "$rfrom$to" ++else ++ ln -s $rfrom$to $2 ++fi +Index: glibc-2.17/sysdeps/gnu/configure +=================================================================== +--- glibc-2.17.orig/sysdeps/gnu/configure ++++ glibc-2.17/sysdeps/gnu/configure +@@ -9,12 +9,17 @@ + case "$prefix" in + /usr | /usr/) + # 64-bit libraries on bi-arch platforms go in /lib64 instead of /lib. +- # Allow earlier configure scripts to handle libc_cv_slibdir, libdir, +- # and libc_cv_localedir. ++ # Allow earlier configure scripts to handle libc_cv_slibdir, ++ # libc_cv_rtlddir, libdir, and libc_cv_localedir. + test -n "$libc_cv_slibdir" || \ + case $machine in + sparc/sparc64 | x86_64* | powerpc/powerpc64 | s390/s390-64) + libc_cv_slibdir=/lib64 ++ case $machine in ++ s390/s390-64) ++ libc_cv_rtlddir=/lib ++ ;; ++ esac + if test "$libdir" = '${exec_prefix}/lib'; then + libdir='${exec_prefix}/lib64'; + # Locale data can be shared between 32bit and 64bit libraries +Index: glibc-2.17/sysdeps/gnu/configure.in +=================================================================== +--- glibc-2.17.orig/sysdeps/gnu/configure.in ++++ glibc-2.17/sysdeps/gnu/configure.in +@@ -9,12 +9,17 @@ GLIBC_PROVIDES dnl See aclocal.m4 in the + case "$prefix" in + /usr | /usr/) + # 64-bit libraries on bi-arch platforms go in /lib64 instead of /lib. +- # Allow earlier configure scripts to handle libc_cv_slibdir, libdir, +- # and libc_cv_localedir. ++ # Allow earlier configure scripts to handle libc_cv_slibdir, ++ # libc_cv_rtlddir, libdir, and libc_cv_localedir. + test -n "$libc_cv_slibdir" || \ + case $machine in + sparc/sparc64 | x86_64* | powerpc/powerpc64 | s390/s390-64) + libc_cv_slibdir=/lib64 ++ case $machine in ++ s390/s390-64) ++ libc_cv_rtlddir=/lib ++ ;; ++ esac + if test "$libdir" = '${exec_prefix}/lib'; then + libdir='${exec_prefix}/lib64'; + # Locale data can be shared between 32bit and 64bit libraries diff --git a/strptime-W-week.patch b/strptime-W-week.patch new file mode 100644 index 0000000..acab5ff --- /dev/null +++ b/strptime-W-week.patch @@ -0,0 +1,44 @@ +From 3cc4f772e4e1a0999bf9a51a585c35d6f60421b6 Mon Sep 17 00:00:00 2001 +From: Andreas Schwab +Date: Tue, 5 Feb 2013 14:40:39 +0100 +Subject: [PATCH] Properly handle %W in strptime + + [BZ #15100] + * time/strptime_l.c (__strptime_internal): Count Sunday in a %W + week as 6 instead of -1. + * tst-strptime.c (day_tests): Add test case. +--- + time/strptime_l.c | 4 ++-- + time/tst-strptime.c | 1 + + 2 files changed, 3 insertions(+), 2 deletions(-) + +diff --git a/time/strptime_l.c b/time/strptime_l.c +index 1f2e8b6..00fc1ef 100644 +--- a/time/strptime_l.c ++++ b/time/strptime_l.c +@@ -1180,8 +1180,8 @@ __strptime_internal (rp, fmt, tmp, statep LOCALE_PARAM) + + if (!s.have_yday) + tm->tm_yday = ((7 - (tm->tm_wday - w_offset)) % 7 +- + (s.week_no - 1) *7 +- + save_wday - w_offset); ++ + (s.week_no - 1) * 7 ++ + (save_wday - w_offset + 7) % 7); + + if (!s.have_mday || !s.have_mon) + { +diff --git a/time/tst-strptime.c b/time/tst-strptime.c +index 12b084d..21fbb63 100644 +--- a/time/tst-strptime.c ++++ b/time/tst-strptime.c +@@ -41,6 +41,7 @@ static const struct + { "C", "19990502123412", "%Y%m%d%H%M%S", 0, 121, 4, 2 }, + { "C", "2001 20 Mon", "%Y %U %a", 1, 140, 4, 21 }, + { "C", "2001 21 Mon", "%Y %W %a", 1, 140, 4, 21 }, ++ { "C", "2012 00 Sun", "%Y %W %a", 0, 0, 0, 1 }, + { "ja_JP.EUC-JP", "2000-01-01 08:12:21 AM", "%Y-%m-%d %I:%M:%S %p", + 6, 0, 0, 1 }, + { "en_US.ISO-8859-1", "2000-01-01 08:12:21 PM", "%Y-%m-%d %I:%M:%S %p", +-- +1.8.2.3 +