--- /dev/null
+http://bugs.gentoo.org/315977
+
+diff --git a/posix/gai.conf b/posix/gai.conf
+index 195287e..efba67b 100644
+--- a/posix/gai.conf
++++ b/posix/gai.conf
+@@ -56,9 +56,7 @@
+ #
+ # scopev4 <mask> <value>
+ # Add another rule to the RFC 3484 scope table for IPv4 addresses.
+-# By default the scope IDs described in section 3.2 in RFC 3484 are
+-# used. Changing these defaults should hardly ever be necessary.
+-# The defaults are equivalent to:
++# The definitions in RFC 3484 are equivalent to:
+ #
+ #scopev4 ::ffff:169.254.0.0/112 2
+ #scopev4 ::ffff:127.0.0.0/104 2
+@@ -72,6 +70,6 @@
+ # have the same scope and are therefore not sorted first. To change
+ # this use only these rules:
+ #
+-#scopev4 ::ffff:169.254.0.0/112 2
+-#scopev4 ::ffff:127.0.0.0/104 2
+-#scopev4 ::ffff:0.0.0.0/96 14
++scopev4 ::ffff:169.254.0.0/112 2
++scopev4 ::ffff:127.0.0.0/104 2
++scopev4 ::ffff:0.0.0.0/96 14
--- /dev/null
+http://bugs.gentoo.org/353814
+http://sources.redhat.com/bugzilla/show_bug.cgi?id=12489
+
+From 25b3aadaf646bff18d6527e03717c87bf50b3a50 Mon Sep 17 00:00:00 2001
+From: Andreas Schwab <schwab@redhat.com>
+Date: Tue, 28 Sep 2010 15:11:48 +0200
+Subject: [PATCH] Don't try to write to _rtld_global_ro after performing relro protection
+
+---
+ ChangeLog | 5 +++++
+ elf/rtld.c | 8 ++++----
+ 2 files changed, 9 insertions(+), 4 deletions(-)
+
+2010-09-28 Andreas Schwab <schwab@redhat.com>
+
+ * elf/rtld.c (dl_main): Move setting of GLRO(dl_init_all_dirs)
+ before performing relro protection.
+
+diff --git a/elf/rtld.c b/elf/rtld.c
+index 9a560b3..201c9cf 100644
+--- a/elf/rtld.c
++++ b/elf/rtld.c
+@@ -2168,6 +2168,10 @@ ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n",
+ we need it in the memory handling later. */
+ GLRO(dl_initial_searchlist) = *GL(dl_ns)[LM_ID_BASE]._ns_main_searchlist;
+
++ /* Remember the last search directory added at startup, now that
++ malloc will no longer be the one from dl-minimal.c. */
++ GLRO(dl_init_all_dirs) = GL(dl_all_dirs);
++
+ if (prelinked)
+ {
+ if (main_map->l_info [ADDRIDX (DT_GNU_CONFLICT)] != NULL)
+@@ -2288,10 +2292,6 @@ ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n",
+ lossage);
+ }
+
+- /* Remember the last search directory added at startup, now that
+- malloc will no longer be the one from dl-minimal.c. */
+- GLRO(dl_init_all_dirs) = GL(dl_all_dirs);
+-
+ if (! prelinked && rtld_multiple_ref)
+ {
+ /* There was an explicit ref to the dynamic linker as a shared lib.
+--
+1.7.4.rc2
+
+http://thread.gmane.org/gmane.comp.lib.glibc.user/579
+http://sources.redhat.com/bugzilla/show_bug.cgi?id=11929
+http://bugs.gentoo.org/332927
+
+a simple statically linked app fails with glibc-2.12:
+ $ cat test.c
+ main(){getpwnam("root");}
+ $ gcc -static test.c
+ $ ./a.out
+ a.out: ../sysdeps/unix/sysv/linux/getpagesize.c:32: __getpagesize:
+ Assertion `_rtld_global_ro._dl_pagesize != 0' failed.
+ Aborted (core dumped)
+
+the crux of the matter seems to be the fact that static apps with
+glibc will dynamically load nss shared libraries when necessary. the
+static code will initialize GLRO(dl_pagesize) just fine from the
+kernel auxv, but this being the static code paths, GLRO(dl_pagesize)
+expands into _dl_pagesize. when the nss shared libraries are loaded
+up, the ldso is also mapped in, but it doesnt process the kernel auxv
+(_dl_sysdep_start() is not called). so the shared library
+GLRO(dl_pagesize) expands into _rtld_global_ro._dl_pagesize and that
+field stays at 0.
+
+then when the nss shared libs process the request and gets to the
+standard "passwd" database, it calls the shared lib versions of
+malloc/stdio which rely on the __getpagesize() function. but this
+being in the shared library, it reads the shared GLRO(dl_pagesize)
+which is 0, and the assert() is triggered.
+
+i think running nscd makes things work because its nss module that
+talks to the nscd daemon doesnt call any routines that implicitly rely
+on __getpagesize().
+
+this all started happening after this commit:
+From 8f4a5048eea6536ee85c0f2670adbb97d71e427d Mon Sep 17 00:00:00 2001
+From: Ulrich Drepper <drepper@redhat.com>
+Date: Sat, 27 Mar 2010 06:19:50 -0700
+Subject: [PATCH] Optimize __getpagesize a bit.
+
+if we look at the ia64 port, we see that it has had similar logic for
+its __getpagesize function forever. so take its DL_STATIC_INIT code
+and move it up to the common linux tree.
+
2010-08-18 Mike Frysinger <vapier@gentoo.org>
* sysdeps/unix/sysv/linux/ia64/Makefile: Move dl-static addition to
--- /dev/null
+http://bugs.gentoo.org/353816
+http://sourceware.org/ml/libc-alpha/2011-02/msg00015.html
+
+From 7da767805f0a7301c0c719a6c0fd51d87e193c22 Mon Sep 17 00:00:00 2001
+From: Mike Frysinger <vapier@gentoo.org>
+Date: Sun, 6 Feb 2011 12:39:08 -0500
+Subject: [PATCH] memcpy-ssse3: enable chk symbols in static builds
+
+Building static apps on i686/x86_64 systems which use memmove such as:
+ #include <string.h>
+ char buf[8192];
+ main(int argc, char **argv) { memmove(buf, buf + argc, argc % 4); }
+
+Result in linking errors along the lines of:
+ .../libc.a(memmove_chk.o): In function `__memmove_chk':
+ (.text+0x1b4): undefined reference to `__memmove_chk_ssse3_back'
+ .../libc.a(memmove_chk.o): In function `__memmove_chk':
+ (.text+0x1b9): undefined reference to `__memmove_chk_ssse3'
+ collect2: ld returned 1 exit status
+
+This is due to the new ssse3 funcs only enabling their chk symbols when
+being compiled into shared code.
+
+URL: https://bugs.gentoo.org/353816
+Signed-off-by: Mike Frysinger <vapier@gentoo.org>
+
+2011-02-06 Mike Frysinger <vapier@gentoo.org>
+
+ * sysdeps/i386/i686/multiarch/memcpy-ssse3-rep.S: Only protect
+ MEMCPY_CHK with USE_AS_BCOPY ifdef check.
+ * sysdeps/i386/i686/multiarch/memcpy-ssse3.S: Likewise.
+ * sysdeps/x86_64/multiarch/memcpy-ssse3.S: Likewise.
+ * sysdeps/x86_64/multiarch/memcpy-ssse3-back.S: Likewise.
+---
+ sysdeps/i386/i686/multiarch/memcpy-ssse3-rep.S | 2 +-
+ sysdeps/i386/i686/multiarch/memcpy-ssse3.S | 2 +-
+ sysdeps/x86_64/multiarch/memcpy-ssse3-back.S | 2 +-
+ sysdeps/x86_64/multiarch/memcpy-ssse3.S | 2 +-
+ 4 files changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/sysdeps/i386/i686/multiarch/memcpy-ssse3-rep.S b/sysdeps/i386/i686/multiarch/memcpy-ssse3-rep.S
+index 48a109c..8e81183 100644
+--- a/sysdeps/i386/i686/multiarch/memcpy-ssse3-rep.S
++++ b/sysdeps/i386/i686/multiarch/memcpy-ssse3-rep.S
+@@ -110,7 +110,7 @@ __i686.get_pc_thunk.bx:
+ #endif
+
+ .section .text.ssse3,"ax",@progbits
+-#if defined SHARED && !defined NOT_IN_libc && !defined USE_AS_BCOPY
++#if !defined USE_AS_BCOPY
+ ENTRY (MEMCPY_CHK)
+ movl 12(%esp), %eax
+ cmpl %eax, 16(%esp)
+diff --git a/sysdeps/i386/i686/multiarch/memcpy-ssse3.S b/sysdeps/i386/i686/multiarch/memcpy-ssse3.S
+index ec9eeb9..f64f8d2 100644
+--- a/sysdeps/i386/i686/multiarch/memcpy-ssse3.S
++++ b/sysdeps/i386/i686/multiarch/memcpy-ssse3.S
+@@ -110,7 +110,7 @@ __i686.get_pc_thunk.bx:
+ #endif
+
+ .section .text.ssse3,"ax",@progbits
+-#if defined SHARED && !defined NOT_IN_libc && !defined USE_AS_BCOPY
++#if !defined USE_AS_BCOPY
+ ENTRY (MEMCPY_CHK)
+ movl 12(%esp), %eax
+ cmpl %eax, 16(%esp)
+diff --git a/sysdeps/x86_64/multiarch/memcpy-ssse3-back.S b/sysdeps/x86_64/multiarch/memcpy-ssse3-back.S
+index 48c974e..bdd114a 100644
+--- a/sysdeps/x86_64/multiarch/memcpy-ssse3-back.S
++++ b/sysdeps/x86_64/multiarch/memcpy-ssse3-back.S
+@@ -49,7 +49,7 @@
+ ud2
+
+ .section .text.ssse3,"ax",@progbits
+-#if defined SHARED && !defined NOT_IN_libc
++#if !defined USE_AS_BCOPY
+ ENTRY (MEMCPY_CHK)
+ cmpq %rdx, %rcx
+ jb HIDDEN_JUMPTARGET (__chk_fail)
+diff --git a/sysdeps/x86_64/multiarch/memcpy-ssse3.S b/sysdeps/x86_64/multiarch/memcpy-ssse3.S
+index 9a878d3..cd7e45f 100644
+--- a/sysdeps/x86_64/multiarch/memcpy-ssse3.S
++++ b/sysdeps/x86_64/multiarch/memcpy-ssse3.S
+@@ -49,7 +49,7 @@
+ ud2
+
+ .section .text.ssse3,"ax",@progbits
+-#if defined SHARED && !defined NOT_IN_libc
++#if !defined USE_AS_BCOPY
+ ENTRY (MEMCPY_CHK)
+ cmpq %rdx, %rcx
+ jb HIDDEN_JUMPTARGET (__chk_fail)
+--
+1.7.4.rc2
+
--- /dev/null
+http://bugs.gentoo.org/353816
+http://sourceware.org/ml/libc-alpha/2011-02/msg00152.html
+
+From 87fac357a6243982ce21cb71e21bbe0d35234eed Mon Sep 17 00:00:00 2001
+From: Mike Frysinger <vapier@gentoo.org>
+Date: Tue, 22 Feb 2011 13:26:19 -0500
+Subject: [PATCH] memset: fix define usage for shared libs
+
+The proper define to check "am I in a shared lib" is "SHARED", not "PIC".
+The two new memset_chk functions incorrectly depend on "PIC".
+
+Signed-off-by: Mike Frysinger <vapier@gentoo.org>
+
+2011-02-22 Mike Frysinger <vapier@gentoo.org>
+
+ * sysdeps/i386/i686/memset_chk.S: Change PIC to SHARED.
+ * sysdeps/x86_64/memset_chk.S: Likewise.
+---
+ sysdeps/i386/i686/memset_chk.S | 2 +-
+ sysdeps/x86_64/memset_chk.S | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/sysdeps/i386/i686/memset_chk.S b/sysdeps/i386/i686/memset_chk.S
+index cd93d5e..e7511a0 100644
+--- a/sysdeps/i386/i686/memset_chk.S
++++ b/sysdeps/i386/i686/memset_chk.S
+@@ -20,7 +20,7 @@
+ #include <sysdep.h>
+ #include "asm-syntax.h"
+
+-#ifndef PIC
++#ifndef SHARED
+ /* For libc.so this is defined in memset.S.
+ For libc.a, this is a separate source to avoid
+ memset bringing in __chk_fail and all routines
+diff --git a/sysdeps/x86_64/memset_chk.S b/sysdeps/x86_64/memset_chk.S
+index c1c8c23..2c4fffc 100644
+--- a/sysdeps/x86_64/memset_chk.S
++++ b/sysdeps/x86_64/memset_chk.S
+@@ -20,7 +20,7 @@
+ #include <sysdep.h>
+ #include "asm-syntax.h"
+
+-#ifndef PIC
++#ifndef SHARED
+ /* For libc.so this is defined in memset.S.
+ For libc.a, this is a separate source to avoid
+ memset bringing in __chk_fail and all routines
+--
+1.7.4.1
+
--- /dev/null
+ripped from SuSE
+
+if /etc/resolv.conf is updated, then make sure applications
+already running get the updated information.
+
+http://bugs.gentoo.org/177416
+
+--- libc/resolv/res_libc.c
++++ libc/resolv/res_libc.c
+@@ -22,6 +22,7 @@
+ #include <arpa/nameser.h>
+ #include <resolv.h>
+ #include <bits/libc-lock.h>
++#include <sys/stat.h>
+
+
+ /* The following bit is copied from res_data.c (where it is #ifdef'ed
+@@ -101,6 +102,20 @@
+ __res_maybe_init (res_state resp, int preinit)
+ {
+ if (resp->options & RES_INIT) {
++ static time_t last_mtime, last_check;
++ time_t now;
++ struct stat statbuf;
++
++ time (&now);
++ if (now != last_check) {
++ last_check = now;
++ if (stat (_PATH_RESCONF, &statbuf) == 0 && last_mtime != statbuf.st_mtime) {
++ last_mtime = statbuf.st_mtime;
++ atomicinclock (lock);
++ atomicinc (__res_initstamp);
++ atomicincunlock (lock);
++ }
++ }
+ if (__res_initstamp != resp->_u._ext.initstamp) {
+ if (resp->nscount > 0) {
+ __res_nclose (resp);
--- /dev/null
+ripped from Debian
+
+---
+ sysdeps/unix/sysv/linux/posix_fadvise.c | 13 +++++++++++++
+ 1 file changed, 13 insertions(+)
+
+--- a/sysdeps/unix/sysv/linux/posix_fadvise.c
++++ b/sysdeps/unix/sysv/linux/posix_fadvise.c
+@@ -35,6 +35,19 @@
+ return INTERNAL_SYSCALL_ERRNO (ret, err);
+ return 0;
+ #else
++# ifdef __NR_fadvise64_64
++ INTERNAL_SYSCALL_DECL (err);
++ int ret = INTERNAL_SYSCALL (fadvise64_64, err, 6, fd,
++ __LONG_LONG_PAIR ((long) (offset >> 31),
++ (long) offset),
++ __LONG_LONG_PAIR ((long) (len >> 31),
++ (long) len),
++ advise);
++ if (INTERNAL_SYSCALL_ERROR_P (ret, err))
++ return INTERNAL_SYSCALL_ERRNO (ret, err);
++ return 0;
++# else
+ return ENOSYS;
++# endif
+ #endif
+ }
+++ /dev/null
-From 5d480f5343de00e54b8602c6787640f9831f46b7 Mon Sep 17 00:00:00 2001
-From: Mike Frysinger <vapier@gentoo.org>
-Date: Sun, 6 Feb 2011 12:39:08 -0500
-Subject: [PATCH] memcpy-ssse3: enable chk symbols in static builds
-
-Building static apps on x86_64 systems which use memmove such as:
- #include <string.h>
- char buf[8192];
- main(int argc, char **argv) { memmove(buf, buf + argc, argc % 4); }
-
-Result in linking errors along the lines of:
- .../libc.a(memmove_chk.o): In function `__memmove_chk':
- (.text+0x1b4): undefined reference to `__memmove_chk_ssse3_back'
- .../libc.a(memmove_chk.o): In function `__memmove_chk':
- (.text+0x1b9): undefined reference to `__memmove_chk_ssse3'
- collect2: ld returned 1 exit status
-
-This is due to the new ssse3 funcs only enabling their chk symbols when
-being compiled into shared code.
-
-URL: https://bugs.gentoo.org/353816
-Signed-off-by: Mike Frysinger <vapier@gentoo.org>
-
-2011-02-06 Mike Frysinger <vapier@gentoo.org>
-
- * sysdeps/x86_64/multiarch/memcpy-ssse3.S: Delete SHARED ifdef check
- around MEMCPY_CHK symbol.
- * sysdeps/x86_64/multiarch/memcpy-ssse3-back.S: Likewise.
----
- sysdeps/x86_64/multiarch/memcpy-ssse3-back.S | 2 +-
- sysdeps/x86_64/multiarch/memcpy-ssse3.S | 2 +-
- 2 files changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/sysdeps/x86_64/multiarch/memcpy-ssse3-back.S b/sysdeps/x86_64/multiarch/memcpy-ssse3-back.S
-index 48c974e..a6a01a8 100644
---- a/sysdeps/x86_64/multiarch/memcpy-ssse3-back.S
-+++ b/sysdeps/x86_64/multiarch/memcpy-ssse3-back.S
-@@ -49,7 +49,7 @@
- ud2
-
- .section .text.ssse3,"ax",@progbits
--#if defined SHARED && !defined NOT_IN_libc
-+#if !defined NOT_IN_libc
- ENTRY (MEMCPY_CHK)
- cmpq %rdx, %rcx
- jb HIDDEN_JUMPTARGET (__chk_fail)
-diff --git a/sysdeps/x86_64/multiarch/memcpy-ssse3.S b/sysdeps/x86_64/multiarch/memcpy-ssse3.S
-index 9a878d3..ce84e3f 100644
---- a/sysdeps/x86_64/multiarch/memcpy-ssse3.S
-+++ b/sysdeps/x86_64/multiarch/memcpy-ssse3.S
-@@ -49,7 +49,7 @@
- ud2
-
- .section .text.ssse3,"ax",@progbits
--#if defined SHARED && !defined NOT_IN_libc
-+#if !defined NOT_IN_libc
- ENTRY (MEMCPY_CHK)
- cmpq %rdx, %rcx
- jb HIDDEN_JUMPTARGET (__chk_fail)
---
-1.7.4.rc2
-
Summary(uk.UTF-8): GNU libc версії
Name: glibc
Version: 2.13
-Release: 4
+Release: 5
Epoch: 6
License: LGPL v2.1+
Group: Libraries
Patch26: %{name}-posix-sh.patch
Patch27: %{name}-i686.patch
Patch29: %{name}-arm-alignment-fix.patch
-Patch30: %{name}-static-glro-init.patch
+Patch30: %{name}-bug-12492.patch
Patch31: %{name}-origin.patch
Patch32: %{name}-Os-fail-workaround.patch
-Patch33: %{name}-2.13-static-memmove-ssse3.patch
-Patch34: %{name}-bug-12492.patch
+Patch33: 0020_all_glibc-tweak-rfc1918-lookup.patch
+Patch34: 0050_all_glibc-2.13-ldso-prelink-segv.patch
+Patch35: 0055_all_glibc-2.12-static-shared-getpagesize.patch
+Patch36: 0060_all_glibc-2.13-static-memmove-ssse3.patch
+Patch37: 0061_all_glibc-2.13-static-memset.patch
+Patch38: 1055_all_glibc-resolv-dynamic.patch
+Patch39: 1070_all_glibc-fadvise64_64.patch
URL: http://www.gnu.org/software/libc/
%{?with_selinux:BuildRequires: audit-libs-devel}
BuildRequires: autoconf
%patch26 -p1
%patch27 -p1
%patch29 -p1
-%patch30 -p1
+%patch30 -p0
%patch31 -p1
%patch32 -p1
%patch33 -p1
-%patch34 -p0
+%patch34 -p1
+%patch35 -p1
+%patch36 -p1
+%patch37 -p1
+%patch38 -p1
+%patch39 -p1
# cleanup backups after patching
find '(' -name '*~' -o -name '*.orig' ')' -print0 | xargs -0 -r -l512 rm -f
+++ /dev/null
-description "Starts the Name Switch Cache Daemon"
-
-# as soon as /usr is mounted
-start on local-filesystems
-stop on pld.shutdown-started
-
-respawn
-
-expect daemon
-exec /usr/sbin/nscd