From f2b22ab7b5bd390362038d913669b3f725486993 Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Sat, 15 Feb 2014 19:40:08 +0100 Subject: [PATCH] glibc: Backport hotfixes from RHEL6. --- lfs/glibc | 10 ++ src/patches/glibc/glibc-rh886968.patch | 33 +++++ src/patches/glibc/glibc-rh905575.patch | 72 ++++++++++ src/patches/glibc/glibc-rh905874.patch | 174 ++++++++++++++++++++++++ src/patches/glibc/glibc-rh916986.patch | 123 +++++++++++++++++ src/patches/glibc/glibc-rh928318.patch | 31 +++++ src/patches/glibc/glibc-rh947882.patch | 63 +++++++++ src/patches/glibc/glibc-rh952422.patch | 127 ++++++++++++++++++ src/patches/glibc/glibc-rh966775.patch | 177 +++++++++++++++++++++++++ src/patches/glibc/glibc-rh966778.patch | 54 ++++++++ src/patches/glibc/glibc-rh970090.patch | 24 ++++ 11 files changed, 888 insertions(+) create mode 100644 src/patches/glibc/glibc-rh886968.patch create mode 100644 src/patches/glibc/glibc-rh905575.patch create mode 100644 src/patches/glibc/glibc-rh905874.patch create mode 100644 src/patches/glibc/glibc-rh916986.patch create mode 100644 src/patches/glibc/glibc-rh928318.patch create mode 100644 src/patches/glibc/glibc-rh947882.patch create mode 100644 src/patches/glibc/glibc-rh952422.patch create mode 100644 src/patches/glibc/glibc-rh966775.patch create mode 100644 src/patches/glibc/glibc-rh966778.patch create mode 100644 src/patches/glibc/glibc-rh970090.patch diff --git a/lfs/glibc b/lfs/glibc index 9acbb111b..dcbffc254 100644 --- a/lfs/glibc +++ b/lfs/glibc @@ -258,6 +258,16 @@ endif 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/glibc-rh886968.patch + cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/glibc/glibc-rh905575.patch + cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/glibc/glibc-rh905874.patch + cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/glibc/glibc-rh916986.patch + cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/glibc/glibc-rh928318.patch + cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/glibc/glibc-rh947882.patch + cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/glibc/glibc-rh952422.patch + cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/glibc/glibc-rh966775.patch + cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/glibc/glibc-rh966778.patch + cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/glibc/glibc-rh970090.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 diff --git a/src/patches/glibc/glibc-rh886968.patch b/src/patches/glibc/glibc-rh886968.patch new file mode 100644 index 000000000..4872a91fc --- /dev/null +++ b/src/patches/glibc/glibc-rh886968.patch @@ -0,0 +1,33 @@ +diff -Nrup a/elf/dl-load.c b/elf/dl-load.c +--- a/elf/dl-load.c 2013-01-10 08:57:20.098898830 -0500 ++++ b/elf/dl-load.c 2013-01-10 12:04:48.155962895 -0500 +@@ -819,7 +819,7 @@ lose (int code, int fd, const char *name + { + r->r_state = RT_CONSISTENT; + _dl_debug_state (); +- LIBC_PROBE (rtld_map_complete, 2, nsid, r); ++ LIBC_PROBE (rtld_map_complete, 3, nsid, r, NULL); + } + + _dl_signal_error (code, name, NULL, msg); +diff -Nrup a/elf/dl-open.c b/elf/dl-open.c +--- a/elf/dl-open.c 2013-01-10 08:57:19.917897417 -0500 ++++ b/elf/dl-open.c 2013-01-10 12:06:04.644775710 -0500 +@@ -298,7 +298,7 @@ dl_open_worker (void *a) + struct r_debug *r = _dl_debug_initialize (0, args->nsid); + r->r_state = RT_CONSISTENT; + _dl_debug_state (); +- LIBC_PROBE (rtld_map_complete, 2, args->nsid, r); ++ LIBC_PROBE (rtld_map_complete, 3, args->nsid, r, new); + + /* Only do lazy relocation if `LD_BIND_NOW' is not set. */ + int reloc_mode = mode & __RTLD_AUDIT; +@@ -472,7 +472,7 @@ TLS generation counter wrapped! Please + + /* Notify the debugger all new objects have been relocated. */ + if (relocation_in_progress) +- LIBC_PROBE (rtld_reloc_complete, 2, args->nsid, r); ++ LIBC_PROBE (rtld_reloc_complete, 3, args->nsid, r, new); + + /* Run the initializer functions of new objects. */ + _dl_init (new, args->argc, args->argv, args->env); diff --git a/src/patches/glibc/glibc-rh905575.patch b/src/patches/glibc/glibc-rh905575.patch new file mode 100644 index 000000000..70baa8931 --- /dev/null +++ b/src/patches/glibc/glibc-rh905575.patch @@ -0,0 +1,72 @@ +diff -rup a/sysdeps/ieee754/dbl-64/slowexp.c b/sysdeps/ieee754/dbl-64/slowexp.c +--- a/sysdeps/ieee754/dbl-64/slowexp.c 2012-01-01 05:16:32.000000000 -0700 ++++ b/sysdeps/ieee754/dbl-64/slowexp.c 2012-03-13 11:57:51.225330782 -0600 +@@ -31,6 +31,8 @@ + #include "mpa.h" + #include "math_private.h" + ++#include ++ + void __mpexp(mp_no *x, mp_no *y, int p); + + /*Converting from double precision to Multi-precision and calculating e^x */ +@@ -61,12 +63,21 @@ __slowexp(double x) { + __sub(&mpy,&mpcor,&mpz,p); + __mp_dbl(&mpw, &w, p); + __mp_dbl(&mpz, &z, p); +- if (w == z) return w; ++ if (w == z) { ++ /* Track how often we get to the slow exp code plus ++ its input/output values. */ ++ LIBC_PROBE (slowexp_p6, 2, &x, &w); ++ return w; ++ } + else { /* if calculating is not exactly */ + p = 32; + __dbl_mp(x,&mpx,p); + __mpexp(&mpx, &mpy, p); + __mp_dbl(&mpy, &res, p); ++ ++ /* Track how often we get to the uber-slow exp code plus ++ its input/output values. */ ++ LIBC_PROBE (slowexp_p32, 2, &x, &res); + return res; + } + } +diff -rup a/sysdeps/ieee754/dbl-64/slowpow.c b/sysdeps/ieee754/dbl-64/slowpow.c +--- a/sysdeps/ieee754/dbl-64/slowpow.c 2012-01-01 05:16:32.000000000 -0700 ++++ b/sysdeps/ieee754/dbl-64/slowpow.c 2012-03-13 11:57:59.865284437 -0600 +@@ -35,6 +35,8 @@ + #include "mpa.h" + #include "math_private.h" + ++#include ++ + void __mpexp(mp_no *x, mp_no *y, int p); + void __mplog(mp_no *x, mp_no *y, int p); + double ulog(double); +@@ -66,7 +68,12 @@ __slowpow(double x, double y, double z) + __mp_dbl(&mpr, &res, p); + __sub(&mpp,&eps,&mpr1,p); /* pp -eps =r1 */ + __mp_dbl(&mpr1, &res1, p); /* converting into double precision */ +- if (res == res1) return res; ++ if (res == res1) { ++ /* Track how often we get to the slow pow code plus ++ its input/output values. */ ++ LIBC_PROBE (slowpow_p10, 4, &x, &y, &z, &res); ++ return res; ++ } + + p = 32; /* if we get here result wasn't calculated exactly, continue */ + __dbl_mp(x,&mpx,p); /* for more exact calculation */ +@@ -76,5 +83,10 @@ __slowpow(double x, double y, double z) + __mul(&mpy,&mpz,&mpw,p); /* y*z =w */ + __mpexp(&mpw, &mpp, p); /* e^w=pp */ + __mp_dbl(&mpp, &res, p); /* converting into double precision */ ++ ++ /* Track how often we get to the uber-slow pow code plus ++ its input/output values. */ ++ LIBC_PROBE (slowpow_p32, 4, &x, &y, &z, &res); ++ + return res; + } diff --git a/src/patches/glibc/glibc-rh905874.patch b/src/patches/glibc/glibc-rh905874.patch new file mode 100644 index 000000000..1d9ea109a --- /dev/null +++ b/src/patches/glibc/glibc-rh905874.patch @@ -0,0 +1,174 @@ +# +# Backported from upstream. +# +# - Add en_US.UTF-8 as pre-requisite for regression test: +# +# commit 62c4a69dc2aea24776cbf0e951d41709a7408cc6 +# Author: Joseph Myers +# Date: Thu Nov 1 00:22:04 2012 +0000 +# +# Build en_US.UTF-8 locale for testing. +# +# - Fix buffer overrun: +# +# commit a445af0bc722d620afed7683cd320c0e4c7c6059 +# Author: Andreas Schwab +# Date: Tue Jan 29 14:45:15 2013 +0100 +# +# Fix buffer overrun in regexp matcher +# +# ChangeLog/ +# 2013-02-12 Andreas Schwab +# +# [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. +# +diff -urN glibc-2.12-2-gc4ccff1.orig/localedata/Makefile glibc-2.12-2-gc4ccff1/localedata/Makefile +--- glibc-2.12-2-gc4ccff1.orig/localedata/Makefile 2013-07-24 20:40:37.364888120 -0400 ++++ glibc-2.12-2-gc4ccff1/localedata/Makefile 2013-07-24 20:59:54.713289753 -0400 +@@ -133,7 +133,7 @@ + ifeq (no,$(cross-compiling)) + # We have to generate locales + LOCALES := de_DE.ISO-8859-1 de_DE.UTF-8 en_US.ANSI_X3.4-1968 \ +- en_US.ISO-8859-1 ja_JP.EUC-JP da_DK.ISO-8859-1 \ ++ en_US.ISO-8859-1 en_US.UTF-8 ja_JP.EUC-JP da_DK.ISO-8859-1 \ + hr_HR.ISO-8859-2 sv_SE.ISO-8859-1 ja_JP.SJIS fr_FR.ISO-8859-1 \ + vi_VN.TCVN5712-1 nb_NO.ISO-8859-1 nn_NO.ISO-8859-1 \ + tr_TR.UTF-8 cs_CZ.UTF-8 zh_TW.EUC-TW fa_IR.UTF-8 fr_FR.UTF-8 \ +diff -urN glibc-2.12-2-gc4ccff1.orig/posix/bug-regex34.c glibc-2.12-2-gc4ccff1/posix/bug-regex34.c +--- glibc-2.12-2-gc4ccff1.orig/posix/bug-regex34.c 1969-12-31 19:00:00.000000000 -0500 ++++ glibc-2.12-2-gc4ccff1/posix/bug-regex34.c 2013-07-24 20:59:54.713289753 -0400 +@@ -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 -urN glibc-2.12-2-gc4ccff1.orig/posix/Makefile glibc-2.12-2-gc4ccff1/posix/Makefile +--- glibc-2.12-2-gc4ccff1.orig/posix/Makefile 2013-07-24 20:40:37.399888098 -0400 ++++ glibc-2.12-2-gc4ccff1/posix/Makefile 2013-07-24 21:00:43.267265979 -0400 +@@ -94,7 +94,7 @@ + tst-rfc3484-3 \ + tst-getaddrinfo3 tst-fnmatch2 tst-cpucount tst-cpuset \ + bug-getopt1 bug-getopt2 bug-getopt3 bug-getopt4 \ +- bug-getopt5 ++ bug-getopt5 bug-regex34 + xtests := bug-ga2 + ifeq (yes,$(build-shared)) + test-srcs := globtest +@@ -199,6 +199,7 @@ + bug-regex25-ENV = LOCPATH=$(common-objpfx)localedata + bug-regex26-ENV = LOCPATH=$(common-objpfx)localedata + bug-regex30-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 -urN glibc-2.12-2-gc4ccff1.orig/posix/regexec.c glibc-2.12-2-gc4ccff1/posix/regexec.c +--- glibc-2.12-2-gc4ccff1.orig/posix/regexec.c 2013-07-24 20:40:37.396888100 -0400 ++++ glibc-2.12-2-gc4ccff1/posix/regexec.c 2013-07-24 21:02:53.005156187 -0400 +@@ -198,7 +198,7 @@ + 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 @@ + || (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); +@@ -1737,7 +1737,7 @@ + && 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; + } +@@ -2791,7 +2791,7 @@ + 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; + +@@ -4099,7 +4099,7 @@ + + 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; +@@ -4108,8 +4108,10 @@ + 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, 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; + diff --git a/src/patches/glibc/glibc-rh916986.patch b/src/patches/glibc/glibc-rh916986.patch new file mode 100644 index 000000000..9bed61f90 --- /dev/null +++ b/src/patches/glibc/glibc-rh916986.patch @@ -0,0 +1,123 @@ +commit cf7c9078a5acdbb435498ace92cd81009637a971 +Author: Ulrich Drepper +Date: Fri Nov 19 09:35:39 2010 -0500 + + Define MAP_HUGETLB. + + * sysdeps/unix/sysv/linux/i386/bits/mman.h: Define MAP_HUGETLB. + * sysdeps/unix/sysv/linux/x86_64/bits/mman.h: Likewise. + +commit dd62fda6cc83b3afa150a4be7d273ab118bf9825 +Author: Anton Blanchard +Date: Tue Mar 27 18:37:16 2012 -0700 + + Define MAP_STACK and MAP_HUGETLB on powerpc, s390, sh and sparc. + + * sysdeps/unix/sysv/linux/powerpc/bits/mman.h: Define MAP_STACK and + MAP_HUGETLB. + * sysdeps/unix/sysv/linux/s390/bits/mman.h: Likewise. + * sysdeps/unix/sysv/linux/sh/bits/mman.h: Likewise. + * sysdeps/unix/sysv/linux/sparc/bits/mman.h: Likewise. + +commit 7e4fc5890e07549e5ad98b4244e3e0ed5c709e6a +Author: Mike Frysinger +Date: Mon Apr 16 22:44:23 2012 -0400 + + ia64: add MAP_{STACK,HUGETLB} to bits/mman.h + + Just adding new bit flags that newer kernels define. + + Signed-off-by: Mike Frysinger + + * sysdeps/unix/sysv/linux/ia64/bits/mman.h (MAP_STACK): Define. + (MAP_HUGETLB): Likewise. + +Index: glibc-2.12-2-gc4ccff1/sysdeps/unix/sysv/linux/powerpc/bits/mman.h +=================================================================== +--- glibc-2.12-2-gc4ccff1.orig/sysdeps/unix/sysv/linux/powerpc/bits/mman.h 2013-07-23 04:01:42.440052942 -0300 ++++ glibc-2.12-2-gc4ccff1/sysdeps/unix/sysv/linux/powerpc/bits/mman.h 2013-07-23 22:26:42.317789260 -0300 +@@ -65,6 +65,8 @@ + # define MAP_NORESERVE 0x00040 /* Don't check for reservations. */ + # define MAP_POPULATE 0x08000 /* Populate (prefault) pagetables. */ + # define MAP_NONBLOCK 0x10000 /* Do not block on IO. */ ++# define MAP_STACK 0x20000 /* Allocation is for a stack. */ ++# define MAP_HUGETLB 0x40000 /* Create huge page mapping. */ + #endif + + /* Flags to `msync'. */ +Index: glibc-2.12-2-gc4ccff1/sysdeps/unix/sysv/linux/s390/bits/mman.h +=================================================================== +--- glibc-2.12-2-gc4ccff1.orig/sysdeps/unix/sysv/linux/s390/bits/mman.h 2013-07-23 04:01:42.447052393 -0300 ++++ glibc-2.12-2-gc4ccff1/sysdeps/unix/sysv/linux/s390/bits/mman.h 2013-07-23 22:26:42.335787833 -0300 +@@ -64,6 +64,8 @@ + # define MAP_NORESERVE 0x04000 /* Don't check for reservations. */ + # define MAP_POPULATE 0x08000 /* Populate (prefault) pagetables. */ + # define MAP_NONBLOCK 0x10000 /* Do not block on IO. */ ++# define MAP_STACK 0x20000 /* Allocation is for a stack. */ ++# define MAP_HUGETLB 0x40000 /* Create huge page mapping. */ + #endif + + /* Flags to `msync'. */ +Index: glibc-2.12-2-gc4ccff1/sysdeps/unix/sysv/linux/sh/bits/mman.h +=================================================================== +--- glibc-2.12-2-gc4ccff1.orig/sysdeps/unix/sysv/linux/sh/bits/mman.h 2010-05-04 08:27:23.000000000 -0300 ++++ glibc-2.12-2-gc4ccff1/sysdeps/unix/sysv/linux/sh/bits/mman.h 2013-07-23 22:26:42.336787753 -0300 +@@ -64,6 +64,8 @@ + # define MAP_NORESERVE 0x4000 /* Don't check for reservations. */ + # define MAP_POPULATE 0x8000 /* Populate (prefault) pagetables. */ + # define MAP_NONBLOCK 0x10000 /* Do not block on IO. */ ++# define MAP_STACK 0x20000 /* Allocation is for a stack. */ ++# define MAP_HUGETLB 0x40000 /* Create huge page mapping. */ + #endif + + /* Flags to `msync'. */ +Index: glibc-2.12-2-gc4ccff1/sysdeps/unix/sysv/linux/sparc/bits/mman.h +=================================================================== +--- glibc-2.12-2-gc4ccff1.orig/sysdeps/unix/sysv/linux/sparc/bits/mman.h 2010-05-04 08:27:23.000000000 -0300 ++++ glibc-2.12-2-gc4ccff1/sysdeps/unix/sysv/linux/sparc/bits/mman.h 2013-07-23 22:26:42.337787674 -0300 +@@ -66,6 +66,8 @@ + # define _MAP_NEW 0x80000000 /* Binary compatibility with SunOS. */ + # define MAP_POPULATE 0x8000 /* Populate (prefault) pagetables. */ + # define MAP_NONBLOCK 0x10000 /* Do not block on IO. */ ++# define MAP_STACK 0x20000 /* Allocation is for a stack. */ ++# define MAP_HUGETLB 0x40000 /* Create huge page mapping. */ + #endif + + /* Flags to `msync'. */ +Index: glibc-2.12-2-gc4ccff1/sysdeps/unix/sysv/linux/i386/bits/mman.h +=================================================================== +--- glibc-2.12-2-gc4ccff1.orig/sysdeps/unix/sysv/linux/i386/bits/mman.h 2013-07-23 04:01:42.406055607 -0300 ++++ glibc-2.12-2-gc4ccff1/sysdeps/unix/sysv/linux/i386/bits/mman.h 2013-07-23 22:32:37.407630135 -0300 +@@ -64,6 +64,7 @@ + # define MAP_POPULATE 0x08000 /* Populate (prefault) pagetables. */ + # define MAP_NONBLOCK 0x10000 /* Do not block on IO. */ + # define MAP_STACK 0x20000 /* Allocation is for a stack. */ ++# define MAP_HUGETLB 0x40000 /* Create huge page mapping. */ + #endif + + /* Flags to `msync'. */ +Index: glibc-2.12-2-gc4ccff1/sysdeps/unix/sysv/linux/x86_64/bits/mman.h +=================================================================== +--- glibc-2.12-2-gc4ccff1.orig/sysdeps/unix/sysv/linux/x86_64/bits/mman.h 2013-07-23 04:01:42.493048788 -0300 ++++ glibc-2.12-2-gc4ccff1/sysdeps/unix/sysv/linux/x86_64/bits/mman.h 2013-07-23 22:32:37.433628073 -0300 +@@ -65,6 +65,7 @@ + # define MAP_POPULATE 0x08000 /* Populate (prefault) pagetables. */ + # define MAP_NONBLOCK 0x10000 /* Do not block on IO. */ + # define MAP_STACK 0x20000 /* Allocation is for a stack. */ ++# define MAP_HUGETLB 0x40000 /* Create huge page mapping. */ + #endif + + /* Flags to `msync'. */ +Index: glibc-2.12-2-gc4ccff1/sysdeps/unix/sysv/linux/ia64/bits/mman.h +=================================================================== +--- glibc-2.12-2-gc4ccff1.orig/sysdeps/unix/sysv/linux/ia64/bits/mman.h 2010-05-04 08:27:23.000000000 -0300 ++++ glibc-2.12-2-gc4ccff1/sysdeps/unix/sysv/linux/ia64/bits/mman.h 2013-07-23 22:37:28.643530951 -0300 +@@ -65,6 +65,8 @@ + # define MAP_NORESERVE 0x04000 /* Don't check for reservations. */ + # define MAP_POPULATE 0x08000 /* Populate (prefault) pagetables. */ + # define MAP_NONBLOCK 0x10000 /* Do not block on IO. */ ++# define MAP_STACK 0x20000 /* Allocation is for a stack. */ ++# define MAP_HUGETLB 0x40000 /* Create huge page mapping. */ + #endif + + /* Flags to `msync'. */ diff --git a/src/patches/glibc/glibc-rh928318.patch b/src/patches/glibc/glibc-rh928318.patch new file mode 100644 index 000000000..36aa19a6d --- /dev/null +++ b/src/patches/glibc/glibc-rh928318.patch @@ -0,0 +1,31 @@ +diff --git a/resolv/res_init.c b/resolv/res_init.c +index 40dbe7d..202569d 100644 +--- a/resolv/res_init.c ++++ b/resolv/res_init.c +@@ -176,13 +176,6 @@ __res_vinit(res_state statp, int preinit) { + statp->id = res_randomid(); + } + +-#ifdef USELOOPBACK +- statp->nsaddr.sin_addr = inet_makeaddr(IN_LOOPBACKNET, 1); +-#else +- statp->nsaddr.sin_addr.s_addr = INADDR_ANY; +-#endif +- statp->nsaddr.sin_family = AF_INET; +- statp->nsaddr.sin_port = htons(NAMESERVER_PORT); + statp->nscount = 0; + statp->ndots = 1; + statp->pfcode = 0; +@@ -433,6 +426,12 @@ __res_vinit(res_state statp, int preinit) { + #endif + (void) fclose(fp); + } ++ if (__builtin_expect(statp->nscount == 0, 0)) { ++ statp->nsaddr.sin_addr = inet_makeaddr(IN_LOOPBACKNET, 1); ++ statp->nsaddr.sin_family = AF_INET; ++ statp->nsaddr.sin_port = htons(NAMESERVER_PORT); ++ statp->nscount = 1; ++ } + if (statp->defdname[0] == 0 && + __gethostname(buf, sizeof(statp->defdname) - 1) == 0 && + (cp = strchr(buf, '.')) != NULL) diff --git a/src/patches/glibc/glibc-rh947882.patch b/src/patches/glibc/glibc-rh947882.patch new file mode 100644 index 000000000..6d10982a2 --- /dev/null +++ b/src/patches/glibc/glibc-rh947882.patch @@ -0,0 +1,63 @@ +# +# Backport from upstream: +# +# 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 +# +# --- +# ChangeLog | 6 ++++++ +# NEWS | 5 ++++- +# sysdeps/posix/getaddrinfo.c | 23 +++++++++++++++++++++-- +# 3 files changed, 31 insertions(+), 3 deletions(-) +# +# 2013-04-03 Andreas Schwab +# +# [BZ #15330] +# * sysdeps/posix/getaddrinfo.c (getaddrinfo): Allocate results and +# order arrays from heap if bigger than alloca cutoff. +# +diff -urN glibc-2.12-2-gc4ccff1.orig/sysdeps/posix/getaddrinfo.c glibc-2.12-2-gc4ccff1/sysdeps/posix/getaddrinfo.c +--- glibc-2.12-2-gc4ccff1.orig/sysdeps/posix/getaddrinfo.c 2013-07-24 20:40:37.601887975 -0400 ++++ glibc-2.12-2-gc4ccff1/sysdeps/posix/getaddrinfo.c 2013-07-24 20:54:32.722447705 -0400 +@@ -2386,11 +2386,27 @@ + __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 (*order))); ++ if (malloc_results) ++ { ++ results = malloc (nresults * (sizeof (*results) + sizeof (*order))); ++ if (results == NULL) ++ { ++ free (in6ai); ++ return EAI_MEMORY; ++ } ++ } ++ else ++ results = alloca (nresults * (sizeof (*results) + sizeof (*order))); ++ order = (size_t *) (results + nresults); + + /* If we have information about deprecated and temporary addresses + sort the array now. */ +@@ -2557,6 +2573,9 @@ + + /* Fill in the canonical name into the new first entry. */ + p->ai_canonname = canonname; ++ ++ if (malloc_results) ++ free (results); + } + + free (in6ai); diff --git a/src/patches/glibc/glibc-rh952422.patch b/src/patches/glibc/glibc-rh952422.patch new file mode 100644 index 000000000..c73bf523f --- /dev/null +++ b/src/patches/glibc/glibc-rh952422.patch @@ -0,0 +1,127 @@ +diff --git a/sysdeps/unix/sysv/linux/getsysstats.c b/sysdeps/unix/sysv/linux/getsysstats.c +index af454b6..249bd19 100644 +--- a/sysdeps/unix/sysv/linux/getsysstats.c ++++ b/sysdeps/unix/sysv/linux/getsysstats.c +@@ -35,6 +34,7 @@ + + #include + #include ++#include + + + /* How we can determine the number of available processors depends on +@@ -49,8 +49,6 @@ + But not all systems have support for the /proc filesystem. If it + is not available we simply return 1 since there is no way. */ + +-#include +- + + /* Other architectures use different formats for /proc/cpuinfo. This + provides a hook for alternative parsers. */ +@@ -128,6 +126,15 @@ next_line (int fd, char *const buffer, char **cp, char **re, + int + __get_nprocs () + { ++ static int cached_result; ++ static time_t timestamp; ++ ++ time_t now = time (NULL); ++ time_t prev = timestamp; ++ atomic_read_barrier (); ++ if (now == prev) ++ return cached_result; ++ + /* XXX Here will come a test for the new system call. */ + + const size_t buffer_size = __libc_use_alloca (8192) ? 8192 : 512; +@@ -135,20 +142,65 @@ __get_nprocs () + char *buffer_end = buffer + buffer_size; + char *cp = buffer_end; + char *re = buffer_end; +- int result = 1; + + #ifdef O_CLOEXEC + const int flags = O_RDONLY | O_CLOEXEC; + #else + const int flags = O_RDONLY; + #endif ++ int fd = open_not_cancel_2 ("/sys/devices/system/cpu/online", flags); ++ char *l; ++ int result = 0; ++ if (fd != -1) ++ { ++ l = next_line (fd, buffer, &cp, &re, buffer_end); ++ if (l != NULL) ++ do ++ { ++ char *endp; ++ unsigned long int n = strtoul (l, &endp, 10); ++ if (l == endp) ++ { ++ result = 0; ++ break; ++ } ++ ++ unsigned long int m = n; ++ if (*endp == '-') ++ { ++ l = endp + 1; ++ m = strtoul (l, &endp, 10); ++ if (l == endp) ++ { ++ result = 0; ++ break; ++ } ++ } ++ ++ result += m - n + 1; ++ ++ l = endp; ++ while (l < re && isspace (*l)) ++ ++l; ++ } ++ while (l < re); ++ ++ close_not_cancel_no_status (fd); ++ ++ if (result > 0) ++ goto out; ++ } ++ ++ cp = buffer_end; ++ re = buffer_end; ++ result = 1; ++ + /* The /proc/stat format is more uniform, use it by default. */ +- int fd = open_not_cancel_2 ("/proc/stat", flags); ++ fd = open_not_cancel_2 ("/proc/stat", flags); + if (fd != -1) + { + result = 0; + +- char *l; + while ((l = next_line (fd, buffer, &cp, &re, buffer_end)) != NULL) + /* The current format of /proc/stat has all the cpu* entries + at the front. We assume here that stays this way. */ +@@ -169,6 +221,11 @@ __get_nprocs () + } + } + ++ out: ++ cached_result = result; ++ atomic_write_barrier (); ++ timestamp = now; ++ + return result; + } + weak_alias (__get_nprocs, get_nprocs) +@@ -236,7 +293,7 @@ phys_pages_info (const char *format) + long int result = -1; + + /* If we haven't found an appropriate entry return 1. */ +- FILE *fp = fopen ("/proc/meminfo", "rc"); ++ FILE *fp = fopen ("/proc/meminfo", "rce"); + if (fp != NULL) + { + /* No threads use this stream. */ diff --git a/src/patches/glibc/glibc-rh966775.patch b/src/patches/glibc/glibc-rh966775.patch new file mode 100644 index 000000000..32a0f2167 --- /dev/null +++ b/src/patches/glibc/glibc-rh966775.patch @@ -0,0 +1,177 @@ +diff -pruN glibc-2.12-2-gc4ccff1/math/math_private.h glibc-2.12-2-gc4ccff1.new/math/math_private.h +--- glibc-2.12-2-gc4ccff1/math/math_private.h 2013-06-07 08:35:52.785442441 -0400 ++++ glibc-2.12-2-gc4ccff1.new/math/math_private.h 2013-06-07 08:29:35.621042340 -0400 +@@ -394,4 +394,31 @@ extern void __docos (double __x, double + #define libc_feupdateenvf(e) (void) feupdateenv (e) + #define libc_feupdateenvl(e) (void) feupdateenv (e) + ++/* Save and set the rounding mode. The use of fenv_t to store the old mode ++ allows a target-specific version of this function to avoid converting the ++ rounding mode from the fpu format. By default we have no choice but to ++ manipulate the entire env. */ ++ ++#ifndef libc_feholdsetround ++# define libc_feholdsetround(e, r, c) libc_feholdexcept_setround(e, r) ++#endif ++#ifndef libc_feholdsetroundf ++# define libc_feholdsetroundf(e, r, c) libc_feholdexcept_setroundf(e, r) ++#endif ++#ifndef libc_feholdsetroundl ++# define libc_feholdsetroundl(e, r, c) libc_feholdexcept_setroundl(e, r) ++#endif ++ ++/* ... and the reverse. */ ++ ++#ifndef libc_feresetround ++# define libc_feresetround(e, c) libc_feupdateenv(e) ++#endif ++#ifndef libc_feresetroundf ++# define libc_feresetroundf(e, c) libc_feupdateenvf(e) ++#endif ++#ifndef libc_feresetroundl ++# define libc_feresetroundl(e, c) libc_feupdateenvl(e) ++#endif ++ + #endif /* _MATH_PRIVATE_H_ */ +diff -pruN glibc-2.12-2-gc4ccff1/sysdeps/ieee754/dbl-64/e_exp.c glibc-2.12-2-gc4ccff1.new/sysdeps/ieee754/dbl-64/e_exp.c +--- glibc-2.12-2-gc4ccff1/sysdeps/ieee754/dbl-64/e_exp.c 2013-06-07 08:35:52.785442441 -0400 ++++ glibc-2.12-2-gc4ccff1.new/sysdeps/ieee754/dbl-64/e_exp.c 2013-06-07 08:30:21.976222459 -0400 +@@ -57,7 +57,8 @@ double __ieee754_exp(double x) { + fenv_t env; + double retval; + +- libc_feholdexcept_setround (&env, FE_TONEAREST); ++ int changed; ++ libc_feholdsetround (&env, FE_TONEAREST, changed); + + junk1.x = x; + m = junk1.i[HIGH_HALF]; +@@ -152,7 +153,7 @@ double __ieee754_exp(double x) { + else { retval = __slowexp(x); goto ret; } + } + ret: +- libc_feupdateenv (&env); ++ libc_feresetround (&env, changed); + return retval; + } + +diff -pruN glibc-2.12-2-gc4ccff1/sysdeps/ieee754/dbl-64/e_pow.c glibc-2.12-2-gc4ccff1.new/sysdeps/ieee754/dbl-64/e_pow.c +--- glibc-2.12-2-gc4ccff1/sysdeps/ieee754/dbl-64/e_pow.c 2013-06-07 08:35:52.785442441 -0400 ++++ glibc-2.12-2-gc4ccff1.new/sysdeps/ieee754/dbl-64/e_pow.c 2013-06-07 08:31:00.294939087 -0400 +@@ -83,7 +83,8 @@ double __ieee754_pow(double x, double y) + fenv_t env; + double retval; + +- libc_feholdexcept_setround (&env, FE_TONEAREST); ++ int changed; ++ libc_feholdsetround (&env, FE_TONEAREST, changed); + + z = log1(x,&aa,&error); /* x^y =e^(y log (X)) */ + t = y*134217729.0; +@@ -100,7 +101,7 @@ double __ieee754_pow(double x, double y) + t = __exp1(a1,a2,1.9e16*error); /* return -10 or 0 if wasn't computed exactly */ + retval = (t>0)?t:power1(x,y); + +- libc_feupdateenv (&env); ++ libc_feresetround (&env, changed); + return retval; + } + +diff -pruN glibc-2.12-2-gc4ccff1/sysdeps/ieee754/dbl-64/s_sin.c glibc-2.12-2-gc4ccff1.new/sysdeps/ieee754/dbl-64/s_sin.c +--- glibc-2.12-2-gc4ccff1/sysdeps/ieee754/dbl-64/s_sin.c 2013-06-07 08:35:52.786442462 -0400 ++++ glibc-2.12-2-gc4ccff1.new/sysdeps/ieee754/dbl-64/s_sin.c 2013-06-07 08:32:08.254822633 -0400 +@@ -101,7 +101,8 @@ double __sin(double x){ + fenv_t env; + double retval = 0; + +- libc_feholdexcept_setround (&env, FE_TONEAREST); ++ int changed; ++ libc_feholdsetround (&env, FE_TONEAREST, changed); + + u.x = x; + m = u.i[HIGH_HALF]; +@@ -355,7 +356,7 @@ double __sin(double x){ + } + + ret: +- libc_feupdateenv (&env); ++ libc_feresetround (&env, changed); + return retval; + } + +@@ -374,7 +375,8 @@ double __cos(double x) + fenv_t env; + double retval = 0; + +- libc_feholdexcept_setround (&env, FE_TONEAREST); ++ int changed; ++ libc_feholdsetround (&env, FE_TONEAREST, changed); + + u.x = x; + m = u.i[HIGH_HALF]; +@@ -623,7 +625,7 @@ double __cos(double x) + } + + ret: +- libc_feupdateenv (&env); ++ libc_feresetround (&env, changed); + return retval; + } + +diff -pruN glibc-2.12-2-gc4ccff1/sysdeps/ieee754/dbl-64/s_tan.c glibc-2.12-2-gc4ccff1.new/sysdeps/ieee754/dbl-64/s_tan.c +--- glibc-2.12-2-gc4ccff1/sysdeps/ieee754/dbl-64/s_tan.c 2013-06-07 08:35:52.786442462 -0400 ++++ glibc-2.12-2-gc4ccff1.new/sysdeps/ieee754/dbl-64/s_tan.c 2013-06-07 08:32:39.736162619 -0400 +@@ -66,7 +66,8 @@ double tan(double x) { + int __branred(double, double *, double *); + int __mpranred(double, mp_no *, int); + +- libc_feholdexcept_setround (&env, FE_TONEAREST); ++ int changed; ++ libc_feholdsetround (&env, FE_TONEAREST, changed); + + /* x=+-INF, x=NaN */ + num.d = x; ux = num.i[HIGH_HALF]; +@@ -495,7 +496,7 @@ double tan(double x) { + goto ret; + + ret: +- libc_feupdateenv (&env); ++ libc_feresetround (&env, changed); + return retval; + } + +diff -pruN glibc-2.12-2-gc4ccff1/sysdeps/x86_64/fpu/math_private.h glibc-2.12-2-gc4ccff1.new/sysdeps/x86_64/fpu/math_private.h +--- glibc-2.12-2-gc4ccff1/sysdeps/x86_64/fpu/math_private.h 2013-06-07 08:35:52.787442488 -0400 ++++ glibc-2.12-2-gc4ccff1.new/sysdeps/x86_64/fpu/math_private.h 2013-06-07 08:34:35.370109759 -0400 +@@ -139,3 +139,31 @@ do { \ + #undef libc_feupdateenvf + #define libc_feupdateenvf(e) libc_feupdateenv (e) + // #define libc_feupdateenvl(e) (void) feupdateenv (e) ++ ++#undef libc_feholdsetround ++#define libc_feholdsetround(e, r, c) \ ++({ \ ++ unsigned int mxcsr, new_mxcsr; \ ++ asm ("stmxcsr %0" : "=m" (*&mxcsr)); \ ++ new_mxcsr = (mxcsr & ~0x6000) | ((r) << 3); \ ++ if (__builtin_expect (new_mxcsr != mxcsr, 0)) \ ++ { \ ++ (e)->__mxcsr = mxcsr; \ ++ asm volatile ("ldmxcsr %0" : : "m" (*&new_mxcsr)); \ ++ c = 1; \ ++ } \ ++ else \ ++ c = 0; \ ++}) ++ ++#undef libc_feresetround ++#define libc_feresetround(e, c) \ ++({ \ ++ if (__builtin_expect (c, 0)) \ ++ { \ ++ unsigned int mxcsr; \ ++ asm ("stmxcsr %0" : "=m" (*&mxcsr)); \ ++ mxcsr = (mxcsr & ~0x6000) | ((e)->__mxcsr & 0x6000); \ ++ asm volatile ("ldmxcsr %0" : : "m" (*&mxcsr)); \ ++ } \ ++}) diff --git a/src/patches/glibc/glibc-rh966778.patch b/src/patches/glibc/glibc-rh966778.patch new file mode 100644 index 000000000..d8fd3fa27 --- /dev/null +++ b/src/patches/glibc/glibc-rh966778.patch @@ -0,0 +1,54 @@ +commit 3056dcdb783a177158a5617657d1a33f872358d6 +Author: Ulrich Drepper +Date: Mon Nov 22 11:11:24 2010 -0500 + + Fix multiple nss_compat initgroups() bugs + + Compat initgroups() is completely broken; the code will always set + skip_initgroups_dyn to true, so initgroups() will never be actually + called, but due to the nature of the code, setgrent() won't be called + either - thus, subsequent invocations of initgroups() will not return + the NIS group list anymore. + + This is a simple patch that makes sure skip_initgroups_dyn is set only + in case initgroups is not available; it also attempts to handle the + unavailability of other NSS interfaces better. + + Conflicts: + + ChangeLog + +diff --git a/nis/nss_compat/compat-initgroups.c b/nis/nss_compat/compat-initgroups.c +index 07a3b92..de8d95c 100644 +--- a/nis/nss_compat/compat-initgroups.c ++++ b/nis/nss_compat/compat-initgroups.c +@@ -474,18 +474,21 @@ internal_getgrent_r (ent_t *ent, char *buffer, size_t buflen, const char *user, + /* If the selected module does not support getgrent_r or + initgroups_dyn, abort. We cannot find the needed group + entries. */ +- if (nss_getgrent_r == NULL && nss_initgroups_dyn == NULL) ++ if (nss_initgroups_dyn == NULL || nss_getgrgid_r == NULL) ++ { ++ if (nss_setgrent != NULL) ++ { ++ nss_setgrent (1); ++ ent->need_endgrent = true; ++ } ++ ent->skip_initgroups_dyn = true; ++ } ++ ++ if (ent->skip_initgroups_dyn && nss_getgrent_r == NULL) + return NSS_STATUS_UNAVAIL; + + ent->files = false; + +- if (nss_initgroups_dyn == NULL && nss_setgrent != NULL) +- { +- nss_setgrent (1); +- ent->need_endgrent = true; +- } +- ent->skip_initgroups_dyn = true; +- + return getgrent_next_nss (ent, buffer, buflen, user, group, + start, size, groupsp, limit, errnop); + } diff --git a/src/patches/glibc/glibc-rh970090.patch b/src/patches/glibc/glibc-rh970090.patch new file mode 100644 index 000000000..601062477 --- /dev/null +++ b/src/patches/glibc/glibc-rh970090.patch @@ -0,0 +1,24 @@ +diff -pruN glibc-2.18/nscd/aicache.c glibc-2.18.new/nscd/aicache.c +--- glibc-2.18/nscd/aicache.c 2013-08-11 04:22:55.000000000 +0530 ++++ glibc-2.18.new/nscd/aicache.c 2013-08-26 11:10:25.843470413 +0530 +@@ -25,6 +25,7 @@ + #include + #include + #include ++#include + + #include "dbg_log.h" + #include "nscd.h" +@@ -100,8 +101,11 @@ addhstaiX (struct database_dyn *db, int + no_more = __nss_database_lookup ("hosts", NULL, + "dns [!UNAVAIL=return] files", &nip); + ++ /* Initialize configurations. */ ++ if (__builtin_expect (!_res_hconf.initialized, 0)) ++ _res_hconf_init (); + if (__res_maybe_init (&_res, 0) == -1) +- no_more = 1; ++ no_more = 1; + + /* If we are looking for both IPv4 and IPv6 address we don't want + the lookup functions to automatically promote IPv4 addresses to -- 2.39.2