mirror of
https://github.com/vincentmli/bpfire.git
synced 2026-04-27 03:07:43 +02:00
toolchain: glibc: Cross build package and import patches from RHEL6.
This commit is contained in:
35
src/patches/glibc-resolv-stack_chk_fail.patch
Normal file
35
src/patches/glibc-resolv-stack_chk_fail.patch
Normal file
@@ -0,0 +1,35 @@
|
||||
From e057a1b5930ec538c2b8abbba700a436ef2c81d5 Mon Sep 17 00:00:00 2001
|
||||
From: Joseph Myers <joseph@codesourcery.com>
|
||||
Date: Wed, 21 Sep 2011 13:27:50 -0700
|
||||
Subject: [PATCH] Link libresolv.so with ld.so for __stack_chk_guard.
|
||||
|
||||
---
|
||||
resolv/Makefile | 8 +++++++-
|
||||
1 files changed, 7 insertions(+), 1 deletions(-)
|
||||
|
||||
diff --git a/resolv/Makefile b/resolv/Makefile
|
||||
index ec3788f..b4287de 100644
|
||||
--- a/resolv/Makefile
|
||||
+++ b/resolv/Makefile
|
||||
@@ -1,4 +1,5 @@
|
||||
-# Copyright (C) 1994-2001,2003,2004,2007,2008 Free Software Foundation, Inc.
|
||||
+# Copyright (C) 1994-2001,2003,2004,2007,2008,2011
|
||||
+# 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
|
||||
@@ -88,6 +89,11 @@ CFLAGS-res_hconf.c = -fexceptions
|
||||
# This ensures they will load libc.so for needed symbols if loaded by
|
||||
# a statically-linked program that hasn't already loaded it.
|
||||
$(objpfx)libresolv.so: $(common-objpfx)libc.so $(common-objpfx)libc_nonshared.a
|
||||
+# Some hosts need '__stack_chk_guard', so pull in the definition from
|
||||
+# ld.so if required.
|
||||
+ifeq (yesyes,$(have-ssp)$(elf))
|
||||
+LDLIBS-resolv.so += $(as-needed) $(elfobjdir)/ld.so $(no-as-needed)
|
||||
+endif
|
||||
|
||||
# The DNS NSS modules needs the resolver.
|
||||
$(objpfx)libnss_dns.so: $(objpfx)libresolv.so $(common-objpfx)libc.so \
|
||||
--
|
||||
1.7.3.4
|
||||
|
||||
87
src/patches/glibc/glibc-aliasing.patch
Normal file
87
src/patches/glibc/glibc-aliasing.patch
Normal file
@@ -0,0 +1,87 @@
|
||||
Index: glibc-2.12-2-gc4ccff1/elf/Makefile
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/elf/Makefile
|
||||
+++ glibc-2.12-2-gc4ccff1/elf/Makefile
|
||||
@@ -129,6 +129,7 @@ include ../Makeconfig
|
||||
ifeq ($(unwind-find-fde),yes)
|
||||
routines += unwind-dw2-fde-glibc
|
||||
shared-only-routines += unwind-dw2-fde-glibc
|
||||
+CFLAGS-unwind-dw2-fde-glibc.c += -fno-strict-aliasing
|
||||
endif
|
||||
|
||||
before-compile = $(objpfx)trusted-dirs.h
|
||||
Index: glibc-2.12-2-gc4ccff1/inet/Makefile
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/inet/Makefile
|
||||
+++ glibc-2.12-2-gc4ccff1/inet/Makefile
|
||||
@@ -57,6 +57,8 @@ tests := htontest test_ifindex tst-ntoa
|
||||
|
||||
include ../Rules
|
||||
|
||||
+CFLAGS-tst-inet6_rth.c += -fno-strict-aliasing
|
||||
+
|
||||
ifeq ($(have-thread-library),yes)
|
||||
|
||||
CFLAGS-gethstbyad_r.c = -DUSE_NSCD=1 -fexceptions
|
||||
Index: glibc-2.12-2-gc4ccff1/nis/Makefile
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/nis/Makefile
|
||||
+++ glibc-2.12-2-gc4ccff1/nis/Makefile
|
||||
@@ -69,6 +69,8 @@ libnss_nisplus-inhibit-o = $(filter-out
|
||||
|
||||
include ../Rules
|
||||
|
||||
+CFLAGS-nis_findserv.c += -fno-strict-aliasing
|
||||
+CFLAGS-ypclnt.c += -fno-strict-aliasing
|
||||
|
||||
$(objpfx)libnss_compat.so: $(objpfx)libnsl.so$(libnsl.so-version)
|
||||
$(objpfx)libnss_nis.so: $(objpfx)libnsl.so$(libnsl.so-version) \
|
||||
Index: glibc-2.12-2-gc4ccff1/nss/Makefile
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/nss/Makefile
|
||||
+++ glibc-2.12-2-gc4ccff1/nss/Makefile
|
||||
@@ -74,6 +74,7 @@ endif
|
||||
|
||||
include ../Rules
|
||||
|
||||
+CFLAGS-files-hosts.c += -fno-strict-aliasing
|
||||
|
||||
ifeq (yes,$(build-static-nss))
|
||||
$(objpfx)getent: $(objpfx)libnss_files.a
|
||||
Index: glibc-2.12-2-gc4ccff1/resolv/Makefile
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/resolv/Makefile
|
||||
+++ glibc-2.12-2-gc4ccff1/resolv/Makefile
|
||||
@@ -77,6 +77,7 @@ CPPFLAGS += -Dgethostbyname=res_gethostb
|
||||
-Dgetnetbyaddr=res_getnetbyaddr
|
||||
|
||||
CFLAGS-res_hconf.c = -fexceptions
|
||||
+CFLAGS-res_send.c += -fno-strict-aliasing
|
||||
|
||||
# The BIND code elicits some harmless warnings.
|
||||
+cflags += -Wno-strict-prototypes -Wno-write-strings
|
||||
Index: glibc-2.12-2-gc4ccff1/sunrpc/Makefile
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/sunrpc/Makefile
|
||||
+++ glibc-2.12-2-gc4ccff1/sunrpc/Makefile
|
||||
@@ -129,6 +129,10 @@ CFLAGS-openchild.c = -fexceptions
|
||||
|
||||
CPPFLAGS += -D_RPC_THREAD_SAFE_
|
||||
|
||||
+CFLAGS-clnt_tcp.c += -fno-strict-aliasing
|
||||
+CFLAGS-clnt_udp.c += -fno-strict-aliasing
|
||||
+CFLAGS-clnt_unix.c += -fno-strict-aliasing
|
||||
+
|
||||
include ../Rules
|
||||
|
||||
$(objpfx)rpcgen: $(addprefix $(objpfx),$(rpcgen-objs)) \
|
||||
Index: glibc-2.12-2-gc4ccff1/sysdeps/powerpc/powerpc64/elf/Makefile
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/sysdeps/powerpc/powerpc64/elf/Makefile
|
||||
+++ glibc-2.12-2-gc4ccff1/sysdeps/powerpc/powerpc64/elf/Makefile
|
||||
@@ -9,3 +9,5 @@ CFLAGS-rtld-mempcpy.os = $(no-special-re
|
||||
CFLAGS-rtld-memmove.os = $(no-special-regs)
|
||||
CFLAGS-rtld-memchr.os = $(no-special-regs)
|
||||
CFLAGS-rtld-strnlen.os = $(no-special-regs)
|
||||
+
|
||||
+CFLAGS-gmon-start.c += -fno-strict-aliasing
|
||||
2106
src/patches/glibc/glibc-fedora.patch
Normal file
2106
src/patches/glibc/glibc-fedora.patch
Normal file
File diff suppressed because it is too large
Load Diff
36
src/patches/glibc/glibc-getlogin-r.patch
Normal file
36
src/patches/glibc/glibc-getlogin-r.patch
Normal file
@@ -0,0 +1,36 @@
|
||||
2010-05-05 Ulrich Drepper <drepper@redhat.com>
|
||||
|
||||
[BZ #11571]
|
||||
* sysdeps/unix/sysv/linux/getlogin_r.c (__getlogin_r_loginuid): Handle
|
||||
too small buffers according to the standard.
|
||||
|
||||
Index: glibc-2.12-2-gc4ccff1/sysdeps/unix/sysv/linux/getlogin_r.c
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/sysdeps/unix/sysv/linux/getlogin_r.c
|
||||
+++ glibc-2.12-2-gc4ccff1/sysdeps/unix/sysv/linux/getlogin_r.c
|
||||
@@ -81,13 +81,22 @@ __getlogin_r_loginuid (name, namesize)
|
||||
if (tpwd == NULL)
|
||||
goto fail;
|
||||
|
||||
- strncpy (name, pwd.pw_name, namesize - 1);
|
||||
- name[namesize - 1] = '\0';
|
||||
+ int result = 0;
|
||||
+ size_t needed = strlen (pwd.pw_name) + 1;
|
||||
+ if (needed > namesize)
|
||||
+ {
|
||||
+ __set_errno (ERANGE);
|
||||
+ result = ERANGE;
|
||||
+ goto out;
|
||||
+ }
|
||||
|
||||
+ memcpy (name, pwd.pw_name, needed);
|
||||
+
|
||||
+ out:
|
||||
if (use_malloc)
|
||||
free (buf);
|
||||
|
||||
- return 0;
|
||||
+ return result;
|
||||
}
|
||||
|
||||
|
||||
18
src/patches/glibc/glibc-localedata.patch
Normal file
18
src/patches/glibc/glibc-localedata.patch
Normal file
@@ -0,0 +1,18 @@
|
||||
2010-05-04 Andreas Schwab <schwab@redhat.com>
|
||||
|
||||
* SUPPORTED (SUPPORTED-LOCALES): Fix name of tt_RU.UTF-8@iqtelif
|
||||
locale.
|
||||
|
||||
Index: glibc-2.12-2-gc4ccff1/localedata/SUPPORTED
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/localedata/SUPPORTED
|
||||
+++ glibc-2.12-2-gc4ccff1/localedata/SUPPORTED
|
||||
@@ -392,7 +392,7 @@ tr_TR.UTF-8/UTF-8 \
|
||||
tr_TR/ISO-8859-9 \
|
||||
ts_ZA/UTF-8 \
|
||||
tt_RU.UTF-8/UTF-8 \
|
||||
-tt_RU@iqtelif.UTF-8/UTF-8 \
|
||||
+tt_RU.UTF-8@iqtelif/UTF-8 \
|
||||
ug_CN/UTF-8 \
|
||||
uk_UA.UTF-8/UTF-8 \
|
||||
uk_UA/KOI8-U \
|
||||
182
src/patches/glibc/glibc-recvmmsg.patch
Normal file
182
src/patches/glibc/glibc-recvmmsg.patch
Normal file
@@ -0,0 +1,182 @@
|
||||
2010-05-21 Andreas Schwab <schwab@redhat.com>
|
||||
|
||||
* sysdeps/unix/sysv/linux/Makefile (sysdep_routines): Add recvmmsg
|
||||
and internal_recvmmsg.
|
||||
* sysdeps/unix/sysv/linux/recvmmsg.c: New file.
|
||||
* sysdeps/unix/sysv/linux/internal_recvmmsg.S: New file.
|
||||
* sysdeps/unix/sysv/linux/socketcall.h (SOCKOP_recvmmsg): Define.
|
||||
* sysdeps/unix/sysv/linux/syscalls.list (recvmmsg): Remove.
|
||||
|
||||
Index: glibc-2.12-2-gc4ccff1/sysdeps/unix/sysv/linux/Makefile
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/sysdeps/unix/sysv/linux/Makefile
|
||||
+++ glibc-2.12-2-gc4ccff1/sysdeps/unix/sysv/linux/Makefile
|
||||
@@ -12,7 +12,7 @@ CFLAGS-malloc.c += -DMORECORE_CLEARS=2
|
||||
endif
|
||||
|
||||
ifeq ($(subdir),socket)
|
||||
-sysdep_routines += internal_accept4
|
||||
+sysdep_routines += internal_accept4 recvmmsg internal_recvmmsg
|
||||
endif
|
||||
|
||||
ifeq ($(subdir),misc)
|
||||
Index: glibc-2.12-2-gc4ccff1/sysdeps/unix/sysv/linux/internal_recvmmsg.S
|
||||
===================================================================
|
||||
--- /dev/null
|
||||
+++ glibc-2.12-2-gc4ccff1/sysdeps/unix/sysv/linux/internal_recvmmsg.S
|
||||
@@ -0,0 +1,14 @@
|
||||
+#include <kernel-features.h>
|
||||
+#include <sys/syscall.h>
|
||||
+#if !defined __NR_recvmmsg && defined __NR_socketcall
|
||||
+# define socket recvmmsg
|
||||
+# ifdef __ASSUME_RECVMMSG
|
||||
+# define __socket recvmmsg
|
||||
+# else
|
||||
+# define __socket __internal_recvmmsg
|
||||
+# endif
|
||||
+# define NARGS 5
|
||||
+# define NEED_CANCELLATION
|
||||
+# define NO_WEAK_ALIAS
|
||||
+# include <socket.S>
|
||||
+#endif
|
||||
Index: glibc-2.12-2-gc4ccff1/sysdeps/unix/sysv/linux/kernel-features.h
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/sysdeps/unix/sysv/linux/kernel-features.h
|
||||
+++ glibc-2.12-2-gc4ccff1/sysdeps/unix/sysv/linux/kernel-features.h
|
||||
@@ -547,3 +547,8 @@
|
||||
#if __LINUX_KERNEL_VERSION >= 0x020620
|
||||
# define __ASSUME_F_GETOWN_EX 1
|
||||
#endif
|
||||
+
|
||||
+/* Support for the recvmmsg syscall was added in 2.6.33. */
|
||||
+#if __LINUX_KERNEL_VERSION >= 0x020621
|
||||
+# define __ASSUME_RECVMMSG 1
|
||||
+#endif
|
||||
Index: glibc-2.12-2-gc4ccff1/sysdeps/unix/sysv/linux/recvmmsg.c
|
||||
===================================================================
|
||||
--- /dev/null
|
||||
+++ glibc-2.12-2-gc4ccff1/sysdeps/unix/sysv/linux/recvmmsg.c
|
||||
@@ -0,0 +1,100 @@
|
||||
+/* Copyright (C) 2010 Free Software Foundation, Inc.
|
||||
+ This file is part of the GNU C Library.
|
||||
+ Contributed by Andreas Schwab <schwab@redhat.com>, 2010.
|
||||
+
|
||||
+ The GNU C Library is free software; you can redistribute it and/or
|
||||
+ modify it under the terms of the GNU Lesser General Public
|
||||
+ License as published by the Free Software Foundation; either
|
||||
+ version 2.1 of the License, or (at your option) any later version.
|
||||
+
|
||||
+ The GNU C Library is distributed in the hope that it will be useful,
|
||||
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
+ Lesser General Public License for more details.
|
||||
+
|
||||
+ You should have received a copy of the GNU Lesser General Public
|
||||
+ License along with the GNU C Library; if not, write to the Free
|
||||
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
+ 02111-1307 USA. */
|
||||
+
|
||||
+#include <errno.h>
|
||||
+#include <sys/socket.h>
|
||||
+
|
||||
+#include <sysdep-cancel.h>
|
||||
+#include <sys/syscall.h>
|
||||
+#include <kernel-features.h>
|
||||
+
|
||||
+
|
||||
+#ifdef __NR_recvmmsg
|
||||
+int
|
||||
+recvmmsg (int fd, struct mmsghdr *vmessages, unsigned int vlen, int flags,
|
||||
+ const struct timespec *tmo)
|
||||
+{
|
||||
+ if (SINGLE_THREAD_P)
|
||||
+ return INLINE_SYSCALL (recvmmsg, 5, fd, vmessages, vlen, flags, tmo);
|
||||
+
|
||||
+ int oldtype = LIBC_CANCEL_ASYNC ();
|
||||
+
|
||||
+ int result = INLINE_SYSCALL (recvmmsg, 5, fd, vmessages, vlen, flags, tmo);
|
||||
+
|
||||
+ LIBC_CANCEL_RESET (oldtype);
|
||||
+
|
||||
+ return result;
|
||||
+}
|
||||
+#elif defined __NR_socketcall
|
||||
+# ifndef __ASSUME_RECVMMSG
|
||||
+extern int __internal_recvmmsg (int fd, struct mmsghdr *vmessages,
|
||||
+ unsigned int vlen, int flags,
|
||||
+ const struct timespec *tmo)
|
||||
+ attribute_hidden;
|
||||
+
|
||||
+static int have_recvmmsg;
|
||||
+
|
||||
+int
|
||||
+recvmmsg (int fd, struct mmsghdr *vmessages, unsigned int vlen, int flags,
|
||||
+ const struct timespec *tmo)
|
||||
+{
|
||||
+ if (__builtin_expect (have_recvmmsg >= 0, 1))
|
||||
+ {
|
||||
+ int ret = __internal_recvmmsg (fd, vmessages, vlen, flags, tmo);
|
||||
+ /* The kernel returns -EINVAL for unknown socket operations.
|
||||
+ We need to convert that error to an ENOSYS error. */
|
||||
+ if (__builtin_expect (ret < 0, 0)
|
||||
+ && have_recvmmsg == 0
|
||||
+ && errno == EINVAL)
|
||||
+ {
|
||||
+ /* Try another call, this time with an invalid file
|
||||
+ descriptor and all other parameters cleared. This call
|
||||
+ will not cause any harm and it will return
|
||||
+ immediately. */
|
||||
+ ret = __internal_recvmmsg (-1, 0, 0, 0, 0);
|
||||
+ if (errno == EINVAL)
|
||||
+ {
|
||||
+ have_recvmmsg = -1;
|
||||
+ __set_errno (ENOSYS);
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ have_recvmmsg = 1;
|
||||
+ __set_errno (EINVAL);
|
||||
+ }
|
||||
+ return -1;
|
||||
+ }
|
||||
+ return ret;
|
||||
+ }
|
||||
+ __set_errno (ENOSYS);
|
||||
+ return -1;
|
||||
+}
|
||||
+# else
|
||||
+/* When __ASSUME_RECVMMSG recvmmsg is defined in internal_recvmmsg.S. */
|
||||
+# endif
|
||||
+#else
|
||||
+int
|
||||
+recvmmsg (int fd, struct mmsghdr *vmessages, unsigned int vlen, int flags,
|
||||
+ const struct timespec *tmo)
|
||||
+{
|
||||
+ __set_errno (ENOSYS);
|
||||
+ return -1;
|
||||
+}
|
||||
+stub_warning (recvmmsg)
|
||||
+#endif
|
||||
Index: glibc-2.12-2-gc4ccff1/sysdeps/unix/sysv/linux/socketcall.h
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/sysdeps/unix/sysv/linux/socketcall.h
|
||||
+++ glibc-2.12-2-gc4ccff1/sysdeps/unix/sysv/linux/socketcall.h
|
||||
@@ -44,5 +44,6 @@
|
||||
#define SOCKOP_sendmsg 16
|
||||
#define SOCKOP_recvmsg 17
|
||||
#define SOCKOP_accept4 18
|
||||
+#define SOCKOP_recvmmsg 19
|
||||
|
||||
#endif /* sys/socketcall.h */
|
||||
Index: glibc-2.12-2-gc4ccff1/sysdeps/unix/sysv/linux/syscalls.list
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/sysdeps/unix/sysv/linux/syscalls.list
|
||||
+++ glibc-2.12-2-gc4ccff1/sysdeps/unix/sysv/linux/syscalls.list
|
||||
@@ -53,7 +53,6 @@ prctl EXTRA prctl i:iiiii __prctl prc
|
||||
putpmsg - putpmsg i:ippii putpmsg
|
||||
query_module EXTRA query_module i:sipip query_module
|
||||
quotactl EXTRA quotactl i:isip quotactl
|
||||
-recvmmsg EXTRA recvmmsg Ci:ipiip recvmmsg
|
||||
remap_file_pages - remap_file_pages i:piiii __remap_file_pages remap_file_pages
|
||||
sched_getp - sched_getparam i:ip __sched_getparam sched_getparam
|
||||
sched_gets - sched_getscheduler i:i __sched_getscheduler sched_getscheduler
|
||||
296
src/patches/glibc/glibc-rh580498.patch
Normal file
296
src/patches/glibc/glibc-rh580498.patch
Normal file
@@ -0,0 +1,296 @@
|
||||
2010-07-03 Ulrich Drepper <drepper@redhat.com>
|
||||
|
||||
* tst-abstime.c (do_test): Some more cleanups
|
||||
|
||||
2010-07-02 Ulrich Drepper <drepper@redhat.com>
|
||||
|
||||
* tst-abstime.c: Correct testing and add test for sem_timedwait.
|
||||
|
||||
2010-07-01 Andreas Schwab <schwab@redhat.com>
|
||||
Ulrich Drepper <drepper@redhat.com>
|
||||
|
||||
* Makefile (tests): Add tst-abstime.
|
||||
* tst-abstime.c: New file.
|
||||
* sysdeps/unix/sysv/linux/i386/i486/lowlevellock.S
|
||||
(__lll_timedlock_wait): Check for timestamp before the Epoch.
|
||||
* sysdeps/unix/sysv/linux/x86_64/lowlevellock.S
|
||||
(__lll_timedlock_wait): Likewise.
|
||||
* sysdeps/unix/sysv/linux/x86_64/lowlevelrobustlock.S
|
||||
(__lll_robust_timedlock_wait): Likewise.
|
||||
* sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S
|
||||
(__pthread_cond_timedwait): Likewise.
|
||||
* sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_timedrdlock.S
|
||||
(pthread_rwlock_timedrdlock): Likewise.
|
||||
* sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_timedwrlock.S
|
||||
(pthread_rwlock_timedwrlock): Likewise.
|
||||
* sysdeps/unix/sysv/linux/x86_64/sem_timedwait.S (sem_timedwait):
|
||||
Likewise.
|
||||
|
||||
Index: glibc-2.12-2-gc4ccff1/nptl/Makefile
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/nptl/Makefile
|
||||
+++ glibc-2.12-2-gc4ccff1/nptl/Makefile
|
||||
@@ -256,6 +256,7 @@ tests = tst-typesizes \
|
||||
tst-sched1 \
|
||||
tst-backtrace1 \
|
||||
tst-oddstacklimit \
|
||||
+ tst-abstime \
|
||||
tst-vfork1 tst-vfork2 tst-vfork1x tst-vfork2x \
|
||||
tst-getpid1 tst-getpid2 tst-getpid3 \
|
||||
tst-initializers1 $(patsubst %,tst-initializers1-%,c89 gnu89 c99 gnu99)
|
||||
Index: glibc-2.12-2-gc4ccff1/nptl/sysdeps/unix/sysv/linux/i386/i486/lowlevellock.S
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/nptl/sysdeps/unix/sysv/linux/i386/i486/lowlevellock.S
|
||||
+++ glibc-2.12-2-gc4ccff1/nptl/sysdeps/unix/sysv/linux/i386/i486/lowlevellock.S
|
||||
@@ -188,6 +188,9 @@ __lll_timedlock_wait:
|
||||
je .Lreltmo
|
||||
# endif
|
||||
|
||||
+ cmpl $0, (%edx)
|
||||
+ js 8f
|
||||
+
|
||||
movl %ecx, %ebx
|
||||
movl %esi, %ecx
|
||||
movl %edx, %esi
|
||||
@@ -223,6 +226,9 @@ __lll_timedlock_wait:
|
||||
cfi_restore(%ebp)
|
||||
ret
|
||||
|
||||
+8: movl $ETIMEDOUT, %eax
|
||||
+ jmp 7b
|
||||
+
|
||||
# ifndef __ASSUME_FUTEX_CLOCK_REALTIME
|
||||
.Lreltmo:
|
||||
/* Check for a valid timeout value. */
|
||||
Index: glibc-2.12-2-gc4ccff1/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S
|
||||
+++ glibc-2.12-2-gc4ccff1/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S
|
||||
@@ -169,9 +169,13 @@ __lll_timedlock_wait:
|
||||
je .Lreltmo
|
||||
# endif
|
||||
|
||||
+ cmpq $0, (%rdx)
|
||||
+ js 5f
|
||||
+
|
||||
pushq %r9
|
||||
cfi_adjust_cfa_offset(8)
|
||||
cfi_rel_offset(%r9, 0)
|
||||
+
|
||||
movq %rdx, %r10
|
||||
movl $0xffffffff, %r9d
|
||||
LOAD_FUTEX_WAIT_ABS (%esi)
|
||||
@@ -202,6 +206,9 @@ __lll_timedlock_wait:
|
||||
cfi_restore(%r9)
|
||||
retq
|
||||
|
||||
+5: movl $ETIMEDOUT, %eax
|
||||
+ retq
|
||||
+
|
||||
# ifndef __ASSUME_FUTEX_CLOCK_REALTIME
|
||||
.Lreltmo:
|
||||
/* Check for a valid timeout value. */
|
||||
Index: glibc-2.12-2-gc4ccff1/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevelrobustlock.S
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevelrobustlock.S
|
||||
+++ glibc-2.12-2-gc4ccff1/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevelrobustlock.S
|
||||
@@ -125,6 +125,9 @@ __lll_robust_timedlock_wait:
|
||||
je .Lreltmo
|
||||
# endif
|
||||
|
||||
+ cmpq $0, (%rdx)
|
||||
+ js 7f
|
||||
+
|
||||
pushq %r9
|
||||
cfi_adjust_cfa_offset(8)
|
||||
cfi_rel_offset(%r9, 0)
|
||||
@@ -180,6 +183,9 @@ __lll_robust_timedlock_wait:
|
||||
cfi_adjust_cfa_offset(-8)
|
||||
cfi_restore(%r9)
|
||||
|
||||
+7: movl $ETIMEDOUT, %eax
|
||||
+ retq
|
||||
+
|
||||
|
||||
# ifndef __ASSUME_FUTEX_CLOCK_REALTIME
|
||||
.Lreltmo:
|
||||
Index: glibc-2.12-2-gc4ccff1/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S
|
||||
+++ glibc-2.12-2-gc4ccff1/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S
|
||||
@@ -144,6 +144,10 @@ __pthread_cond_timedwait:
|
||||
movq %r9, 24(%rsp)
|
||||
movl %edx, 4(%rsp)
|
||||
|
||||
+ cmpq $0, (%r13)
|
||||
+ movq $-ETIMEDOUT, %r14
|
||||
+ js 36f
|
||||
+
|
||||
38: movl cond_futex(%rdi), %r12d
|
||||
|
||||
/* Unlock. */
|
||||
Index: glibc-2.12-2-gc4ccff1/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_timedrdlock.S
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_timedrdlock.S
|
||||
+++ glibc-2.12-2-gc4ccff1/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_timedrdlock.S
|
||||
@@ -102,6 +102,9 @@ pthread_rwlock_timedrdlock:
|
||||
je .Lreltmo
|
||||
#endif
|
||||
|
||||
+ cmpq $0, (%r13)
|
||||
+ js 16f /* Time is already up. */
|
||||
+
|
||||
movl $FUTEX_PRIVATE_FLAG|FUTEX_WAIT_BITSET|FUTEX_CLOCK_REALTIME, %esi
|
||||
xorl PSHARED(%r12), %esi
|
||||
movq %r13, %r10
|
||||
Index: glibc-2.12-2-gc4ccff1/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_timedwrlock.S
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_timedwrlock.S
|
||||
+++ glibc-2.12-2-gc4ccff1/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_timedwrlock.S
|
||||
@@ -99,6 +99,9 @@ pthread_rwlock_timedwrlock:
|
||||
je .Lreltmo
|
||||
#endif
|
||||
|
||||
+ cmpq $0, (%r13)
|
||||
+ js 16f /* Time is already up. */
|
||||
+
|
||||
movl $FUTEX_PRIVATE_FLAG|FUTEX_WAIT_BITSET|FUTEX_CLOCK_REALTIME, %esi
|
||||
xorl PSHARED(%r12), %esi
|
||||
movq %r13, %r10
|
||||
Index: glibc-2.12-2-gc4ccff1/nptl/sysdeps/unix/sysv/linux/x86_64/sem_timedwait.S
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/nptl/sysdeps/unix/sysv/linux/x86_64/sem_timedwait.S
|
||||
+++ glibc-2.12-2-gc4ccff1/nptl/sysdeps/unix/sysv/linux/x86_64/sem_timedwait.S
|
||||
@@ -77,6 +77,9 @@ sem_timedwait:
|
||||
je .Lreltmo
|
||||
#endif
|
||||
|
||||
+ cmpq $0, (%rsi)
|
||||
+ js 16f
|
||||
+
|
||||
/* This push is only needed to store the sem_t pointer for the
|
||||
exception handler. */
|
||||
pushq %rdi
|
||||
@@ -169,6 +172,19 @@ sem_timedwait:
|
||||
|
||||
retq
|
||||
|
||||
+16:
|
||||
+#if USE___THREAD
|
||||
+ movq errno@gottpoff(%rip), %rdx
|
||||
+ movl $ETIMEDOUT, %fs:(%rdx)
|
||||
+#else
|
||||
+ callq __errno_location@plt
|
||||
+ movl $ETIMEDOUT, (%rax)
|
||||
+#endif
|
||||
+
|
||||
+ orl $-1, %eax
|
||||
+
|
||||
+ retq
|
||||
+
|
||||
#ifndef __ASSUME_FUTEX_CLOCK_REALTIME
|
||||
.Lreltmo:
|
||||
pushq %r12
|
||||
Index: glibc-2.12-2-gc4ccff1/nptl/tst-abstime.c
|
||||
===================================================================
|
||||
--- /dev/null
|
||||
+++ glibc-2.12-2-gc4ccff1/nptl/tst-abstime.c
|
||||
@@ -0,0 +1,98 @@
|
||||
+/* Copyright (C) 2010 Free Software Foundation, Inc.
|
||||
+ This file is part of the GNU C Library.
|
||||
+ Contributed by Andreas Schwab <schwab@redhat.com>, 2010.
|
||||
+
|
||||
+ The GNU C Library is free software; you can redistribute it and/or
|
||||
+ modify it under the terms of the GNU Lesser General Public
|
||||
+ License as published by the Free Software Foundation; either
|
||||
+ version 2.1 of the License, or (at your option) any later version.
|
||||
+
|
||||
+ The GNU C Library is distributed in the hope that it will be useful,
|
||||
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
+ Lesser General Public License for more details.
|
||||
+
|
||||
+ You should have received a copy of the GNU Lesser General Public
|
||||
+ License along with the GNU C Library; if not, write to the Free
|
||||
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
+ 02111-1307 USA. */
|
||||
+
|
||||
+#include <errno.h>
|
||||
+#include <pthread.h>
|
||||
+#include <semaphore.h>
|
||||
+#include <stdio.h>
|
||||
+
|
||||
+static pthread_cond_t c = PTHREAD_COND_INITIALIZER;
|
||||
+static pthread_mutex_t m1 = PTHREAD_MUTEX_INITIALIZER;
|
||||
+static pthread_mutex_t m2 = PTHREAD_MUTEX_INITIALIZER;
|
||||
+static pthread_rwlock_t rw1 = PTHREAD_RWLOCK_INITIALIZER;
|
||||
+static pthread_rwlock_t rw2 = PTHREAD_RWLOCK_INITIALIZER;
|
||||
+static sem_t sem;
|
||||
+
|
||||
+static void *
|
||||
+th (void *arg)
|
||||
+{
|
||||
+ long int res = 0;
|
||||
+ int r;
|
||||
+ struct timespec t = { -2, 0 };
|
||||
+
|
||||
+ r = pthread_mutex_timedlock (&m1, &t);
|
||||
+ if (r != ETIMEDOUT)
|
||||
+ {
|
||||
+ puts ("pthread_mutex_timedlock did not return ETIMEDOUT");
|
||||
+ res = 1;
|
||||
+ }
|
||||
+ r = pthread_rwlock_timedrdlock (&rw1, &t);
|
||||
+ if (r != ETIMEDOUT)
|
||||
+ {
|
||||
+ puts ("pthread_rwlock_timedrdlock did not return ETIMEDOUT");
|
||||
+ res = 1;
|
||||
+ }
|
||||
+ r = pthread_rwlock_timedwrlock (&rw2, &t);
|
||||
+ if (r != ETIMEDOUT)
|
||||
+ {
|
||||
+ puts ("pthread_rwlock_timedwrlock did not return ETIMEDOUT");
|
||||
+ res = 1;
|
||||
+ }
|
||||
+ return (void *) res;
|
||||
+}
|
||||
+
|
||||
+static int
|
||||
+do_test (void)
|
||||
+{
|
||||
+ int res = 0;
|
||||
+ int r;
|
||||
+ struct timespec t = { -2, 0 };
|
||||
+ pthread_t pth;
|
||||
+
|
||||
+ sem_init (&sem, 0, 0);
|
||||
+ r = sem_timedwait (&sem, &t);
|
||||
+ if (r != -1 || errno != ETIMEDOUT)
|
||||
+ {
|
||||
+ puts ("sem_timedwait did not fail with ETIMEDOUT");
|
||||
+ res = 1;
|
||||
+ }
|
||||
+
|
||||
+ pthread_mutex_lock (&m1);
|
||||
+ pthread_rwlock_wrlock (&rw1);
|
||||
+ pthread_rwlock_rdlock (&rw2);
|
||||
+ pthread_mutex_lock (&m2);
|
||||
+ if (pthread_create (&pth, 0, th, 0) != 0)
|
||||
+ {
|
||||
+ puts ("cannot create thread");
|
||||
+ return 1;
|
||||
+ }
|
||||
+ r = pthread_cond_timedwait (&c, &m2, &t);
|
||||
+ if (r != ETIMEDOUT)
|
||||
+ {
|
||||
+ puts ("pthread_cond_timedwait did not return ETIMEDOUT");
|
||||
+ res = 1;
|
||||
+ }
|
||||
+ void *thres;
|
||||
+ pthread_join (pth, &thres);
|
||||
+ return res | (thres != NULL);
|
||||
+}
|
||||
+
|
||||
+
|
||||
+#define TEST_FUNCTION do_test ()
|
||||
+#include "../test-skeleton.c"
|
||||
13
src/patches/glibc/glibc-rh582738.patch
Normal file
13
src/patches/glibc/glibc-rh582738.patch
Normal file
@@ -0,0 +1,13 @@
|
||||
Index: glibc-2.11-382-g1cdb215/nscd/nscd.init
|
||||
===================================================================
|
||||
--- glibc-2.11-382-g1cdb215.orig/nscd/nscd.init
|
||||
+++ glibc-2.11-382-g1cdb215/nscd/nscd.init
|
||||
@@ -76,7 +76,7 @@ case "$1" in
|
||||
RETVAL=$?
|
||||
;;
|
||||
stop)
|
||||
- stop
|
||||
+ [ ! -e /var/lock/subsys/nscd ] || stop
|
||||
RETVAL=$?
|
||||
;;
|
||||
status)
|
||||
13
src/patches/glibc/glibc-rh587360.patch
Normal file
13
src/patches/glibc/glibc-rh587360.patch
Normal file
@@ -0,0 +1,13 @@
|
||||
Index: glibc-2.11-382-g1cdb215/posix/regexec.c
|
||||
===================================================================
|
||||
--- glibc-2.11-382-g1cdb215.orig/posix/regexec.c
|
||||
+++ glibc-2.11-382-g1cdb215/posix/regexec.c
|
||||
@@ -4031,7 +4031,7 @@ find_collation_sequence_value (const uns
|
||||
/* Skip the collation sequence value. */
|
||||
idx += sizeof (uint32_t);
|
||||
/* Skip the wide char sequence of the collating element. */
|
||||
- idx = idx + sizeof (uint32_t) * (extra[idx] + 1);
|
||||
+ idx = idx + sizeof (uint32_t) * (*(int32_t *) (extra + idx) + 1);
|
||||
/* If we found the entry, return the sequence value. */
|
||||
if (found)
|
||||
return *(uint32_t *) (extra + idx);
|
||||
42
src/patches/glibc/glibc-rh593396.patch
Normal file
42
src/patches/glibc/glibc-rh593396.patch
Normal file
@@ -0,0 +1,42 @@
|
||||
2010-05-06 Ulrich Drepper <drepper@redhat.com>
|
||||
|
||||
* malloc/malloc.c (_int_free): Possible race in the most recently
|
||||
added check. Only act on the data if no current modification
|
||||
happened.
|
||||
|
||||
Index: glibc-2.12-2-gc4ccff1/malloc/malloc.c
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/malloc/malloc.c
|
||||
+++ glibc-2.12-2-gc4ccff1/malloc/malloc.c
|
||||
@@ -4859,6 +4859,7 @@ _int_free(mstate av, mchunkptr p)
|
||||
#ifdef ATOMIC_FASTBINS
|
||||
mchunkptr fd;
|
||||
mchunkptr old = *fb;
|
||||
+ unsigned int old_idx = ~0u;
|
||||
do
|
||||
{
|
||||
/* Another simple check: make sure the top of the bin is not the
|
||||
@@ -4868,15 +4869,17 @@ _int_free(mstate av, mchunkptr p)
|
||||
errstr = "double free or corruption (fasttop)";
|
||||
goto errout;
|
||||
}
|
||||
- if (old != NULL
|
||||
- && __builtin_expect (fastbin_index(chunksize(old)) != idx, 0))
|
||||
- {
|
||||
- errstr = "invalid fastbin entry (free)";
|
||||
- goto errout;
|
||||
- }
|
||||
+ if (old != NULL)
|
||||
+ old_idx = fastbin_index(chunksize(old));
|
||||
p->fd = fd = old;
|
||||
}
|
||||
while ((old = catomic_compare_and_exchange_val_rel (fb, p, fd)) != fd);
|
||||
+
|
||||
+ if (fd != NULL && __builtin_expect (old_idx != idx, 0))
|
||||
+ {
|
||||
+ errstr = "invalid fastbin entry (free)";
|
||||
+ goto errout;
|
||||
+ }
|
||||
#else
|
||||
/* Another simple check: make sure the top of the bin is not the
|
||||
record we are going to add (i.e., double free). */
|
||||
179
src/patches/glibc/glibc-rh593686.patch
Normal file
179
src/patches/glibc/glibc-rh593686.patch
Normal file
@@ -0,0 +1,179 @@
|
||||
2010-05-26 Andreas Schwab <schwab@redhat.com>
|
||||
|
||||
* elf/Makefile: Add rules to build and run unload8 test.
|
||||
* elf/unload8.c: New file.
|
||||
* elf/unload8mod1.c: New file.
|
||||
* elf/unload8mod1x.c: New file.
|
||||
* elf/unload8mod2.c: New file.
|
||||
* elf/unload8mod3.c: New file.
|
||||
|
||||
* elf/dl-close.c (_dl_close_worker): Reset private search list if
|
||||
it wasn't used.
|
||||
|
||||
Index: glibc-2.12-2-gc4ccff1/elf/Makefile
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/elf/Makefile
|
||||
+++ glibc-2.12-2-gc4ccff1/elf/Makefile
|
||||
@@ -89,6 +89,7 @@ distribute := rtld-Rules \
|
||||
unload4mod1.c unload4mod2.c unload4mod3.c unload4mod4.c \
|
||||
unload6mod1.c unload6mod2.c unload6mod3.c \
|
||||
unload7mod1.c unload7mod2.c \
|
||||
+ unload8mod1.c unload8mod1x.c unload8mod2.c unload8mod3.c \
|
||||
tst-audit1.c tst-audit2.c tst-audit3.c tst-audit4.c \
|
||||
tst-auditmod1.c tst-auditmod3a.c tst-auditmod3b.c \
|
||||
tst-auditmod4a.c tst-auditmod4b.c \
|
||||
@@ -196,7 +197,7 @@ tests += loadtest restest1 preloadtest l
|
||||
tst-align tst-align2 $(tests-execstack-$(have-z-execstack)) \
|
||||
tst-dlmodcount tst-dlopenrpath tst-deep1 \
|
||||
tst-dlmopen1 tst-dlmopen2 tst-dlmopen3 \
|
||||
- unload3 unload4 unload5 unload6 unload7 tst-global1 order2 \
|
||||
+ unload3 unload4 unload5 unload6 unload7 unload8 tst-global1 order2 \
|
||||
tst-audit1 tst-audit2 \
|
||||
tst-stackguard1 tst-addr1 tst-thrlock \
|
||||
tst-unique1 tst-unique2
|
||||
@@ -247,6 +248,7 @@ modules-names = testobj1 testobj2 testob
|
||||
unload4mod1 unload4mod2 unload4mod3 unload4mod4 \
|
||||
unload6mod1 unload6mod2 unload6mod3 \
|
||||
unload7mod1 unload7mod2 \
|
||||
+ unload8mod1 unload8mod1x unload8mod2 unload8mod3 \
|
||||
order2mod1 order2mod2 order2mod3 order2mod4 \
|
||||
tst-unique1mod1 tst-unique1mod2 \
|
||||
tst-unique2mod1 tst-unique2mod2
|
||||
@@ -522,6 +524,9 @@ $(objpfx)unload6mod2.so: $(libdl)
|
||||
$(objpfx)unload6mod3.so: $(libdl)
|
||||
$(objpfx)unload7mod1.so: $(libdl)
|
||||
$(objpfx)unload7mod2.so: $(objpfx)unload7mod1.so
|
||||
+$(objpfx)unload8mod1.so: $(objpfx)unload8mod2.so
|
||||
+$(objpfx)unload8mod2.so: $(objpfx)unload8mod3.so
|
||||
+$(objpfx)unload8mod3.so: $(libdl)
|
||||
|
||||
LDFLAGS-tst-tlsmod5.so = -nostdlib
|
||||
LDFLAGS-tst-tlsmod6.so = -nostdlib
|
||||
@@ -823,6 +828,9 @@ $(objpfx)unload7: $(libdl)
|
||||
$(objpfx)unload7.out: $(objpfx)unload7mod1.so $(objpfx)unload7mod2.so
|
||||
unload7-ENV = MALLOC_PERTURB_=85
|
||||
|
||||
+$(objpfx)unload8: $(libdl)
|
||||
+$(objpfx)unload8.out: $(objpfx)unload8mod1.so $(objpfx)unload8mod1x.so
|
||||
+
|
||||
ifdef libdl
|
||||
$(objpfx)tst-tls9-static: $(common-objpfx)dlfcn/libdl.a
|
||||
$(objpfx)tst-tls9-static.out: $(objpfx)tst-tlsmod5.so $(objpfx)tst-tlsmod6.so
|
||||
Index: glibc-2.12-2-gc4ccff1/elf/dl-close.c
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/elf/dl-close.c
|
||||
+++ glibc-2.12-2-gc4ccff1/elf/dl-close.c
|
||||
@@ -421,6 +421,13 @@ _dl_close_worker (struct link_map *map)
|
||||
|
||||
imap->l_scope_max = new_size;
|
||||
}
|
||||
+ else if (new_list != NULL)
|
||||
+ {
|
||||
+ /* We didn't change the scope array, so reset the search
|
||||
+ list. */
|
||||
+ imap->l_searchlist.r_list = NULL;
|
||||
+ imap->l_searchlist.r_nlist = 0;
|
||||
+ }
|
||||
|
||||
/* The loader is gone, so mark the object as not having one.
|
||||
Note: l_idx != IDX_STILL_USED -> object will be removed. */
|
||||
Index: glibc-2.12-2-gc4ccff1/elf/unload8.c
|
||||
===================================================================
|
||||
--- /dev/null
|
||||
+++ glibc-2.12-2-gc4ccff1/elf/unload8.c
|
||||
@@ -0,0 +1,33 @@
|
||||
+#include <dlfcn.h>
|
||||
+#include <stdio.h>
|
||||
+
|
||||
+int
|
||||
+main (void)
|
||||
+{
|
||||
+ void *h = dlopen ("$ORIGIN/unload8mod1.so", RTLD_LAZY);
|
||||
+ if (h == NULL)
|
||||
+ {
|
||||
+ puts ("dlopen unload8mod1.so failed");
|
||||
+ return 1;
|
||||
+ }
|
||||
+
|
||||
+ void *h2 = dlopen ("$ORIGIN/unload8mod1x.so", RTLD_LAZY);
|
||||
+ if (h2 == NULL)
|
||||
+ {
|
||||
+ puts ("dlopen unload8mod1x.so failed");
|
||||
+ return 1;
|
||||
+ }
|
||||
+ dlclose (h2);
|
||||
+
|
||||
+ int (*mod1) (void) = dlsym (h, "mod1");
|
||||
+ if (mod1 == NULL)
|
||||
+ {
|
||||
+ puts ("dlsym failed");
|
||||
+ return 1;
|
||||
+ }
|
||||
+
|
||||
+ mod1 ();
|
||||
+ dlclose (h);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
Index: glibc-2.12-2-gc4ccff1/elf/unload8mod1.c
|
||||
===================================================================
|
||||
--- /dev/null
|
||||
+++ glibc-2.12-2-gc4ccff1/elf/unload8mod1.c
|
||||
@@ -0,0 +1,7 @@
|
||||
+extern void mod2 (void);
|
||||
+
|
||||
+void
|
||||
+mod1 (void)
|
||||
+{
|
||||
+ mod2 ();
|
||||
+}
|
||||
Index: glibc-2.12-2-gc4ccff1/elf/unload8mod1x.c
|
||||
===================================================================
|
||||
--- /dev/null
|
||||
+++ glibc-2.12-2-gc4ccff1/elf/unload8mod1x.c
|
||||
@@ -0,0 +1 @@
|
||||
+int mod1x;
|
||||
Index: glibc-2.12-2-gc4ccff1/elf/unload8mod2.c
|
||||
===================================================================
|
||||
--- /dev/null
|
||||
+++ glibc-2.12-2-gc4ccff1/elf/unload8mod2.c
|
||||
@@ -0,0 +1,7 @@
|
||||
+extern void mod3 (void);
|
||||
+
|
||||
+void
|
||||
+mod2 (void)
|
||||
+{
|
||||
+ mod3 ();
|
||||
+}
|
||||
Index: glibc-2.12-2-gc4ccff1/elf/unload8mod3.c
|
||||
===================================================================
|
||||
--- /dev/null
|
||||
+++ glibc-2.12-2-gc4ccff1/elf/unload8mod3.c
|
||||
@@ -0,0 +1,27 @@
|
||||
+#include <dlfcn.h>
|
||||
+#include <stdio.h>
|
||||
+#include <stdlib.h>
|
||||
+
|
||||
+void
|
||||
+mod3_fini2 (void)
|
||||
+{
|
||||
+}
|
||||
+
|
||||
+void
|
||||
+mod3_fini (void)
|
||||
+{
|
||||
+ mod3_fini2 ();
|
||||
+}
|
||||
+
|
||||
+void
|
||||
+mod3 (void)
|
||||
+{
|
||||
+ void *h = dlopen ("$ORIGIN/unload8mod2.so", RTLD_LAZY);
|
||||
+ if (h == NULL)
|
||||
+ {
|
||||
+ puts ("dlopen unload8mod2.so failed");
|
||||
+ exit (1);
|
||||
+ }
|
||||
+
|
||||
+ atexit (mod3_fini);
|
||||
+}
|
||||
4640
src/patches/glibc/glibc-rh601686.patch
Normal file
4640
src/patches/glibc/glibc-rh601686.patch
Normal file
File diff suppressed because it is too large
Load Diff
26
src/patches/glibc/glibc-rh607010.patch
Normal file
26
src/patches/glibc/glibc-rh607010.patch
Normal file
@@ -0,0 +1,26 @@
|
||||
2010-09-07 H.J. Lu <hongjiu.lu@intel.com>
|
||||
|
||||
* sysdeps/x86_64/cacheinfo.c (init_cacheinfo): Round cache sizes
|
||||
up to multiple of 256 bytes.
|
||||
|
||||
Index: glibc-2.12-2-gc4ccff1/sysdeps/x86_64/cacheinfo.c
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/sysdeps/x86_64/cacheinfo.c
|
||||
+++ glibc-2.12-2-gc4ccff1/sysdeps/x86_64/cacheinfo.c
|
||||
@@ -661,12 +661,16 @@ init_cacheinfo (void)
|
||||
|
||||
if (data > 0)
|
||||
{
|
||||
+ /* Round data cache size up to multiple of 256 bytes. */
|
||||
+ data = (data + 255) & ~255L;
|
||||
__x86_64_data_cache_size_half = data / 2;
|
||||
__x86_64_data_cache_size = data;
|
||||
}
|
||||
|
||||
if (shared > 0)
|
||||
{
|
||||
+ /* Round shared cache size up to multiple of 256 bytes. */
|
||||
+ shared = (shared + 255) & ~255L;
|
||||
__x86_64_shared_cache_size_half = shared / 2;
|
||||
__x86_64_shared_cache_size = shared;
|
||||
}
|
||||
22
src/patches/glibc/glibc-rh607461.patch
Normal file
22
src/patches/glibc/glibc-rh607461.patch
Normal file
@@ -0,0 +1,22 @@
|
||||
Index: glibc-2.12-2-gc4ccff1/nptl/allocatestack.c
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/nptl/allocatestack.c
|
||||
+++ glibc-2.12-2-gc4ccff1/nptl/allocatestack.c
|
||||
@@ -994,7 +994,16 @@ setxid_mark_thread (struct xid_command *
|
||||
|
||||
/* If the thread is exiting right now, ignore it. */
|
||||
if ((ch & EXITING_BITMASK) != 0)
|
||||
- return;
|
||||
+ {
|
||||
+ /* Release the futex if there is no other setxid in
|
||||
+ progress. */
|
||||
+ if ((ch & SETXID_BITMASK) == 0)
|
||||
+ {
|
||||
+ t->setxid_futex = 1;
|
||||
+ lll_futex_wake (&t->setxid_futex, 1, LLL_PRIVATE);
|
||||
+ }
|
||||
+ return;
|
||||
+ }
|
||||
}
|
||||
while (atomic_compare_and_exchange_bool_acq (&t->cancelhandling,
|
||||
ch | SETXID_BITMASK, ch));
|
||||
21
src/patches/glibc/glibc-rh615090.patch
Normal file
21
src/patches/glibc/glibc-rh615090.patch
Normal file
@@ -0,0 +1,21 @@
|
||||
2010-07-27 Andreas Schwab <schwab@redhat.com>
|
||||
|
||||
* manual/memory.texi (Malloc Tunable Parameters): Document
|
||||
M_PERTURB.
|
||||
|
||||
Index: glibc-2.12-2-gc4ccff1/manual/memory.texi
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/manual/memory.texi
|
||||
+++ glibc-2.12-2-gc4ccff1/manual/memory.texi
|
||||
@@ -702,6 +702,11 @@ be allocated via @code{mmap}.
|
||||
@item M_MMAP_MAX
|
||||
The maximum number of chunks to allocate with @code{mmap}. Setting this
|
||||
to zero disables all use of @code{mmap}.
|
||||
+@item M_PERTURB
|
||||
+If non-zero, memory blocks are filled with values depending on some
|
||||
+low order bits of this parameter when they are allocated (except when
|
||||
+allocated by @code{calloc}) and freed. This can be used to debug the
|
||||
+use of uninitialized or freed heap memory.
|
||||
@end table
|
||||
|
||||
@end deftypefun
|
||||
23
src/patches/glibc/glibc-rh615701.patch
Normal file
23
src/patches/glibc/glibc-rh615701.patch
Normal file
@@ -0,0 +1,23 @@
|
||||
2010-07-20 Roland McGrath <roland@redhat.com>
|
||||
|
||||
* elf/dl-sysdep.c (_dl_important_hwcaps): Add dsocaps mask to
|
||||
dl_hwcap_mask as well as dl_hwcap. Without this, dsocaps matching in
|
||||
ld.so.cache was broken. With it, there is no way to disable dsocaps
|
||||
like LD_HWCAP_MASK can disable hwcaps.
|
||||
|
||||
Index: glibc-2.12-2-gc4ccff1/elf/dl-sysdep.c
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/elf/dl-sysdep.c
|
||||
+++ glibc-2.12-2-gc4ccff1/elf/dl-sysdep.c
|
||||
@@ -425,6 +425,11 @@ _dl_important_hwcaps (const char *platfo
|
||||
{
|
||||
const ElfW(Word) mask = ((const ElfW(Word) *) dsocaps)[-1];
|
||||
GLRO(dl_hwcap) |= (uint64_t) mask << _DL_FIRST_EXTRA;
|
||||
+ /* Note that we add the dsocaps to the set already chosen by the
|
||||
+ LD_HWCAP_MASK environment variable (or default HWCAP_IMPORTANT).
|
||||
+ So there is no way to request ignoring an OS-supplied dsocap
|
||||
+ string and bit like you can ignore an OS-supplied HWCAP bit. */
|
||||
+ GLRO(dl_hwcap_mask) |= (uint64_t) mask << _DL_FIRST_EXTRA;
|
||||
size_t len;
|
||||
for (const char *p = dsocaps; p < dsocaps + dsocapslen; p += len + 1)
|
||||
{
|
||||
120
src/patches/glibc/glibc-rh621959.patch
Normal file
120
src/patches/glibc/glibc-rh621959.patch
Normal file
@@ -0,0 +1,120 @@
|
||||
2010-08-06 Ulrich Drepper <drepper@redhat.com>
|
||||
|
||||
* sysdeps/unix/sysv/linux/getlogin_r.c (__getlogin_r_loginuid):
|
||||
Also fail if tpwd after pwuid call is NULL.
|
||||
|
||||
2010-06-21 Andreas Schwab <schwab@redhat.com>
|
||||
|
||||
* sysdeps/unix/sysv/linux/getlogin_r.c (__getlogin_r_loginuid):
|
||||
Restore proper fallback handling.
|
||||
|
||||
2010-06-19 Ulrich Drepper <drepper@redhat.com>
|
||||
|
||||
* sysdeps/unix/sysv/linux/getlogin_r.c (__getlogin_r_loginuid): Handle
|
||||
OOM in getpwuid_r correctly. Return error number when the caller
|
||||
should return, otherwise -1.
|
||||
(getlogin_r): Adjust to return also for result of __getlogin_r_loginuid
|
||||
call returning > 0 value.
|
||||
* sysdeps/unix/sysv/linux/getlogin.c (getlogin): Likewise.
|
||||
|
||||
Index: glibc-2.12-2-gc4ccff1/sysdeps/unix/sysv/linux/getlogin.c
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/sysdeps/unix/sysv/linux/getlogin.c
|
||||
+++ glibc-2.12-2-gc4ccff1/sysdeps/unix/sysv/linux/getlogin.c
|
||||
@@ -32,8 +32,9 @@
|
||||
char *
|
||||
getlogin (void)
|
||||
{
|
||||
- if (__getlogin_r_loginuid (name, sizeof (name)) == 0)
|
||||
- return name;
|
||||
+ int res = __getlogin_r_loginuid (name, sizeof (name));
|
||||
+ if (res >= 0)
|
||||
+ return res == 0 ? name : NULL;
|
||||
|
||||
return getlogin_fd0 ();
|
||||
}
|
||||
Index: glibc-2.12-2-gc4ccff1/sysdeps/unix/sysv/linux/getlogin_r.c
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/sysdeps/unix/sysv/linux/getlogin_r.c
|
||||
+++ glibc-2.12-2-gc4ccff1/sysdeps/unix/sysv/linux/getlogin_r.c
|
||||
@@ -27,6 +27,10 @@ static int getlogin_r_fd0 (char *name, s
|
||||
#undef getlogin_r
|
||||
|
||||
|
||||
+/* Try to determine login name from /proc/self/loginuid and return 0
|
||||
+ if successful. If /proc/self/loginuid cannot be read return -1.
|
||||
+ Otherwise return the error number. */
|
||||
+
|
||||
int
|
||||
attribute_hidden
|
||||
__getlogin_r_loginuid (name, namesize)
|
||||
@@ -35,7 +39,7 @@ __getlogin_r_loginuid (name, namesize)
|
||||
{
|
||||
int fd = open_not_cancel_2 ("/proc/self/loginuid", O_RDONLY);
|
||||
if (fd == -1)
|
||||
- return 1;
|
||||
+ return -1;
|
||||
|
||||
/* We are reading a 32-bit number. 12 bytes are enough for the text
|
||||
representation. If not, something is wrong. */
|
||||
@@ -51,37 +55,38 @@ __getlogin_r_loginuid (name, namesize)
|
||||
|| (uidbuf[n] = '\0',
|
||||
uid = strtoul (uidbuf, &endp, 10),
|
||||
endp == uidbuf || *endp != '\0'))
|
||||
- return 1;
|
||||
+ return -1;
|
||||
|
||||
size_t buflen = 1024;
|
||||
char *buf = alloca (buflen);
|
||||
bool use_malloc = false;
|
||||
struct passwd pwd;
|
||||
struct passwd *tpwd;
|
||||
+ int result = 0;
|
||||
int res;
|
||||
|
||||
- while ((res = __getpwuid_r (uid, &pwd, buf, buflen, &tpwd)) != 0)
|
||||
+ while ((res = __getpwuid_r (uid, &pwd, buf, buflen, &tpwd)) == ERANGE)
|
||||
if (__libc_use_alloca (2 * buflen))
|
||||
- extend_alloca (buf, buflen, 2 * buflen);
|
||||
+ buf = extend_alloca (buf, buflen, 2 * buflen);
|
||||
else
|
||||
{
|
||||
buflen *= 2;
|
||||
char *newp = realloc (use_malloc ? buf : NULL, buflen);
|
||||
if (newp == NULL)
|
||||
{
|
||||
- fail:
|
||||
- if (use_malloc)
|
||||
- free (buf);
|
||||
- return 1;
|
||||
+ result = ENOMEM;
|
||||
+ goto out;
|
||||
}
|
||||
buf = newp;
|
||||
use_malloc = true;
|
||||
}
|
||||
|
||||
- if (tpwd == NULL)
|
||||
- goto fail;
|
||||
+ if (res != 0 || tpwd == NULL)
|
||||
+ {
|
||||
+ result = -1;
|
||||
+ goto out;
|
||||
+ }
|
||||
|
||||
- int result = 0;
|
||||
size_t needed = strlen (pwd.pw_name) + 1;
|
||||
if (needed > namesize)
|
||||
{
|
||||
@@ -109,8 +114,9 @@ getlogin_r (name, namesize)
|
||||
char *name;
|
||||
size_t namesize;
|
||||
{
|
||||
- if (__getlogin_r_loginuid (name, namesize) == 0)
|
||||
- return 0;
|
||||
+ int res = __getlogin_r_loginuid (name, namesize);
|
||||
+ if (res >= 0)
|
||||
+ return res;
|
||||
|
||||
return getlogin_r_fd0 (name, namesize);
|
||||
}
|
||||
18
src/patches/glibc/glibc-rh623187.patch
Normal file
18
src/patches/glibc/glibc-rh623187.patch
Normal file
@@ -0,0 +1,18 @@
|
||||
2010-08-10 Dinakar Guniguntala <dino@in.ibm.com>
|
||||
Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
|
||||
|
||||
* sysdeps/unix/sysv/linux/i386/i486/pthread_cond_signal.S: If
|
||||
FUTEX_WAKE_OP fails make sure to call FUTEX_WAKE instead.
|
||||
|
||||
Index: glibc-2.12-2-gc4ccff1/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_signal.S
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_signal.S
|
||||
+++ glibc-2.12-2-gc4ccff1/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_signal.S
|
||||
@@ -163,7 +163,6 @@ __pthread_cond_signal:
|
||||
#endif
|
||||
orl $FUTEX_WAKE, %ecx
|
||||
|
||||
- xorl $(FUTEX_WAKE ^ FUTEX_WAKE_OP), %ecx
|
||||
movl $SYS_futex, %eax
|
||||
/* %edx should be 1 already from $FUTEX_WAKE_OP syscall.
|
||||
movl $1, %edx */
|
||||
79
src/patches/glibc/glibc-rh625893.patch
Normal file
79
src/patches/glibc/glibc-rh625893.patch
Normal file
@@ -0,0 +1,79 @@
|
||||
2010-08-12 Andreas Schwab <schwab@redhat.com>
|
||||
|
||||
[BZ #11904]
|
||||
* locale/programs/locale.c (print_assignment): New function.
|
||||
(show_locale_vars): Use it.
|
||||
|
||||
Index: glibc-2.12-2-gc4ccff1/locale/programs/locale.c
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/locale/programs/locale.c
|
||||
+++ glibc-2.12-2-gc4ccff1/locale/programs/locale.c
|
||||
@@ -762,6 +762,29 @@ write_charmaps (void)
|
||||
twalk (all_data, print_names);
|
||||
}
|
||||
|
||||
+/* Print a properly quoted assignment of NAME with VAL, using double
|
||||
+ quotes iff DQUOTE is true. */
|
||||
+static void
|
||||
+print_assignment (const char *name, const char *val, bool dquote)
|
||||
+{
|
||||
+ printf ("%s=", name);
|
||||
+ if (dquote)
|
||||
+ putchar ('"');
|
||||
+ while (*val != '\0')
|
||||
+ {
|
||||
+ size_t segment
|
||||
+ = strcspn (val, dquote ? "$`\"\\" : "~|&;<>()$`\\\"' \t\n");
|
||||
+ printf ("%.*s", (int) segment, val);
|
||||
+ val += segment;
|
||||
+ if (*val == '\0')
|
||||
+ break;
|
||||
+ putchar ('\\');
|
||||
+ putchar (*val++);
|
||||
+ }
|
||||
+ if (dquote)
|
||||
+ putchar ('"');
|
||||
+ putchar ('\n');
|
||||
+}
|
||||
|
||||
/* We have to show the contents of the environments determining the
|
||||
locale. */
|
||||
@@ -769,7 +792,7 @@ static void
|
||||
show_locale_vars (void)
|
||||
{
|
||||
size_t cat_no;
|
||||
- const char *lcall = getenv ("LC_ALL");
|
||||
+ const char *lcall = getenv ("LC_ALL") ? : "";
|
||||
const char *lang = getenv ("LANG") ? : "";
|
||||
|
||||
auto void get_source (const char *name);
|
||||
@@ -778,15 +801,15 @@ show_locale_vars (void)
|
||||
{
|
||||
char *val = getenv (name);
|
||||
|
||||
- if ((lcall ?: "")[0] != '\0' || val == NULL)
|
||||
- printf ("%s=\"%s\"\n", name,
|
||||
- (lcall ?: "")[0] ? lcall : (lang ?: "")[0] ? lang : "POSIX");
|
||||
+ if (lcall[0] != '\0' || val == NULL)
|
||||
+ print_assignment (name, lcall[0] ? lcall : lang[0] ? lang : "POSIX",
|
||||
+ true);
|
||||
else
|
||||
- printf ("%s=%s\n", name, val);
|
||||
+ print_assignment (name, val, false);
|
||||
}
|
||||
|
||||
/* LANG has to be the first value. */
|
||||
- printf ("LANG=%s\n", lang);
|
||||
+ print_assignment ("LANG", lang, false);
|
||||
|
||||
/* Now all categories in an unspecified order. */
|
||||
for (cat_no = 0; cat_no < NCATEGORIES; ++cat_no)
|
||||
@@ -794,7 +817,7 @@ show_locale_vars (void)
|
||||
get_source (category[cat_no].name);
|
||||
|
||||
/* The last is the LC_ALL value. */
|
||||
- printf ("LC_ALL=%s\n", lcall ? : "");
|
||||
+ print_assignment ("LC_ALL", lcall, false);
|
||||
}
|
||||
|
||||
|
||||
29
src/patches/glibc/glibc-rh630801.patch
Normal file
29
src/patches/glibc/glibc-rh630801.patch
Normal file
@@ -0,0 +1,29 @@
|
||||
2010-05-26 H.J. Lu <hongjiu.lu@intel.com>
|
||||
|
||||
[BZ #11640]
|
||||
* sysdeps/x86_64/multiarch/init-arch.c (__init_cpu_features):
|
||||
Properly check family and model.
|
||||
|
||||
Index: glibc-2.12-2-gc4ccff1/sysdeps/x86_64/multiarch/init-arch.c
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/sysdeps/x86_64/multiarch/init-arch.c
|
||||
+++ glibc-2.12-2-gc4ccff1/sysdeps/x86_64/multiarch/init-arch.c
|
||||
@@ -62,15 +62,15 @@ __init_cpu_features (void)
|
||||
unsigned int eax = __cpu_features.cpuid[COMMON_CPUID_INDEX_1].eax;
|
||||
unsigned int extended_family = (eax >> 20) & 0xff;
|
||||
unsigned int extended_model = (eax >> 12) & 0xf0;
|
||||
- if (__cpu_features.family == 0x0f)
|
||||
+ if (family == 0x0f)
|
||||
{
|
||||
family += extended_family;
|
||||
model += extended_model;
|
||||
}
|
||||
- else if (__cpu_features.family == 0x06)
|
||||
+ else if (family == 0x06)
|
||||
{
|
||||
model += extended_model;
|
||||
- switch (__cpu_features.model)
|
||||
+ switch (model)
|
||||
{
|
||||
case 0x1a:
|
||||
case 0x1e:
|
||||
17
src/patches/glibc/glibc-rh631011.patch
Normal file
17
src/patches/glibc/glibc-rh631011.patch
Normal file
@@ -0,0 +1,17 @@
|
||||
2010-08-19 Andreas Schwab <schwab@redhat.com>
|
||||
|
||||
* sysdeps/i386/i686/multiarch/strspn.S [!SHARED]: Fix SSE4.2 check.
|
||||
|
||||
Index: glibc-2.12-2-gc4ccff1/sysdeps/i386/i686/multiarch/strspn.S
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/sysdeps/i386/i686/multiarch/strspn.S
|
||||
+++ glibc-2.12-2-gc4ccff1/sysdeps/i386/i686/multiarch/strspn.S
|
||||
@@ -65,7 +65,7 @@ ENTRY(strspn)
|
||||
jne 1f
|
||||
call __init_cpu_features
|
||||
1: leal __strspn_ia32, %eax
|
||||
- testl $index_SSE2, CPUID_OFFSET+index_SSE4_2+__cpu_features
|
||||
+ testl $bit_SSE4_2, CPUID_OFFSET+index_SSE4_2+__cpu_features
|
||||
jz 2f
|
||||
leal __strspn_sse42, %eax
|
||||
2: ret
|
||||
78
src/patches/glibc/glibc-rh641128.patch
Normal file
78
src/patches/glibc/glibc-rh641128.patch
Normal file
@@ -0,0 +1,78 @@
|
||||
2010-10-06 Ulrich Drepper <drepper@gmail.com>
|
||||
|
||||
* string/bug-strstr1.c: New file.
|
||||
* string/Makefile: Add rules to build and run bug-strstr1.
|
||||
|
||||
2010-10-05 Eric Blake <eblake@redhat.com>
|
||||
|
||||
[BZ #12092]
|
||||
* string/str-two-way.h (two_way_long_needle): Always clear memory
|
||||
when skipping input due to the shift table.
|
||||
|
||||
Index: glibc-2.12-2-gc4ccff1/string/Makefile
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/string/Makefile
|
||||
+++ glibc-2.12-2-gc4ccff1/string/Makefile
|
||||
@@ -54,7 +54,8 @@ tests := tester inl-tester noinl-tester
|
||||
bug-strncat1 bug-strspn1 bug-strpbrk1 tst-bswap \
|
||||
tst-strtok tst-strxfrm bug-strcoll1 tst-strfry \
|
||||
bug-strtok1 $(addprefix test-,$(strop-tests)) \
|
||||
- bug-envz1 tst-strxfrm2 tst-endian tst-svc2
|
||||
+ bug-envz1 tst-strxfrm2 tst-endian tst-svc2 \
|
||||
+ bug-strstr1
|
||||
distribute := memcopy.h pagecopy.h tst-svc.expect test-string.h \
|
||||
str-two-way.h
|
||||
|
||||
@@ -73,6 +74,7 @@ CFLAGS-tst-strlen.c = -fno-builtin
|
||||
CFLAGS-stratcliff.c = -fno-builtin
|
||||
CFLAGS-test-ffs.c = -fno-builtin
|
||||
CFLAGS-tst-inlcall.c = -fno-builtin
|
||||
+CFLAGS-bug-strstr1.c = -fno-builtin
|
||||
|
||||
ifeq ($(cross-compiling),no)
|
||||
tests: $(objpfx)tst-svc.out
|
||||
Index: glibc-2.12-2-gc4ccff1/string/bug-strstr1.c
|
||||
===================================================================
|
||||
--- /dev/null
|
||||
+++ glibc-2.12-2-gc4ccff1/string/bug-strstr1.c
|
||||
@@ -0,0 +1,26 @@
|
||||
+#include <stdio.h>
|
||||
+#include <string.h>
|
||||
+
|
||||
+int main (int argc, char** argv)
|
||||
+{
|
||||
+ const char haystack[] =
|
||||
+ "F_BD_CE_BD_EF_BF_BD_EF_BF_BD_EF_BF_BD_EF_BF_BD_C3_88_20_EF_BF_BD_EF_BF_BD_EF_BF_BD_C3_A7_20_EF_BF_BD";
|
||||
+
|
||||
+ const char needle[] =
|
||||
+ "_EF_BF_BD_EF_BF_BD_EF_BF_BD_EF_BF_BD_EF_BF_BD";
|
||||
+
|
||||
+ const char* sub = strstr (haystack, needle);
|
||||
+
|
||||
+ if (sub != NULL)
|
||||
+ {
|
||||
+ int j;
|
||||
+
|
||||
+ fprintf (stderr, "BUG: expected NULL, got:\n%s\n%s\n", sub, needle);
|
||||
+ for (j = 0; needle[j] != '\0'; ++j)
|
||||
+ putchar (needle[j] == sub[j] ? ' ' : '^');
|
||||
+ puts ("");
|
||||
+ return 1;
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
Index: glibc-2.12-2-gc4ccff1/string/str-two-way.h
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/string/str-two-way.h
|
||||
+++ glibc-2.12-2-gc4ccff1/string/str-two-way.h
|
||||
@@ -350,8 +350,8 @@ two_way_long_needle (const unsigned char
|
||||
a byte out of place, there can be no match until
|
||||
after the mismatch. */
|
||||
shift = needle_len - period;
|
||||
- memory = 0;
|
||||
}
|
||||
+ memory = 0;
|
||||
j += shift;
|
||||
continue;
|
||||
}
|
||||
41
src/patches/glibc/glibc-rh642584.patch
Normal file
41
src/patches/glibc/glibc-rh642584.patch
Normal file
@@ -0,0 +1,41 @@
|
||||
2010-10-13 H.J. Lu <hongjiu.lu@intel.com>
|
||||
|
||||
[BZ #12113]
|
||||
* sysdeps/x86_64/pthreaddef.h (TCB_ALIGNMENT): Changed to 32.
|
||||
* sysdeps/x86_64/tls.h (TLS_TCB_ALIGN): Defined with alignment
|
||||
of "struct pthread".
|
||||
|
||||
Index: glibc-2.12-2-gc4ccff1/nptl/sysdeps/x86_64/pthreaddef.h
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/nptl/sysdeps/x86_64/pthreaddef.h
|
||||
+++ glibc-2.12-2-gc4ccff1/nptl/sysdeps/x86_64/pthreaddef.h
|
||||
@@ -27,8 +27,9 @@
|
||||
/* Minimal stack size after allocating thread descriptor and guard size. */
|
||||
#define MINIMAL_REST_STACK 2048
|
||||
|
||||
-/* Alignment requirement for TCB. */
|
||||
-#define TCB_ALIGNMENT 16
|
||||
+/* Alignment requirement for TCB. Need to store post-AVX vector registers
|
||||
+ in the TCB and we want the storage to be aligned at 32-byte. */
|
||||
+#define TCB_ALIGNMENT 32
|
||||
|
||||
|
||||
/* Location of current stack frame. The frame pointer is not usable. */
|
||||
Index: glibc-2.12-2-gc4ccff1/nptl/sysdeps/x86_64/tls.h
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/nptl/sysdeps/x86_64/tls.h
|
||||
+++ glibc-2.12-2-gc4ccff1/nptl/sysdeps/x86_64/tls.h
|
||||
@@ -117,12 +117,7 @@ typedef struct
|
||||
# define TLS_TCB_SIZE sizeof (struct pthread)
|
||||
|
||||
/* Alignment requirements for the TCB. */
|
||||
-//# define TLS_TCB_ALIGN __alignof__ (struct pthread)
|
||||
-// Normally the above would be correct But we have to store post-AVX
|
||||
-// vector registers in the TCB and we want the storage to be aligned.
|
||||
-// unfortunately there isn't yet a type for these values and hence no
|
||||
-// 32-byte alignment requirement. Make this explicit, for now.
|
||||
-# define TLS_TCB_ALIGN 32
|
||||
+# define TLS_TCB_ALIGN __alignof__ (struct pthread)
|
||||
|
||||
/* The TCB can have any size and the memory following the address the
|
||||
thread pointer points to is unspecified. Allocate the TCB there. */
|
||||
64
src/patches/glibc/glibc-rh643822.patch
Normal file
64
src/patches/glibc/glibc-rh643822.patch
Normal file
@@ -0,0 +1,64 @@
|
||||
2010-12-09 Andreas Schwab <schwab@redhat.com>
|
||||
|
||||
* elf/dl-object.c (_dl_new_object): Ignore origin of privileged
|
||||
program.
|
||||
|
||||
2010-10-18 Andreas Schwab <schwab@redhat.com>
|
||||
|
||||
* elf/dl-open.c (dl_open_worker): Don't expand DST here, let
|
||||
_dl_map_object do it.
|
||||
|
||||
Index: glibc-2.12-2-gc4ccff1/elf/dl-object.c
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/elf/dl-object.c
|
||||
+++ glibc-2.12-2-gc4ccff1/elf/dl-object.c
|
||||
@@ -214,6 +214,9 @@ _dl_new_object (char *realname, const ch
|
||||
out:
|
||||
new->l_origin = origin;
|
||||
}
|
||||
+ else if (INTUSE(__libc_enable_secure) && type == lt_executable)
|
||||
+ /* The origin of a privileged program cannot be trusted. */
|
||||
+ new->l_origin = (char *) -1;
|
||||
|
||||
return new;
|
||||
}
|
||||
Index: glibc-2.12-2-gc4ccff1/elf/dl-open.c
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/elf/dl-open.c
|
||||
+++ glibc-2.12-2-gc4ccff1/elf/dl-open.c
|
||||
@@ -221,35 +221,6 @@ dl_open_worker (void *a)
|
||||
|
||||
assert (_dl_debug_initialize (0, args->nsid)->r_state == RT_CONSISTENT);
|
||||
|
||||
- /* Maybe we have to expand a DST. */
|
||||
- if (__builtin_expect (dst != NULL, 0))
|
||||
- {
|
||||
- size_t len = strlen (file);
|
||||
-
|
||||
- /* Determine how much space we need. We have to allocate the
|
||||
- memory locally. */
|
||||
- size_t required = DL_DST_REQUIRED (call_map, file, len,
|
||||
- _dl_dst_count (dst, 0));
|
||||
-
|
||||
- /* Get space for the new file name. */
|
||||
- char *new_file = (char *) alloca (required + 1);
|
||||
-
|
||||
- /* Generate the new file name. */
|
||||
- _dl_dst_substitute (call_map, file, new_file, 0);
|
||||
-
|
||||
- /* If the substitution failed don't try to load. */
|
||||
- if (*new_file == '\0')
|
||||
- _dl_signal_error (0, "dlopen", NULL,
|
||||
- N_("empty dynamic string token substitution"));
|
||||
-
|
||||
- /* Now we have a new file name. */
|
||||
- file = new_file;
|
||||
-
|
||||
- /* It does not matter whether call_map is set even if we
|
||||
- computed it only because of the DST. Since the path contains
|
||||
- a slash the value is not used. See dl-load.c. */
|
||||
- }
|
||||
-
|
||||
/* Load the named object. */
|
||||
struct link_map *new;
|
||||
args->map = new = _dl_map_object (call_map, file, 0, lt_loaded, 0,
|
||||
215
src/patches/glibc/glibc-rh645672.patch
Normal file
215
src/patches/glibc/glibc-rh645672.patch
Normal file
@@ -0,0 +1,215 @@
|
||||
2010-10-22 Andreas Schwab <schwab@redhat.com>
|
||||
|
||||
* include/dlfcn.h (__RTLD_SECURE): Define.
|
||||
* elf/dl-load.c (_dl_map_object): Remove preloaded parameter. Use
|
||||
mode & __RTLD_SECURE instead.
|
||||
(open_path): Remove preloaded parameter to secure.
|
||||
* sysdeps/generic/ldsodefs.h (_dl_map_object): Adjust declaration.
|
||||
* elf/dl-open.c (dl_open_worker): Adjust call to _dl_map_object.
|
||||
* elf/dl-deps.c (openaux): Likewise.
|
||||
* elf/rtld.c (struct map_args): Remove is_preloaded.
|
||||
(map_doit): Don't use it.
|
||||
(dl_main): Likewise.
|
||||
(do_preload): Use __RTLD_SECURE instead of is_preloaded.
|
||||
(dlmopen_doit): Add __RTLD_SECURE to mode bits.
|
||||
|
||||
Index: glibc-2.12-2-gc4ccff1/elf/dl-deps.c
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/elf/dl-deps.c
|
||||
+++ glibc-2.12-2-gc4ccff1/elf/dl-deps.c
|
||||
@@ -62,7 +62,7 @@ openaux (void *a)
|
||||
{
|
||||
struct openaux_args *args = (struct openaux_args *) a;
|
||||
|
||||
- args->aux = _dl_map_object (args->map, args->name, 0,
|
||||
+ args->aux = _dl_map_object (args->map, args->name,
|
||||
(args->map->l_type == lt_executable
|
||||
? lt_library : args->map->l_type),
|
||||
args->trace_mode, args->open_mode,
|
||||
Index: glibc-2.12-2-gc4ccff1/elf/dl-load.c
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/elf/dl-load.c
|
||||
+++ glibc-2.12-2-gc4ccff1/elf/dl-load.c
|
||||
@@ -1811,7 +1811,7 @@ open_verify (const char *name, struct fi
|
||||
if MAY_FREE_DIRS is true. */
|
||||
|
||||
static int
|
||||
-open_path (const char *name, size_t namelen, int preloaded,
|
||||
+open_path (const char *name, size_t namelen, int secure,
|
||||
struct r_search_path_struct *sps, char **realname,
|
||||
struct filebuf *fbp, struct link_map *loader, int whatcode,
|
||||
bool *found_other_class)
|
||||
@@ -1893,7 +1893,7 @@ open_path (const char *name, size_t name
|
||||
/* Remember whether we found any existing directory. */
|
||||
here_any |= this_dir->status[cnt] != nonexisting;
|
||||
|
||||
- if (fd != -1 && __builtin_expect (preloaded, 0)
|
||||
+ if (fd != -1 && __builtin_expect (secure, 0)
|
||||
&& INTUSE(__libc_enable_secure))
|
||||
{
|
||||
/* This is an extra security effort to make sure nobody can
|
||||
@@ -1962,7 +1962,7 @@ open_path (const char *name, size_t name
|
||||
|
||||
struct link_map *
|
||||
internal_function
|
||||
-_dl_map_object (struct link_map *loader, const char *name, int preloaded,
|
||||
+_dl_map_object (struct link_map *loader, const char *name,
|
||||
int type, int trace_mode, int mode, Lmid_t nsid)
|
||||
{
|
||||
int fd;
|
||||
@@ -2066,7 +2066,8 @@ _dl_map_object (struct link_map *loader,
|
||||
for (l = loader; l; l = l->l_loader)
|
||||
if (cache_rpath (l, &l->l_rpath_dirs, DT_RPATH, "RPATH"))
|
||||
{
|
||||
- fd = open_path (name, namelen, preloaded, &l->l_rpath_dirs,
|
||||
+ fd = open_path (name, namelen, mode & __RTLD_SECURE,
|
||||
+ &l->l_rpath_dirs,
|
||||
&realname, &fb, loader, LA_SER_RUNPATH,
|
||||
&found_other_class);
|
||||
if (fd != -1)
|
||||
@@ -2081,14 +2082,15 @@ _dl_map_object (struct link_map *loader,
|
||||
&& main_map != NULL && main_map->l_type != lt_loaded
|
||||
&& cache_rpath (main_map, &main_map->l_rpath_dirs, DT_RPATH,
|
||||
"RPATH"))
|
||||
- fd = open_path (name, namelen, preloaded, &main_map->l_rpath_dirs,
|
||||
+ fd = open_path (name, namelen, mode & __RTLD_SECURE,
|
||||
+ &main_map->l_rpath_dirs,
|
||||
&realname, &fb, loader ?: main_map, LA_SER_RUNPATH,
|
||||
&found_other_class);
|
||||
}
|
||||
|
||||
/* Try the LD_LIBRARY_PATH environment variable. */
|
||||
if (fd == -1 && env_path_list.dirs != (void *) -1)
|
||||
- fd = open_path (name, namelen, preloaded, &env_path_list,
|
||||
+ fd = open_path (name, namelen, mode & __RTLD_SECURE, &env_path_list,
|
||||
&realname, &fb,
|
||||
loader ?: GL(dl_ns)[LM_ID_BASE]._ns_loaded,
|
||||
LA_SER_LIBPATH, &found_other_class);
|
||||
@@ -2097,12 +2099,12 @@ _dl_map_object (struct link_map *loader,
|
||||
if (fd == -1 && loader != NULL
|
||||
&& cache_rpath (loader, &loader->l_runpath_dirs,
|
||||
DT_RUNPATH, "RUNPATH"))
|
||||
- fd = open_path (name, namelen, preloaded,
|
||||
+ fd = open_path (name, namelen, mode & __RTLD_SECURE,
|
||||
&loader->l_runpath_dirs, &realname, &fb, loader,
|
||||
LA_SER_RUNPATH, &found_other_class);
|
||||
|
||||
if (fd == -1
|
||||
- && (__builtin_expect (! preloaded, 1)
|
||||
+ && (__builtin_expect (! (mode & __RTLD_SECURE), 1)
|
||||
|| ! INTUSE(__libc_enable_secure)))
|
||||
{
|
||||
/* Check the list of libraries in the file /etc/ld.so.cache,
|
||||
@@ -2168,7 +2170,7 @@ _dl_map_object (struct link_map *loader,
|
||||
&& ((l = loader ?: GL(dl_ns)[nsid]._ns_loaded) == NULL
|
||||
|| __builtin_expect (!(l->l_flags_1 & DF_1_NODEFLIB), 1))
|
||||
&& rtld_search_dirs.dirs != (void *) -1)
|
||||
- fd = open_path (name, namelen, preloaded, &rtld_search_dirs,
|
||||
+ fd = open_path (name, namelen, mode & __RTLD_SECURE, &rtld_search_dirs,
|
||||
&realname, &fb, l, LA_SER_DEFAULT, &found_other_class);
|
||||
|
||||
/* Add another newline when we are tracing the library loading. */
|
||||
Index: glibc-2.12-2-gc4ccff1/elf/dl-open.c
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/elf/dl-open.c
|
||||
+++ glibc-2.12-2-gc4ccff1/elf/dl-open.c
|
||||
@@ -252,7 +252,7 @@ dl_open_worker (void *a)
|
||||
|
||||
/* Load the named object. */
|
||||
struct link_map *new;
|
||||
- args->map = new = _dl_map_object (call_map, file, 0, lt_loaded, 0,
|
||||
+ args->map = new = _dl_map_object (call_map, file, lt_loaded, 0,
|
||||
mode | __RTLD_CALLMAP, args->nsid);
|
||||
|
||||
/* If the pointer returned is NULL this means the RTLD_NOLOAD flag is
|
||||
Index: glibc-2.12-2-gc4ccff1/elf/rtld.c
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/elf/rtld.c
|
||||
+++ glibc-2.12-2-gc4ccff1/elf/rtld.c
|
||||
@@ -589,7 +589,6 @@ struct map_args
|
||||
/* Argument to map_doit. */
|
||||
char *str;
|
||||
struct link_map *loader;
|
||||
- int is_preloaded;
|
||||
int mode;
|
||||
/* Return value of map_doit. */
|
||||
struct link_map *map;
|
||||
@@ -627,16 +626,17 @@ static void
|
||||
map_doit (void *a)
|
||||
{
|
||||
struct map_args *args = (struct map_args *) a;
|
||||
- args->map = _dl_map_object (args->loader, args->str,
|
||||
- args->is_preloaded, lt_library, 0, args->mode,
|
||||
- LM_ID_BASE);
|
||||
+ args->map = _dl_map_object (args->loader, args->str, lt_library, 0,
|
||||
+ args->mode, LM_ID_BASE);
|
||||
}
|
||||
|
||||
static void
|
||||
dlmopen_doit (void *a)
|
||||
{
|
||||
struct dlmopen_args *args = (struct dlmopen_args *) a;
|
||||
- args->map = _dl_open (args->fname, RTLD_LAZY | __RTLD_DLOPEN | __RTLD_AUDIT,
|
||||
+ args->map = _dl_open (args->fname,
|
||||
+ (RTLD_LAZY | __RTLD_DLOPEN | __RTLD_AUDIT
|
||||
+ | __RTLD_SECURE),
|
||||
dl_main, LM_ID_NEWLM, _dl_argc, INTUSE(_dl_argv),
|
||||
__environ);
|
||||
}
|
||||
@@ -806,8 +806,7 @@ do_preload (char *fname, struct link_map
|
||||
|
||||
args.str = fname;
|
||||
args.loader = main_map;
|
||||
- args.is_preloaded = 1;
|
||||
- args.mode = 0;
|
||||
+ args.mode = __RTLD_SECURE;
|
||||
|
||||
unsigned int old_nloaded = GL(dl_ns)[LM_ID_BASE]._ns_nloaded;
|
||||
|
||||
@@ -1054,7 +1053,6 @@ of this helper program; chances are you
|
||||
|
||||
args.str = rtld_progname;
|
||||
args.loader = NULL;
|
||||
- args.is_preloaded = 0;
|
||||
args.mode = __RTLD_OPENEXEC;
|
||||
(void) _dl_catch_error (&objname, &err_str, &malloced, map_doit,
|
||||
&args);
|
||||
@@ -1066,7 +1064,7 @@ of this helper program; chances are you
|
||||
else
|
||||
{
|
||||
HP_TIMING_NOW (start);
|
||||
- _dl_map_object (NULL, rtld_progname, 0, lt_library, 0,
|
||||
+ _dl_map_object (NULL, rtld_progname, lt_library, 0,
|
||||
__RTLD_OPENEXEC, LM_ID_BASE);
|
||||
HP_TIMING_NOW (stop);
|
||||
|
||||
Index: glibc-2.12-2-gc4ccff1/include/dlfcn.h
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/include/dlfcn.h
|
||||
+++ glibc-2.12-2-gc4ccff1/include/dlfcn.h
|
||||
@@ -9,6 +9,7 @@
|
||||
#define __RTLD_OPENEXEC 0x20000000
|
||||
#define __RTLD_CALLMAP 0x10000000
|
||||
#define __RTLD_AUDIT 0x08000000
|
||||
+#define __RTLD_SECURE 0x04000000 /* Apply additional security checks. */
|
||||
|
||||
#define __LM_ID_CALLER -2
|
||||
|
||||
Index: glibc-2.12-2-gc4ccff1/sysdeps/generic/ldsodefs.h
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/sysdeps/generic/ldsodefs.h
|
||||
+++ glibc-2.12-2-gc4ccff1/sysdeps/generic/ldsodefs.h
|
||||
@@ -824,11 +824,9 @@ extern void _dl_receive_error (receiver_
|
||||
|
||||
/* Open the shared object NAME and map in its segments.
|
||||
LOADER's DT_RPATH is used in searching for NAME.
|
||||
- If the object is already opened, returns its existing map.
|
||||
- For preloaded shared objects PRELOADED is set to a non-zero
|
||||
- value to allow additional security checks. */
|
||||
+ If the object is already opened, returns its existing map. */
|
||||
extern struct link_map *_dl_map_object (struct link_map *loader,
|
||||
- const char *name, int preloaded,
|
||||
+ const char *name,
|
||||
int type, int trace_mode, int mode,
|
||||
Lmid_t nsid)
|
||||
internal_function attribute_hidden;
|
||||
216
src/patches/glibc/glibc-rh646954.patch
Normal file
216
src/patches/glibc/glibc-rh646954.patch
Normal file
@@ -0,0 +1,216 @@
|
||||
2010-10-26 Ulrich Drepper <drepper@gmail.com>
|
||||
|
||||
* elf/rtld.c (dl_main): Move assertion after the point where rtld map
|
||||
is added to the list.
|
||||
|
||||
2010-10-20 Andreas Krebbel <Andreas.Krebbel@de.ibm.com>
|
||||
Ulrich Drepper <drepper@gmail.com>
|
||||
|
||||
* elf/dl-object.c (_dl_new_object): Don't append the new object to
|
||||
the global list here. Move code to...
|
||||
(_dl_add_to_namespace_list): ...here. New function.
|
||||
* elf/rtld.c (dl_main): Invoke _dl_add_to_namespace_list.
|
||||
* sysdeps/generic/ldsodefs.h (_dl_add_to_namespace_list): Declare.
|
||||
* elf/dl-load.c (lose): Don't remove the element from the list.
|
||||
(_dl_map_object_from_fd): Invoke _dl_add_to_namespace_list.
|
||||
(_dl_map_object): Likewise.
|
||||
|
||||
Index: glibc-2.12-2-gc4ccff1/elf/dl-load.c
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/elf/dl-load.c
|
||||
+++ glibc-2.12-2-gc4ccff1/elf/dl-load.c
|
||||
@@ -797,22 +797,7 @@ lose (int code, int fd, const char *name
|
||||
/* The file might already be closed. */
|
||||
if (fd != -1)
|
||||
(void) __close (fd);
|
||||
- if (l != NULL)
|
||||
- {
|
||||
- /* We modify the list of loaded objects. */
|
||||
- __rtld_lock_lock_recursive (GL(dl_load_write_lock));
|
||||
- /* Remove the stillborn object from the list and free it. */
|
||||
- assert (l->l_next == NULL);
|
||||
- if (l->l_prev == NULL)
|
||||
- /* No other module loaded. This happens only in the static library,
|
||||
- or in rtld under --verify. */
|
||||
- GL(dl_ns)[l->l_ns]._ns_loaded = NULL;
|
||||
- else
|
||||
- l->l_prev->l_next = NULL;
|
||||
- --GL(dl_ns)[l->l_ns]._ns_nloaded;
|
||||
- free (l);
|
||||
- __rtld_lock_unlock_recursive (GL(dl_load_write_lock));
|
||||
- }
|
||||
+ free (l);
|
||||
free (realname);
|
||||
|
||||
if (r != NULL)
|
||||
@@ -897,6 +882,9 @@ _dl_map_object_from_fd (const char *name
|
||||
never be unloaded. */
|
||||
__close (fd);
|
||||
|
||||
+ /* Add the map for the mirrored object to the object list. */
|
||||
+ _dl_add_to_namespace_list (l, nsid);
|
||||
+
|
||||
return l;
|
||||
}
|
||||
#endif
|
||||
@@ -1491,6 +1479,9 @@ cannot enable executable stack as shared
|
||||
add_name_to_object (l, ((const char *) D_PTR (l, l_info[DT_STRTAB])
|
||||
+ l->l_info[DT_SONAME]->d_un.d_val));
|
||||
|
||||
+ /* Now that the object is fully initialized add it to the object list. */
|
||||
+ _dl_add_to_namespace_list (l, nsid);
|
||||
+
|
||||
#ifdef SHARED
|
||||
/* Auditing checkpoint: we have a new object. */
|
||||
if (__builtin_expect (GLRO(dl_naudit) > 0, 0)
|
||||
@@ -2215,7 +2206,7 @@ _dl_map_object (struct link_map *loader,
|
||||
have. */
|
||||
static const Elf_Symndx dummy_bucket = STN_UNDEF;
|
||||
|
||||
- /* Enter the new object in the list of loaded objects. */
|
||||
+ /* Allocate a new object map. */
|
||||
if ((name_copy = local_strdup (name)) == NULL
|
||||
|| (l = _dl_new_object (name_copy, name, type, loader,
|
||||
mode, nsid)) == NULL)
|
||||
@@ -2233,6 +2224,9 @@ _dl_map_object (struct link_map *loader,
|
||||
l->l_nbuckets = 1;
|
||||
l->l_relocated = 1;
|
||||
|
||||
+ /* Enter the object in the object list. */
|
||||
+ _dl_add_to_namespace_list (l, nsid);
|
||||
+
|
||||
return l;
|
||||
}
|
||||
else if (found_other_class)
|
||||
Index: glibc-2.12-2-gc4ccff1/elf/dl-object.c
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/elf/dl-object.c
|
||||
+++ glibc-2.12-2-gc4ccff1/elf/dl-object.c
|
||||
@@ -26,16 +26,41 @@
|
||||
#include <assert.h>
|
||||
|
||||
|
||||
+/* Add the new link_map NEW to the end of the namespace list. */
|
||||
+void
|
||||
+internal_function
|
||||
+_dl_add_to_namespace_list (struct link_map *new, Lmid_t nsid)
|
||||
+{
|
||||
+ /* We modify the list of loaded objects. */
|
||||
+ __rtld_lock_lock_recursive (GL(dl_load_write_lock));
|
||||
+
|
||||
+ if (GL(dl_ns)[nsid]._ns_loaded != NULL)
|
||||
+ {
|
||||
+ struct link_map *l = GL(dl_ns)[nsid]._ns_loaded;
|
||||
+ while (l->l_next != NULL)
|
||||
+ l = l->l_next;
|
||||
+ new->l_prev = l;
|
||||
+ /* new->l_next = NULL; Would be necessary but we use calloc. */
|
||||
+ l->l_next = new;
|
||||
+ }
|
||||
+ else
|
||||
+ GL(dl_ns)[nsid]._ns_loaded = new;
|
||||
+ ++GL(dl_ns)[nsid]._ns_nloaded;
|
||||
+ new->l_serial = GL(dl_load_adds);
|
||||
+ ++GL(dl_load_adds);
|
||||
+
|
||||
+ __rtld_lock_unlock_recursive (GL(dl_load_write_lock));
|
||||
+}
|
||||
+
|
||||
+
|
||||
/* Allocate a `struct link_map' for a new object being loaded,
|
||||
and enter it into the _dl_loaded list. */
|
||||
-
|
||||
struct link_map *
|
||||
internal_function
|
||||
_dl_new_object (char *realname, const char *libname, int type,
|
||||
struct link_map *loader, int mode, Lmid_t nsid)
|
||||
{
|
||||
struct link_map *l;
|
||||
- int idx;
|
||||
size_t libname_len = strlen (libname) + 1;
|
||||
struct link_map *new;
|
||||
struct libname_list *newname;
|
||||
@@ -93,31 +118,12 @@ _dl_new_object (char *realname, const ch
|
||||
new->l_scope = new->l_scope_mem;
|
||||
new->l_scope_max = sizeof (new->l_scope_mem) / sizeof (new->l_scope_mem[0]);
|
||||
|
||||
- /* We modify the list of loaded objects. */
|
||||
- __rtld_lock_lock_recursive (GL(dl_load_write_lock));
|
||||
-
|
||||
/* Counter for the scopes we have to handle. */
|
||||
- idx = 0;
|
||||
+ int idx = 0;
|
||||
|
||||
if (GL(dl_ns)[nsid]._ns_loaded != NULL)
|
||||
- {
|
||||
- l = GL(dl_ns)[nsid]._ns_loaded;
|
||||
- while (l->l_next != NULL)
|
||||
- l = l->l_next;
|
||||
- new->l_prev = l;
|
||||
- /* new->l_next = NULL; Would be necessary but we use calloc. */
|
||||
- l->l_next = new;
|
||||
-
|
||||
- /* Add the global scope. */
|
||||
- new->l_scope[idx++] = &GL(dl_ns)[nsid]._ns_loaded->l_searchlist;
|
||||
- }
|
||||
- else
|
||||
- GL(dl_ns)[nsid]._ns_loaded = new;
|
||||
- ++GL(dl_ns)[nsid]._ns_nloaded;
|
||||
- new->l_serial = GL(dl_load_adds);
|
||||
- ++GL(dl_load_adds);
|
||||
-
|
||||
- __rtld_lock_unlock_recursive (GL(dl_load_write_lock));
|
||||
+ /* Add the global scope. */
|
||||
+ new->l_scope[idx++] = &GL(dl_ns)[nsid]._ns_loaded->l_searchlist;
|
||||
|
||||
/* If we have no loader the new object acts as it. */
|
||||
if (loader == NULL)
|
||||
Index: glibc-2.12-2-gc4ccff1/elf/rtld.c
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/elf/rtld.c
|
||||
+++ glibc-2.12-2-gc4ccff1/elf/rtld.c
|
||||
@@ -1108,11 +1108,15 @@ of this helper program; chances are you
|
||||
main_map = _dl_new_object ((char *) "", "", lt_executable, NULL,
|
||||
__RTLD_OPENEXEC, LM_ID_BASE);
|
||||
assert (main_map != NULL);
|
||||
- assert (main_map == GL(dl_ns)[LM_ID_BASE]._ns_loaded);
|
||||
main_map->l_phdr = phdr;
|
||||
main_map->l_phnum = phnum;
|
||||
main_map->l_entry = *user_entry;
|
||||
|
||||
+ /* Even though the link map is not yet fully initialized we can add
|
||||
+ it to the map list since there are no possible users running yet. */
|
||||
+ _dl_add_to_namespace_list (main_map, LM_ID_BASE);
|
||||
+ assert (main_map == GL(dl_ns)[LM_ID_BASE]._ns_loaded);
|
||||
+
|
||||
/* At this point we are in a bit of trouble. We would have to
|
||||
fill in the values for l_dev and l_ino. But in general we
|
||||
do not know where the file is. We also do not handle AT_EXECFD
|
||||
@@ -1380,6 +1384,9 @@ of this helper program; chances are you
|
||||
l->l_libname->name = memcpy (copy, dsoname, len);
|
||||
}
|
||||
|
||||
+ /* Add the vDSO to the object list. */
|
||||
+ _dl_add_to_namespace_list (l, LM_ID_BASE);
|
||||
+
|
||||
/* Rearrange the list so this DSO appears after rtld_map. */
|
||||
assert (l->l_next == NULL);
|
||||
assert (l->l_prev == main_map);
|
||||
Index: glibc-2.12-2-gc4ccff1/sysdeps/generic/ldsodefs.h
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/sysdeps/generic/ldsodefs.h
|
||||
+++ glibc-2.12-2-gc4ccff1/sysdeps/generic/ldsodefs.h
|
||||
@@ -891,8 +891,11 @@ extern lookup_t _dl_lookup_symbol_x (con
|
||||
extern ElfW(Addr) _dl_symbol_value (struct link_map *map, const char *name)
|
||||
internal_function;
|
||||
|
||||
-/* Allocate a `struct link_map' for a new object being loaded,
|
||||
- and enter it into the _dl_main_map list. */
|
||||
+/* Add the new link_map NEW to the end of the namespace list. */
|
||||
+extern void _dl_add_to_namespace_list (struct link_map *new, Lmid_t nsid)
|
||||
+ internal_function attribute_hidden;
|
||||
+
|
||||
+/* Allocate a `struct link_map' for a new object being loaded. */
|
||||
extern struct link_map *_dl_new_object (char *realname, const char *libname,
|
||||
int type, struct link_map *loader,
|
||||
int mode, Lmid_t nsid)
|
||||
58
src/patches/glibc/glibc-rh647448.patch
Normal file
58
src/patches/glibc/glibc-rh647448.patch
Normal file
@@ -0,0 +1,58 @@
|
||||
2010-10-25 Ulrich Drepper <drepper@redhat.com>
|
||||
|
||||
[BZ #12159]
|
||||
* sysdeps/x86_64/multiarch/strchr.S: Fix propagation of search byte
|
||||
into all bytes of SSE register.
|
||||
Patch by Richard Li <richardpku@gmail.com>.
|
||||
|
||||
Index: glibc-2.12-2-gc4ccff1/string/Makefile
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/string/Makefile
|
||||
+++ glibc-2.12-2-gc4ccff1/string/Makefile
|
||||
@@ -55,7 +55,7 @@ tests := tester inl-tester noinl-tester
|
||||
tst-strtok tst-strxfrm bug-strcoll1 tst-strfry \
|
||||
bug-strtok1 $(addprefix test-,$(strop-tests)) \
|
||||
bug-envz1 tst-strxfrm2 tst-endian tst-svc2 \
|
||||
- bug-strstr1
|
||||
+ bug-strstr1 bug-strchr1
|
||||
distribute := memcopy.h pagecopy.h tst-svc.expect test-string.h \
|
||||
str-two-way.h
|
||||
|
||||
Index: glibc-2.12-2-gc4ccff1/string/bug-strchr1.c
|
||||
===================================================================
|
||||
--- /dev/null
|
||||
+++ glibc-2.12-2-gc4ccff1/string/bug-strchr1.c
|
||||
@@ -0,0 +1,14 @@
|
||||
+#include <stdio.h>
|
||||
+#include <string.h>
|
||||
+
|
||||
+static int
|
||||
+do_test (void)
|
||||
+{
|
||||
+ char s[] __attribute__((aligned(16))) = "\xff";
|
||||
+ char *p = strchr (s, '\xfe');
|
||||
+ printf ("%p\n", p);
|
||||
+ return p != NULL;
|
||||
+}
|
||||
+
|
||||
+#define TEST_FUNCTION do_test ()
|
||||
+#include "../test-skeleton.c"
|
||||
Index: glibc-2.12-2-gc4ccff1/sysdeps/x86_64/multiarch/strchr.S
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/sysdeps/x86_64/multiarch/strchr.S
|
||||
+++ glibc-2.12-2-gc4ccff1/sysdeps/x86_64/multiarch/strchr.S
|
||||
@@ -87,13 +87,13 @@ __strchr_sse42:
|
||||
pxor %xmm2, %xmm2
|
||||
movd %esi, %xmm1
|
||||
movl %edi, %ecx
|
||||
+ pshufb %xmm2, %xmm1
|
||||
andl $15, %ecx
|
||||
movq %rdi, %r8
|
||||
je L(aligned_start)
|
||||
|
||||
/* Handle unaligned string. */
|
||||
andq $-16, %r8
|
||||
- pshufb %xmm2, %xmm1
|
||||
movdqa (%r8), %xmm0
|
||||
pcmpeqb %xmm0, %xmm2
|
||||
pcmpeqb %xmm1, %xmm0
|
||||
21
src/patches/glibc/glibc-rh652661.patch
Normal file
21
src/patches/glibc/glibc-rh652661.patch
Normal file
@@ -0,0 +1,21 @@
|
||||
2010-05-20 Andreas Schwab <schwab@redhat.com>
|
||||
|
||||
* sysdeps/unix/sysv/linux/sys/timex.h: Use __REDIRECT_NTH.
|
||||
|
||||
Index: glibc-2.12-2-gc4ccff1/sysdeps/unix/sysv/linux/sys/timex.h
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/sysdeps/unix/sysv/linux/sys/timex.h
|
||||
+++ glibc-2.12-2-gc4ccff1/sysdeps/unix/sysv/linux/sys/timex.h
|
||||
@@ -140,9 +140,9 @@ __BEGIN_DECLS
|
||||
extern int __adjtimex (struct timex *__ntx) __THROW;
|
||||
extern int adjtimex (struct timex *__ntx) __THROW;
|
||||
|
||||
-#if defined __GNUC__ && __GNUC__ >= 2
|
||||
-extern int ntp_gettime (struct ntptimeval *__ntv)
|
||||
- __asm__ ("ntp_gettimex") __THROW;
|
||||
+#ifdef __REDIRECT_NTH
|
||||
+extern int __REDIRECT_NTH (ntp_gettime, (struct ntptimeval *__ntv),
|
||||
+ ntp_gettimex);
|
||||
#else
|
||||
extern int ntp_gettimex (struct ntptimeval *__ntv) __THROW;
|
||||
# define ntp_gettime ntp_gettimex
|
||||
45
src/patches/glibc/glibc-rh656014.patch
Normal file
45
src/patches/glibc/glibc-rh656014.patch
Normal file
@@ -0,0 +1,45 @@
|
||||
2010-11-24 Andreas Schwab <schwab@redhat.com>
|
||||
|
||||
* resolv/nss_dns/dns-host.c (getanswer_r): Don't handle ttl == 0
|
||||
specially.
|
||||
(gaih_getanswer_slice): Likewise.
|
||||
|
||||
Index: glibc-2.12-2-gc4ccff1/resolv/nss_dns/dns-host.c
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/resolv/nss_dns/dns-host.c
|
||||
+++ glibc-2.12-2-gc4ccff1/resolv/nss_dns/dns-host.c
|
||||
@@ -599,7 +599,6 @@ getanswer_r (const querybuf *answer, int
|
||||
int (*name_ok) (const char *);
|
||||
u_char packtmp[NS_MAXCDNAME];
|
||||
int have_to_map = 0;
|
||||
- int32_t ttl = 0;
|
||||
uintptr_t pad = -(uintptr_t) buffer % __alignof__ (struct host_data);
|
||||
buffer += pad;
|
||||
if (__builtin_expect (buflen < sizeof (struct host_data) + pad, 0))
|
||||
@@ -733,7 +732,7 @@ getanswer_r (const querybuf *answer, int
|
||||
cp += INT16SZ; /* type */
|
||||
class = __ns_get16 (cp);
|
||||
cp += INT16SZ; /* class */
|
||||
- ttl = __ns_get32 (cp);
|
||||
+ int32_t ttl = __ns_get32 (cp);
|
||||
cp += INT32SZ; /* TTL */
|
||||
n = __ns_get16 (cp);
|
||||
cp += INT16SZ; /* len */
|
||||
@@ -907,7 +906,7 @@ getanswer_r (const querybuf *answer, int
|
||||
{
|
||||
register int nn;
|
||||
|
||||
- if (ttlp != NULL && ttl != 0)
|
||||
+ if (ttlp != NULL)
|
||||
*ttlp = ttl;
|
||||
if (canonp != NULL)
|
||||
*canonp = bp;
|
||||
@@ -1163,7 +1162,7 @@ gaih_getanswer_slice (const querybuf *an
|
||||
|
||||
if (*firstp)
|
||||
{
|
||||
- if (ttl != 0 && ttlp != NULL)
|
||||
+ if (ttlp != NULL)
|
||||
*ttlp = ttl;
|
||||
|
||||
(*pat)->name = canon ?: h_name;
|
||||
21
src/patches/glibc/glibc-rh656530.patch
Normal file
21
src/patches/glibc/glibc-rh656530.patch
Normal file
@@ -0,0 +1,21 @@
|
||||
2010-11-10 Luis Machado <luisgpm@br.ibm.com>
|
||||
|
||||
* sysdeps/ieee754/ldbl-128ibm/e_sqrtl.c (__ieee754_sqrtl): Force
|
||||
signed comparison.
|
||||
|
||||
Index: glibc-2.12-2-gc4ccff1/sysdeps/ieee754/ldbl-128ibm/e_sqrtl.c
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/sysdeps/ieee754/ldbl-128ibm/e_sqrtl.c
|
||||
+++ glibc-2.12-2-gc4ccff1/sysdeps/ieee754/ldbl-128ibm/e_sqrtl.c
|
||||
@@ -73,9 +73,9 @@ long double __ieee754_sqrtl(long double
|
||||
m = ((a.i[2] >> 20) & 0x7ff) - 54;
|
||||
}
|
||||
m += n;
|
||||
- if (m > 0)
|
||||
+ if ((int) m > 0)
|
||||
a.i[2] = (a.i[2] & 0x800fffff) | (m << 20);
|
||||
- else if (m <= -54) {
|
||||
+ else if ((int) m <= -54) {
|
||||
a.i[2] &= 0x80000000;
|
||||
a.i[3] = 0;
|
||||
} else {
|
||||
141
src/patches/glibc/glibc-rh657572.patch
Normal file
141
src/patches/glibc/glibc-rh657572.patch
Normal file
@@ -0,0 +1,141 @@
|
||||
commit 42c5011242e48f846111237552d3bf3ca18c4885
|
||||
Author: Ulrich Drepper <drepper@gmail.com>
|
||||
Date: Fri Dec 23 09:51:10 2011 -0500
|
||||
|
||||
Various fixes to fi_FI
|
||||
|
||||
2011-12-23 Ulrich Drepper <drepper@gmail.com>
|
||||
|
||||
[BZ #12962]
|
||||
* locales/fi_FI: Various fixups.
|
||||
Patch by Marko Myllynen <myllynen@redhat.com>.
|
||||
|
||||
diff --git a/localedata/locales/fi_FI b/localedata/locales/fi_FI
|
||||
index acc9ce6..f51700c 100644
|
||||
--- a/localedata/locales/fi_FI
|
||||
+++ b/localedata/locales/fi_FI
|
||||
@@ -1,4 +1,4 @@
|
||||
-escape_char /
|
||||
+escape_char /
|
||||
comment_char %
|
||||
|
||||
% Finnish language locale for Finland
|
||||
@@ -45,10 +45,10 @@ category "fi_FI:2000";LC_NUMERIC
|
||||
category "fi_FI:2000";LC_MONETARY
|
||||
category "fi_FI:2000";LC_MESSAGES
|
||||
category "fi_FI:2000";LC_PAPER
|
||||
+category "fi_FI:2000";LC_MEASUREMENT
|
||||
category "fi_FI:2000";LC_NAME
|
||||
category "fi_FI:2000";LC_ADDRESS
|
||||
category "fi_FI:2000";LC_TELEPHONE
|
||||
-
|
||||
END LC_IDENTIFICATION
|
||||
|
||||
LC_COLLATE
|
||||
@@ -125,7 +125,6 @@ reorder-after <U0044>
|
||||
<U0110> <d>;<OBL>;<CAP>;IGNORE
|
||||
|
||||
reorder-end
|
||||
-
|
||||
END LC_COLLATE
|
||||
|
||||
LC_CTYPE
|
||||
@@ -146,12 +145,10 @@ positive_sign ""
|
||||
negative_sign "<U002D>"
|
||||
int_frac_digits 2
|
||||
frac_digits 2
|
||||
-% int_curr_symbol precedes
|
||||
-% curr_symbol succeeds
|
||||
p_cs_precedes 0
|
||||
-p_sep_by_space 2
|
||||
+p_sep_by_space 1
|
||||
n_cs_precedes 0
|
||||
-n_sep_by_space 2
|
||||
+n_sep_by_space 1
|
||||
p_sign_posn 1
|
||||
n_sign_posn 1
|
||||
END LC_MONETARY
|
||||
@@ -173,18 +170,18 @@ day "<U0073><U0075><U006E><U006E><U0075><U006E><U0074><U0061><U0069>";/
|
||||
"<U0074><U006F><U0072><U0073><U0074><U0061><U0069>";/
|
||||
"<U0070><U0065><U0072><U006A><U0061><U006E><U0074><U0061><U0069>";/
|
||||
"<U006C><U0061><U0075><U0061><U006E><U0074><U0061><U0069>"
|
||||
-abmon "<U0074><U0061><U006D><U006D><U0069><U00A0>";/
|
||||
- "<U0068><U0065><U006C><U006D><U0069><U00A0>";/
|
||||
+abmon "<U0074><U0061><U006D><U006D><U0069>";/
|
||||
+ "<U0068><U0065><U006C><U006D><U0069>";/
|
||||
"<U006D><U0061><U0061><U006C><U0069><U0073>";/
|
||||
- "<U0068><U0075><U0068><U0074><U0069><U00A0>";/
|
||||
- "<U0074><U006F><U0075><U006B><U006F><U00A0>";/
|
||||
- "<U006B><U0065><U0073><U00E4><U00A0><U00A0>";/
|
||||
- "<U0068><U0065><U0069><U006E><U00E4><U00A0>";/
|
||||
- "<U0065><U006C><U006F><U00A0><U00A0><U00A0>";/
|
||||
- "<U0073><U0079><U0079><U0073><U00A0><U00A0>";/
|
||||
- "<U006C><U006F><U006B><U0061><U00A0><U00A0>";/
|
||||
+ "<U0068><U0075><U0068><U0074><U0069>";/
|
||||
+ "<U0074><U006F><U0075><U006B><U006F>";/
|
||||
+ "<U006B><U0065><U0073><U00E4>";/
|
||||
+ "<U0068><U0065><U0069><U006E><U00E4>";/
|
||||
+ "<U0065><U006C><U006F>";/
|
||||
+ "<U0073><U0079><U0079><U0073>";/
|
||||
+ "<U006C><U006F><U006B><U0061>";/
|
||||
"<U006D><U0061><U0072><U0072><U0061><U0073>";/
|
||||
- "<U006A><U006F><U0075><U006C><U0075><U00A0>"
|
||||
+ "<U006A><U006F><U0075><U006C><U0075>"
|
||||
mon "<U0074><U0061><U006D><U006D><U0069><U006B><U0075><U0075>";/
|
||||
"<U0068><U0065><U006C><U006D><U0069><U006B><U0075><U0075>";/
|
||||
"<U006D><U0061><U0061><U006C><U0069><U0073><U006B><U0075><U0075>";/
|
||||
@@ -207,13 +204,14 @@ t_fmt_ampm ""
|
||||
date_fmt "<U0025><U0061><U0020><U0025><U002D><U0064><U002E><U0025>/
|
||||
<U002D><U006D><U002E><U0025><U0059><U0020><U0025><U0048><U002E><U0025>/
|
||||
<U004D><U002E><U0025><U0053><U0020><U0025><U007A>"
|
||||
+week 7;19971130;4
|
||||
first_weekday 2 % Monday
|
||||
first_workday 2 % Monday
|
||||
END LC_TIME
|
||||
|
||||
LC_MESSAGES
|
||||
-yesexpr "<U005E><U005B><U004B><U006B><U004A><U006A><U0059><U0079><U005D><U002E><U002A>"
|
||||
-noexpr "<U005E><U005B><U004E><U006E><U0045><U0065><U005D><U002E><U002A>"
|
||||
+yesexpr "<U005E><U005B><U004B><U006B><U0059><U0079><U005D><U002E><U002A>"
|
||||
+noexpr "<U005E><U005B><U0045><U0065><U004E><U006E><U005D><U002E><U002A>"
|
||||
END LC_MESSAGES
|
||||
|
||||
LC_PAPER
|
||||
@@ -222,6 +220,7 @@ width 210
|
||||
END LC_PAPER
|
||||
|
||||
LC_TELEPHONE
|
||||
+tel_dom_fmt "<U0028><U0025><U0041><U0029><U0020><U0025><U006C>"
|
||||
tel_int_fmt "<U002B><U0025><U0063><U0020><U0025><U0061><U0020><U0025>/
|
||||
<U006C>"
|
||||
int_prefix "<U0033><U0035><U0038>"
|
||||
@@ -235,15 +234,25 @@ END LC_MEASUREMENT
|
||||
LC_NAME
|
||||
name_fmt "<U0025><U0064><U0025><U0074><U0025><U0067><U0025><U0074>/
|
||||
<U0025><U006D><U0025><U0074><U0025><U0066>"
|
||||
+% Finnish equivalents for Mr/Mrs/Miss/Ms are herra/rouva/rouva/neiti
|
||||
+% but they are practically never used, thus we don't define them here.
|
||||
END LC_NAME
|
||||
|
||||
LC_ADDRESS
|
||||
-postal_fmt "<U0025><U0066><U0025><U004E><U0025><U0061><U0025><U004E>/
|
||||
-<U0025><U0064><U0025><U004E><U0025><U0062><U0025><U004E><U0025><U0073>/
|
||||
-<U0020><U0025><U0068><U0020><U0025><U0065><U0020><U0025><U0072><U0025>/
|
||||
-<U004E><U0025><U007A><U0020><U0025><U0054><U0025>/
|
||||
+postal_fmt "<U0025><U0066><U0025><U004E><U0025><U0064><U0025><U004E>/
|
||||
+<U0025><U0062><U0025><U004E><U0025><U0061><U0025><U004E><U0025><U0073>/
|
||||
+<U0020><U0025><U0068><U0025><U0074><U0025><U0065><U0025><U0074><U0025>/
|
||||
+<U0072><U0025><U004E><U0025><U007A><U0020><U0025><U0054><U0025>/
|
||||
<U004E><U0025><U0063><U0025><U004E>"
|
||||
country_ab2 "<U0046><U0049>"
|
||||
country_ab3 "<U0046><U0049><U004E>"
|
||||
country_num 246
|
||||
+country_name "<U0053><U0075><U006F><U006D><U0069>"
|
||||
+country_post "<U0046><U0049>"
|
||||
+country_car "<U0046><U0049><U004E>"
|
||||
+country_isbn 952
|
||||
+lang_name "<U0073><U0075><U006F><U006D><U0069>"
|
||||
+lang_ab "<U0066><U0069>"
|
||||
+lang_term "<U0066><U0069><U006E>"
|
||||
+lang_lib "<U0066><U0069><U006E>"
|
||||
END LC_ADDRESS
|
||||
188
src/patches/glibc/glibc-rh661982.patch
Normal file
188
src/patches/glibc/glibc-rh661982.patch
Normal file
@@ -0,0 +1,188 @@
|
||||
2010-12-10 Andreas Schwab <schwab@redhat.com>
|
||||
|
||||
* wcsmbs/wchar.h (wcpcpy, wcpncpy): Only declare under
|
||||
_GNU_SOURCE.
|
||||
|
||||
2010-12-10 Andreas Schwab <schwab@redhat.com>
|
||||
|
||||
* wcsmbs/wchar.h (wcpcpy, wcpncpy): Add __restrict.
|
||||
* wcsmbs/bits/wchar2.h (__wmemmove_chk_warn, wmemmove, wmemset):
|
||||
Remove __restrict.
|
||||
(wcscpy, __wcpcpy_chk, __wcpcpy_alias, wcpcpy, wcsncpy, wcpncpy)
|
||||
(wcscat, wcsncat, __wcrtomb_chk, wcrtomb): Add __restrict.
|
||||
|
||||
2010-12-09 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
* string/bits/string3.h (memmove, bcopy): Remove __restrict.
|
||||
|
||||
Index: glibc-2.12-2-gc4ccff1/string/bits/string3.h
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/string/bits/string3.h
|
||||
+++ glibc-2.12-2-gc4ccff1/string/bits/string3.h
|
||||
@@ -53,8 +53,7 @@ __NTH (memcpy (void *__restrict __dest,
|
||||
}
|
||||
|
||||
__extern_always_inline void *
|
||||
-__NTH (memmove (void *__restrict __dest, __const void *__restrict __src,
|
||||
- size_t __len))
|
||||
+__NTH (memmove (void *__dest, __const void *__src, size_t __len))
|
||||
{
|
||||
return __builtin___memmove_chk (__dest, __src, __len, __bos0 (__dest));
|
||||
}
|
||||
@@ -88,8 +87,7 @@ __NTH (memset (void *__dest, int __ch, s
|
||||
|
||||
#ifdef __USE_BSD
|
||||
__extern_always_inline void
|
||||
-__NTH (bcopy (__const void *__restrict __src, void *__restrict __dest,
|
||||
- size_t __len))
|
||||
+__NTH (bcopy (__const void *__src, void *__dest, size_t __len))
|
||||
{
|
||||
(void) __builtin___memmove_chk (__dest, __src, __len, __bos0 (__dest));
|
||||
}
|
||||
Index: glibc-2.12-2-gc4ccff1/wcsmbs/bits/wchar2.h
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/wcsmbs/bits/wchar2.h
|
||||
+++ glibc-2.12-2-gc4ccff1/wcsmbs/bits/wchar2.h
|
||||
@@ -60,15 +60,13 @@ extern wchar_t *__REDIRECT_NTH (__wmemmo
|
||||
__const wchar_t *__s2,
|
||||
size_t __n), wmemmove);
|
||||
extern wchar_t *__REDIRECT_NTH (__wmemmove_chk_warn,
|
||||
- (wchar_t *__restrict __s1,
|
||||
- __const wchar_t *__restrict __s2, size_t __n,
|
||||
- size_t __ns1), __wmemmove_chk)
|
||||
+ (wchar_t *__s1, __const wchar_t *__s2,
|
||||
+ size_t __n, size_t __ns1), __wmemmove_chk)
|
||||
__warnattr ("wmemmove called with length bigger than size of destination "
|
||||
"buffer");
|
||||
|
||||
__extern_always_inline wchar_t *
|
||||
-__NTH (wmemmove (wchar_t *__restrict __s1, __const wchar_t *__restrict __s2,
|
||||
- size_t __n))
|
||||
+__NTH (wmemmove (wchar_t *__s1, __const wchar_t *__s2, size_t __n))
|
||||
{
|
||||
if (__bos0 (__s1) != (size_t) -1)
|
||||
{
|
||||
@@ -129,7 +127,7 @@ extern wchar_t *__REDIRECT_NTH (__wmemse
|
||||
"buffer");
|
||||
|
||||
__extern_always_inline wchar_t *
|
||||
-__NTH (wmemset (wchar_t *__restrict __s, wchar_t __c, size_t __n))
|
||||
+__NTH (wmemset (wchar_t *__s, wchar_t __c, size_t __n))
|
||||
{
|
||||
if (__bos0 (__s) != (size_t) -1)
|
||||
{
|
||||
@@ -152,7 +150,7 @@ extern wchar_t *__REDIRECT_NTH (__wcscpy
|
||||
__const wchar_t *__restrict __src), wcscpy);
|
||||
|
||||
__extern_always_inline wchar_t *
|
||||
-__NTH (wcscpy (wchar_t *__dest, __const wchar_t *__src))
|
||||
+__NTH (wcscpy (wchar_t *__restrict __dest, __const wchar_t *__restrict __src))
|
||||
{
|
||||
if (__bos (__dest) != (size_t) -1)
|
||||
return __wcscpy_chk (__dest, __src, __bos (__dest) / sizeof (wchar_t));
|
||||
@@ -160,14 +158,15 @@ __NTH (wcscpy (wchar_t *__dest, __const
|
||||
}
|
||||
|
||||
|
||||
-extern wchar_t *__wcpcpy_chk (wchar_t *__dest, __const wchar_t *__src,
|
||||
+extern wchar_t *__wcpcpy_chk (wchar_t *__restrict __dest,
|
||||
+ __const wchar_t *__restrict __src,
|
||||
size_t __destlen) __THROW;
|
||||
-extern wchar_t *__REDIRECT_NTH (__wcpcpy_alias, (wchar_t *__dest,
|
||||
- __const wchar_t *__src),
|
||||
- wcpcpy);
|
||||
+extern wchar_t *__REDIRECT_NTH (__wcpcpy_alias,
|
||||
+ (wchar_t *__restrict __dest,
|
||||
+ __const wchar_t *__restrict __src), wcpcpy);
|
||||
|
||||
__extern_always_inline wchar_t *
|
||||
-__NTH (wcpcpy (wchar_t *__dest, __const wchar_t *__src))
|
||||
+__NTH (wcpcpy (wchar_t *__restrict __dest, __const wchar_t *__restrict __src))
|
||||
{
|
||||
if (__bos (__dest) != (size_t) -1)
|
||||
return __wcpcpy_chk (__dest, __src, __bos (__dest) / sizeof (wchar_t));
|
||||
@@ -190,7 +189,8 @@ extern wchar_t *__REDIRECT_NTH (__wcsncp
|
||||
"buffer");
|
||||
|
||||
__extern_always_inline wchar_t *
|
||||
-__NTH (wcsncpy (wchar_t *__dest, __const wchar_t *__src, size_t __n))
|
||||
+__NTH (wcsncpy (wchar_t *__restrict __dest, __const wchar_t *__restrict __src,
|
||||
+ size_t __n))
|
||||
{
|
||||
if (__bos (__dest) != (size_t) -1)
|
||||
{
|
||||
@@ -220,7 +220,8 @@ extern wchar_t *__REDIRECT_NTH (__wcpncp
|
||||
"buffer");
|
||||
|
||||
__extern_always_inline wchar_t *
|
||||
-__NTH (wcpncpy (wchar_t *__dest, __const wchar_t *__src, size_t __n))
|
||||
+__NTH (wcpncpy (wchar_t *__restrict __dest, __const wchar_t *__restrict __src,
|
||||
+ size_t __n))
|
||||
{
|
||||
if (__bos (__dest) != (size_t) -1)
|
||||
{
|
||||
@@ -243,7 +244,7 @@ extern wchar_t *__REDIRECT_NTH (__wcscat
|
||||
__const wchar_t *__restrict __src), wcscat);
|
||||
|
||||
__extern_always_inline wchar_t *
|
||||
-__NTH (wcscat (wchar_t *__dest, __const wchar_t *__src))
|
||||
+__NTH (wcscat (wchar_t *__restrict __dest, __const wchar_t *__restrict __src))
|
||||
{
|
||||
if (__bos (__dest) != (size_t) -1)
|
||||
return __wcscat_chk (__dest, __src, __bos (__dest) / sizeof (wchar_t));
|
||||
@@ -260,7 +261,8 @@ extern wchar_t *__REDIRECT_NTH (__wcsnca
|
||||
size_t __n), wcsncat);
|
||||
|
||||
__extern_always_inline wchar_t *
|
||||
-__NTH (wcsncat (wchar_t *__dest, __const wchar_t *__src, size_t __n))
|
||||
+__NTH (wcsncat (wchar_t *__restrict __dest, __const wchar_t *__restrict __src,
|
||||
+ size_t __n))
|
||||
{
|
||||
if (__bos (__dest) != (size_t) -1)
|
||||
return __wcsncat_chk (__dest, __src, __n,
|
||||
@@ -428,14 +430,16 @@ fgetws_unlocked (wchar_t *__restrict __s
|
||||
#endif
|
||||
|
||||
|
||||
-extern size_t __wcrtomb_chk (char *__s, wchar_t __wchar, mbstate_t *__p,
|
||||
- size_t __buflen) __THROW __wur;
|
||||
+extern size_t __wcrtomb_chk (char *__restrict __s, wchar_t __wchar,
|
||||
+ mbstate_t *__restrict __p,
|
||||
+ size_t __buflen) __THROW __wur;
|
||||
extern size_t __REDIRECT_NTH (__wcrtomb_alias,
|
||||
(char *__restrict __s, wchar_t __wchar,
|
||||
mbstate_t *__restrict __ps), wcrtomb) __wur;
|
||||
|
||||
__extern_always_inline __wur size_t
|
||||
-__NTH (wcrtomb (char *__s, wchar_t __wchar, mbstate_t *__ps))
|
||||
+__NTH (wcrtomb (char *__restrict __s, wchar_t __wchar,
|
||||
+ mbstate_t *__restrict __ps))
|
||||
{
|
||||
/* We would have to include <limits.h> to get a definition of MB_LEN_MAX.
|
||||
But this would only disturb the namespace. So we define our own
|
||||
Index: glibc-2.12-2-gc4ccff1/wcsmbs/wchar.h
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/wcsmbs/wchar.h
|
||||
+++ glibc-2.12-2-gc4ccff1/wcsmbs/wchar.h
|
||||
@@ -555,17 +555,17 @@ extern float wcstof_l (__const wchar_t *
|
||||
extern long double wcstold_l (__const wchar_t *__restrict __nptr,
|
||||
wchar_t **__restrict __endptr,
|
||||
__locale_t __loc) __THROW;
|
||||
-#endif /* GNU */
|
||||
|
||||
|
||||
-#ifdef __USE_XOPEN2K8
|
||||
/* Copy SRC to DEST, returning the address of the terminating L'\0' in
|
||||
DEST. */
|
||||
-extern wchar_t *wcpcpy (wchar_t *__dest, __const wchar_t *__src) __THROW;
|
||||
+extern wchar_t *wcpcpy (wchar_t *__restrict __dest,
|
||||
+ __const wchar_t *__restrict __src) __THROW;
|
||||
|
||||
/* Copy no more than N characters of SRC to DEST, returning the address of
|
||||
the last character written into DEST. */
|
||||
-extern wchar_t *wcpncpy (wchar_t *__dest, __const wchar_t *__src, size_t __n)
|
||||
+extern wchar_t *wcpncpy (wchar_t *__restrict __dest,
|
||||
+ __const wchar_t *__restrict __src, size_t __n)
|
||||
__THROW;
|
||||
#endif /* use GNU */
|
||||
|
||||
160
src/patches/glibc/glibc-rh667974.patch
Normal file
160
src/patches/glibc/glibc-rh667974.patch
Normal file
@@ -0,0 +1,160 @@
|
||||
2011-03-14 Andreas Schwab <schwab@redhat.com>
|
||||
|
||||
* elf/dl-load.c (is_dst): Remove parameter secure, all callers
|
||||
changed. Don't check for isolated use.
|
||||
(_dl_dst_substitute): Ignore rpath elements containing
|
||||
non-isolated use of $ORIGIN when privileged.
|
||||
|
||||
* elf/dl-load.c (_dl_dst_substitute): When skipping the first
|
||||
rpath element also skip the following colon.
|
||||
(expand_dynamic_string_token): Add is_path parameter and pass
|
||||
down to DL_DST_REQUIRED and _dl_dst_substitute.
|
||||
(decompose_rpath): Call expand_dynamic_string_token with
|
||||
non-zero is_path. Ignore empty rpaths.
|
||||
(_dl_map_object_from_fd): Call expand_dynamic_string_token
|
||||
with zero is_path.
|
||||
|
||||
Index: glibc-2.12-2-gc4ccff1/elf/dl-load.c
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/elf/dl-load.c
|
||||
+++ glibc-2.12-2-gc4ccff1/elf/dl-load.c
|
||||
@@ -169,8 +169,7 @@ local_strdup (const char *s)
|
||||
|
||||
|
||||
static size_t
|
||||
-is_dst (const char *start, const char *name, const char *str,
|
||||
- int is_path, int secure)
|
||||
+is_dst (const char *start, const char *name, const char *str, int is_path)
|
||||
{
|
||||
size_t len;
|
||||
bool is_curly = false;
|
||||
@@ -199,11 +198,6 @@ is_dst (const char *start, const char *n
|
||||
&& (!is_path || name[len] != ':'))
|
||||
return 0;
|
||||
|
||||
- if (__builtin_expect (secure, 0)
|
||||
- && ((name[len] != '\0' && (!is_path || name[len] != ':'))
|
||||
- || (name != start + 1 && (!is_path || name[-2] != ':'))))
|
||||
- return 0;
|
||||
-
|
||||
return len;
|
||||
}
|
||||
|
||||
@@ -218,13 +212,10 @@ _dl_dst_count (const char *name, int is_
|
||||
{
|
||||
size_t len;
|
||||
|
||||
- /* $ORIGIN is not expanded for SUID/GUID programs (except if it
|
||||
- is $ORIGIN alone) and it must always appear first in path. */
|
||||
++name;
|
||||
- if ((len = is_dst (start, name, "ORIGIN", is_path,
|
||||
- INTUSE(__libc_enable_secure))) != 0
|
||||
- || (len = is_dst (start, name, "PLATFORM", is_path, 0)) != 0
|
||||
- || (len = is_dst (start, name, "LIB", is_path, 0)) != 0)
|
||||
+ if ((len = is_dst (start, name, "ORIGIN", is_path)) != 0
|
||||
+ || (len = is_dst (start, name, "PLATFORM", is_path)) != 0
|
||||
+ || (len = is_dst (start, name, "LIB", is_path)) != 0)
|
||||
++cnt;
|
||||
|
||||
name = strchr (name + len, '$');
|
||||
@@ -256,9 +247,16 @@ _dl_dst_substitute (struct link_map *l,
|
||||
size_t len;
|
||||
|
||||
++name;
|
||||
- if ((len = is_dst (start, name, "ORIGIN", is_path,
|
||||
- INTUSE(__libc_enable_secure))) != 0)
|
||||
+ if ((len = is_dst (start, name, "ORIGIN", is_path)) != 0)
|
||||
{
|
||||
+ /* $ORIGIN is not expanded for SUID/GUID programs
|
||||
+ (except if it is $ORIGIN alone) and it must always
|
||||
+ appear first in path. */
|
||||
+ if (__builtin_expect (INTUSE(__libc_enable_secure), 0)
|
||||
+ && ((name[len] != '\0' && (!is_path || name[len] != ':'))
|
||||
+ || (name != start + 1 && (!is_path || name[-2] != ':'))))
|
||||
+ repl = (const char *) -1;
|
||||
+ else
|
||||
#ifndef SHARED
|
||||
if (l == NULL)
|
||||
repl = _dl_get_origin ();
|
||||
@@ -266,9 +264,9 @@ _dl_dst_substitute (struct link_map *l,
|
||||
#endif
|
||||
repl = l->l_origin;
|
||||
}
|
||||
- else if ((len = is_dst (start, name, "PLATFORM", is_path, 0)) != 0)
|
||||
+ else if ((len = is_dst (start, name, "PLATFORM", is_path)) != 0)
|
||||
repl = GLRO(dl_platform);
|
||||
- else if ((len = is_dst (start, name, "LIB", is_path, 0)) != 0)
|
||||
+ else if ((len = is_dst (start, name, "LIB", is_path)) != 0)
|
||||
repl = DL_DST_LIB;
|
||||
|
||||
if (repl != NULL && repl != (const char *) -1)
|
||||
@@ -284,6 +282,10 @@ _dl_dst_substitute (struct link_map *l,
|
||||
name += len;
|
||||
while (*name != '\0' && (!is_path || *name != ':'))
|
||||
++name;
|
||||
+ /* Also skip following colon if this is the first rpath
|
||||
+ element, but keep an empty element at the end. */
|
||||
+ if (wp == result && is_path && *name == ':' && name[1] != '\0')
|
||||
+ ++name;
|
||||
}
|
||||
else
|
||||
/* No DST we recognize. */
|
||||
@@ -310,7 +312,7 @@ _dl_dst_substitute (struct link_map *l,
|
||||
belonging to the map is loaded. In this case the path element
|
||||
containing $ORIGIN is left out. */
|
||||
static char *
|
||||
-expand_dynamic_string_token (struct link_map *l, const char *s)
|
||||
+expand_dynamic_string_token (struct link_map *l, const char *s, int is_path)
|
||||
{
|
||||
/* We make two runs over the string. First we determine how large the
|
||||
resulting string is and then we copy it over. Since this is no
|
||||
@@ -321,7 +323,7 @@ expand_dynamic_string_token (struct link
|
||||
char *result;
|
||||
|
||||
/* Determine the number of DST elements. */
|
||||
- cnt = DL_DST_COUNT (s, 1);
|
||||
+ cnt = DL_DST_COUNT (s, is_path);
|
||||
|
||||
/* If we do not have to replace anything simply copy the string. */
|
||||
if (__builtin_expect (cnt, 0) == 0)
|
||||
@@ -335,7 +337,7 @@ expand_dynamic_string_token (struct link
|
||||
if (result == NULL)
|
||||
return NULL;
|
||||
|
||||
- return _dl_dst_substitute (l, s, result, 1);
|
||||
+ return _dl_dst_substitute (l, s, result, is_path);
|
||||
}
|
||||
|
||||
|
||||
@@ -551,13 +553,21 @@ decompose_rpath (struct r_search_path_st
|
||||
|
||||
/* Make a writable copy. At the same time expand possible dynamic
|
||||
string tokens. */
|
||||
- copy = expand_dynamic_string_token (l, rpath);
|
||||
+ copy = expand_dynamic_string_token (l, rpath, 1);
|
||||
if (copy == NULL)
|
||||
{
|
||||
errstring = N_("cannot create RUNPATH/RPATH copy");
|
||||
goto signal_error;
|
||||
}
|
||||
|
||||
+ /* Ignore empty rpaths. */
|
||||
+ if (*copy == 0)
|
||||
+ {
|
||||
+ free (copy);
|
||||
+ sps->dirs = (char *) -1;
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
/* Count the number of necessary elements in the result array. */
|
||||
nelems = 0;
|
||||
for (cp = copy; *cp != '\0'; ++cp)
|
||||
@@ -2176,7 +2186,7 @@ _dl_map_object (struct link_map *loader,
|
||||
{
|
||||
/* The path may contain dynamic string tokens. */
|
||||
realname = (loader
|
||||
- ? expand_dynamic_string_token (loader, name)
|
||||
+ ? expand_dynamic_string_token (loader, name, 0)
|
||||
: local_strdup (name));
|
||||
if (realname == NULL)
|
||||
fd = -1;
|
||||
714
src/patches/glibc/glibc-rh676076.patch
Normal file
714
src/patches/glibc/glibc-rh676076.patch
Normal file
@@ -0,0 +1,714 @@
|
||||
2011-03-02 Harsha Jagasia <harsha.jagasia@amd.com>
|
||||
Ulrich Drepper <drepper@gmail.com>
|
||||
|
||||
* sysdeps/x86_64/memset.S: After aligning destination, code
|
||||
branches to different locations depending on the value of
|
||||
misalignment, when multiarch is enabled. Fix this.
|
||||
|
||||
2011-03-02 Harsha Jagasia <harsha.jagasia@amd.com>
|
||||
|
||||
* sysdeps/x86_64/cacheinfo.c (init_cacheinfo):
|
||||
Set _x86_64_preferred_memory_instruction for AMD processsors.
|
||||
* sysdeps/x86_64/multiarch/init-arch.c (__init_cpu_features):
|
||||
Set bit_Prefer_SSE_for_memop for AMD processors.
|
||||
|
||||
2010-11-07 H.J. Lu <hongjiu.lu@intel.com>
|
||||
|
||||
* sysdeps/x86_64/memset.S: Check USE_MULTIARCH and USE_SSE2 for
|
||||
IFUNC support.
|
||||
* sysdeps/x86_64/multiarch/Makefile (sysdep_routines): Add
|
||||
memset-x86-64.
|
||||
* sysdeps/x86_64/multiarch/bzero.S: New file.
|
||||
* sysdeps/x86_64/multiarch/cacheinfo.c: New file.
|
||||
* sysdeps/x86_64/multiarch/memset-x86-64.S: New file.
|
||||
* sysdeps/x86_64/multiarch/memset.S: New file.
|
||||
* sysdeps/x86_64/multiarch/memset_chk.S: New file.
|
||||
* sysdeps/x86_64/multiarch/init-arch.c (__init_cpu_features):
|
||||
Set bit_Prefer_SSE_for_memop for Intel processors.
|
||||
* sysdeps/x86_64/multiarch/init-arch.h (bit_Prefer_SSE_for_memop):
|
||||
Define.
|
||||
(index_Prefer_SSE_for_memop): Define.
|
||||
(HAS_PREFER_SSE_FOR_MEMOP): Define.
|
||||
|
||||
Index: glibc-2.12-2-gc4ccff1/sysdeps/x86_64/cacheinfo.c
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/sysdeps/x86_64/cacheinfo.c
|
||||
+++ glibc-2.12-2-gc4ccff1/sysdeps/x86_64/cacheinfo.c
|
||||
@@ -613,6 +613,25 @@ init_cacheinfo (void)
|
||||
long int core = handle_amd (_SC_LEVEL2_CACHE_SIZE);
|
||||
shared = handle_amd (_SC_LEVEL3_CACHE_SIZE);
|
||||
|
||||
+#ifndef DISABLE_PREFERRED_MEMORY_INSTRUCTION
|
||||
+# ifdef USE_MULTIARCH
|
||||
+ eax = __cpu_features.cpuid[COMMON_CPUID_INDEX_1].eax;
|
||||
+ ebx = __cpu_features.cpuid[COMMON_CPUID_INDEX_1].ebx;
|
||||
+ ecx = __cpu_features.cpuid[COMMON_CPUID_INDEX_1].ecx;
|
||||
+ edx = __cpu_features.cpuid[COMMON_CPUID_INDEX_1].edx;
|
||||
+# else
|
||||
+ __cpuid (1, eax, ebx, ecx, edx);
|
||||
+# endif
|
||||
+
|
||||
+ /* AMD prefers SSSE3 instructions for memory/string routines
|
||||
+ if they are avaiable, otherwise it prefers integer
|
||||
+ instructions. */
|
||||
+ if ((ecx & 0x200))
|
||||
+ __x86_64_preferred_memory_instruction = 3;
|
||||
+ else
|
||||
+ __x86_64_preferred_memory_instruction = 0;
|
||||
+#endif
|
||||
+
|
||||
/* Get maximum extended function. */
|
||||
__cpuid (0x80000000, max_cpuid_ex, ebx, ecx, edx);
|
||||
|
||||
Index: glibc-2.12-2-gc4ccff1/sysdeps/x86_64/memset.S
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/sysdeps/x86_64/memset.S
|
||||
+++ glibc-2.12-2-gc4ccff1/sysdeps/x86_64/memset.S
|
||||
@@ -24,7 +24,7 @@
|
||||
#define __STOS_UPPER_BOUNDARY $65536
|
||||
|
||||
.text
|
||||
-#ifndef NOT_IN_libc
|
||||
+#if !defined NOT_IN_libc && !defined USE_MULTIARCH
|
||||
ENTRY(__bzero)
|
||||
mov %rsi,%rdx /* Adjust parameter. */
|
||||
xorl %esi,%esi /* Fill with 0s. */
|
||||
@@ -34,10 +34,10 @@ weak_alias (__bzero, bzero)
|
||||
#endif
|
||||
|
||||
#if defined PIC && !defined NOT_IN_libc
|
||||
-ENTRY (__memset_chk)
|
||||
+ENTRY_CHK (__memset_chk)
|
||||
cmpq %rdx, %rcx
|
||||
jb HIDDEN_JUMPTARGET (__chk_fail)
|
||||
-END (__memset_chk)
|
||||
+END_CHK (__memset_chk)
|
||||
#endif
|
||||
ENTRY (memset)
|
||||
L(memset_entry):
|
||||
@@ -591,157 +591,15 @@ L(A6Q1): mov %dx,-0xe(%rdi)
|
||||
L(A7Q0): mov %dl,-0x7(%rdi)
|
||||
L(A6Q0): mov %dx,-0x6(%rdi)
|
||||
mov %edx,-0x4(%rdi)
|
||||
- jmp L(aligned_now)
|
||||
-
|
||||
- .balign 16
|
||||
-L(aligned_now):
|
||||
-
|
||||
- cmpl $0x1,__x86_64_preferred_memory_instruction(%rip)
|
||||
- jg L(SSE_pre)
|
||||
-
|
||||
-L(8byte_move_try):
|
||||
- cmpq __STOS_LOWER_BOUNDARY,%r8
|
||||
- jae L(8byte_stos_try)
|
||||
-
|
||||
- .balign 16
|
||||
-L(8byte_move):
|
||||
- movq %r8,%rcx
|
||||
- shrq $7,%rcx
|
||||
- jz L(8byte_move_skip)
|
||||
-
|
||||
- .p2align 4
|
||||
-
|
||||
-L(8byte_move_loop):
|
||||
- decq %rcx
|
||||
-
|
||||
- movq %rdx, (%rdi)
|
||||
- movq %rdx, 8 (%rdi)
|
||||
- movq %rdx, 16 (%rdi)
|
||||
- movq %rdx, 24 (%rdi)
|
||||
- movq %rdx, 32 (%rdi)
|
||||
- movq %rdx, 40 (%rdi)
|
||||
- movq %rdx, 48 (%rdi)
|
||||
- movq %rdx, 56 (%rdi)
|
||||
- movq %rdx, 64 (%rdi)
|
||||
- movq %rdx, 72 (%rdi)
|
||||
- movq %rdx, 80 (%rdi)
|
||||
- movq %rdx, 88 (%rdi)
|
||||
- movq %rdx, 96 (%rdi)
|
||||
- movq %rdx, 104 (%rdi)
|
||||
- movq %rdx, 112 (%rdi)
|
||||
- movq %rdx, 120 (%rdi)
|
||||
-
|
||||
- leaq 128 (%rdi),%rdi
|
||||
-
|
||||
- jnz L(8byte_move_loop)
|
||||
-
|
||||
-L(8byte_move_skip):
|
||||
- andl $127,%r8d
|
||||
- lea (%rdi,%r8,1),%rdi
|
||||
-
|
||||
-#ifndef PIC
|
||||
- lea L(setPxQx)(%rip),%r11
|
||||
- jmpq *(%r11,%r8,8) # old scheme remained for nonPIC
|
||||
-#else
|
||||
- lea L(Got0)(%rip),%r11
|
||||
- lea L(setPxQx)(%rip),%rcx
|
||||
- movswq (%rcx,%r8,2),%rcx
|
||||
- lea (%rcx,%r11,1),%r11
|
||||
- jmpq *%r11
|
||||
-#endif
|
||||
-
|
||||
- .balign 16
|
||||
-L(8byte_stos_try):
|
||||
- mov __x86_64_shared_cache_size(%rip),%r9d // ck largest cache size
|
||||
- cmpq %r8,%r9 // calculate the lesser of remaining
|
||||
- cmovaq %r8,%r9 // bytes and largest cache size
|
||||
- jbe L(8byte_stos)
|
||||
-
|
||||
-L(8byte_move_reuse_try):
|
||||
- cmp __STOS_UPPER_BOUNDARY,%r8
|
||||
- jae L(8byte_move)
|
||||
-
|
||||
- .balign 16
|
||||
-L(8byte_stos):
|
||||
- movq %r9,%rcx
|
||||
- andq $-8,%r9
|
||||
-
|
||||
- shrq $3,%rcx
|
||||
- jz L(8byte_stos_skip)
|
||||
-
|
||||
- xchgq %rax,%rdx
|
||||
-
|
||||
- rep
|
||||
- stosq
|
||||
-
|
||||
- xchgq %rax,%rdx
|
||||
-
|
||||
-L(8byte_stos_skip):
|
||||
- subq %r9,%r8
|
||||
- ja L(8byte_nt_move)
|
||||
-
|
||||
- andl $7,%r8d
|
||||
- lea (%rdi,%r8,1),%rdi
|
||||
-#ifndef PIC
|
||||
- lea L(setPxQx)(%rip),%r11
|
||||
- jmpq *(%r11,%r8,8) # old scheme remained for nonPIC
|
||||
-#else
|
||||
- lea L(Got0)(%rip),%r11
|
||||
- lea L(setPxQx)(%rip),%rcx
|
||||
- movswq (%rcx,%r8,2),%rcx
|
||||
- lea (%rcx,%r11,1),%r11
|
||||
- jmpq *%r11
|
||||
-#endif
|
||||
|
||||
- .balign 16
|
||||
-L(8byte_nt_move):
|
||||
- movq %r8,%rcx
|
||||
- shrq $7,%rcx
|
||||
- jz L(8byte_nt_move_skip)
|
||||
-
|
||||
- .balign 16
|
||||
-L(8byte_nt_move_loop):
|
||||
- decq %rcx
|
||||
-
|
||||
- movntiq %rdx, (%rdi)
|
||||
- movntiq %rdx, 8 (%rdi)
|
||||
- movntiq %rdx, 16 (%rdi)
|
||||
- movntiq %rdx, 24 (%rdi)
|
||||
- movntiq %rdx, 32 (%rdi)
|
||||
- movntiq %rdx, 40 (%rdi)
|
||||
- movntiq %rdx, 48 (%rdi)
|
||||
- movntiq %rdx, 56 (%rdi)
|
||||
- movntiq %rdx, 64 (%rdi)
|
||||
- movntiq %rdx, 72 (%rdi)
|
||||
- movntiq %rdx, 80 (%rdi)
|
||||
- movntiq %rdx, 88 (%rdi)
|
||||
- movntiq %rdx, 96 (%rdi)
|
||||
- movntiq %rdx, 104 (%rdi)
|
||||
- movntiq %rdx, 112 (%rdi)
|
||||
- movntiq %rdx, 120 (%rdi)
|
||||
-
|
||||
- leaq 128 (%rdi),%rdi
|
||||
-
|
||||
- jnz L(8byte_nt_move_loop)
|
||||
-
|
||||
- sfence
|
||||
-
|
||||
-L(8byte_nt_move_skip):
|
||||
- andl $127,%r8d
|
||||
+#ifndef USE_MULTIARCH
|
||||
+ jmp L(aligned_now)
|
||||
|
||||
- lea (%rdi,%r8,1),%rdi
|
||||
-#ifndef PIC
|
||||
- lea L(setPxQx)(%rip),%r11
|
||||
- jmpq *(%r11,%r8,8) # old scheme remained for nonPIC
|
||||
+L(SSE_pre):
|
||||
#else
|
||||
- lea L(Got0)(%rip),%r11
|
||||
- lea L(setPxQx)(%rip),%rcx
|
||||
- movswq (%rcx,%r8,2),%rcx
|
||||
- lea (%rcx,%r11,1),%r11
|
||||
- jmpq *%r11
|
||||
+L(aligned_now):
|
||||
#endif
|
||||
-
|
||||
-L(SSE_pre):
|
||||
+#if !defined USE_MULTIARCH || defined USE_SSE2
|
||||
# fill RegXMM0 with the pattern
|
||||
movd %rdx,%xmm0
|
||||
punpcklqdq %xmm0,%xmm0
|
||||
@@ -1342,11 +1200,162 @@ L(SSExDx):
|
||||
.short L(SSE15QB)-L(SSE0Q0)
|
||||
#endif
|
||||
.popsection
|
||||
+#endif /* !defined USE_MULTIARCH || defined USE_SSE2 */
|
||||
+
|
||||
+ .balign 16
|
||||
+#ifndef USE_MULTIARCH
|
||||
+L(aligned_now):
|
||||
+
|
||||
+ cmpl $0x1,__x86_64_preferred_memory_instruction(%rip)
|
||||
+ jg L(SSE_pre)
|
||||
+#endif /* USE_MULTIARCH */
|
||||
+
|
||||
+L(8byte_move_try):
|
||||
+ cmpq __STOS_LOWER_BOUNDARY,%r8
|
||||
+ jae L(8byte_stos_try)
|
||||
+
|
||||
+ .balign 16
|
||||
+L(8byte_move):
|
||||
+ movq %r8,%rcx
|
||||
+ shrq $7,%rcx
|
||||
+ jz L(8byte_move_skip)
|
||||
+
|
||||
+ .p2align 4
|
||||
+
|
||||
+L(8byte_move_loop):
|
||||
+ decq %rcx
|
||||
+
|
||||
+ movq %rdx, (%rdi)
|
||||
+ movq %rdx, 8 (%rdi)
|
||||
+ movq %rdx, 16 (%rdi)
|
||||
+ movq %rdx, 24 (%rdi)
|
||||
+ movq %rdx, 32 (%rdi)
|
||||
+ movq %rdx, 40 (%rdi)
|
||||
+ movq %rdx, 48 (%rdi)
|
||||
+ movq %rdx, 56 (%rdi)
|
||||
+ movq %rdx, 64 (%rdi)
|
||||
+ movq %rdx, 72 (%rdi)
|
||||
+ movq %rdx, 80 (%rdi)
|
||||
+ movq %rdx, 88 (%rdi)
|
||||
+ movq %rdx, 96 (%rdi)
|
||||
+ movq %rdx, 104 (%rdi)
|
||||
+ movq %rdx, 112 (%rdi)
|
||||
+ movq %rdx, 120 (%rdi)
|
||||
+
|
||||
+ leaq 128 (%rdi),%rdi
|
||||
+
|
||||
+ jnz L(8byte_move_loop)
|
||||
+
|
||||
+L(8byte_move_skip):
|
||||
+ andl $127,%r8d
|
||||
+ lea (%rdi,%r8,1),%rdi
|
||||
+
|
||||
+#ifndef PIC
|
||||
+ lea L(setPxQx)(%rip),%r11
|
||||
+ jmpq *(%r11,%r8,8) # old scheme remained for nonPIC
|
||||
+#else
|
||||
+ lea L(Got0)(%rip),%r11
|
||||
+ lea L(setPxQx)(%rip),%rcx
|
||||
+ movswq (%rcx,%r8,2),%rcx
|
||||
+ lea (%rcx,%r11,1),%r11
|
||||
+ jmpq *%r11
|
||||
+#endif
|
||||
+
|
||||
+ .balign 16
|
||||
+L(8byte_stos_try):
|
||||
+ mov __x86_64_shared_cache_size(%rip),%r9d // ck largest cache size
|
||||
+ cmpq %r8,%r9 // calculate the lesser of remaining
|
||||
+ cmovaq %r8,%r9 // bytes and largest cache size
|
||||
+ jbe L(8byte_stos)
|
||||
+
|
||||
+L(8byte_move_reuse_try):
|
||||
+ cmp __STOS_UPPER_BOUNDARY,%r8
|
||||
+ jae L(8byte_move)
|
||||
+
|
||||
+ .balign 16
|
||||
+L(8byte_stos):
|
||||
+ movq %r9,%rcx
|
||||
+ andq $-8,%r9
|
||||
+
|
||||
+ shrq $3,%rcx
|
||||
+ jz L(8byte_stos_skip)
|
||||
+
|
||||
+ xchgq %rax,%rdx
|
||||
+
|
||||
+ rep
|
||||
+ stosq
|
||||
+
|
||||
+ xchgq %rax,%rdx
|
||||
+
|
||||
+L(8byte_stos_skip):
|
||||
+ subq %r9,%r8
|
||||
+ ja L(8byte_nt_move)
|
||||
+
|
||||
+ andl $7,%r8d
|
||||
+ lea (%rdi,%r8,1),%rdi
|
||||
+#ifndef PIC
|
||||
+ lea L(setPxQx)(%rip),%r11
|
||||
+ jmpq *(%r11,%r8,8) # old scheme remained for nonPIC
|
||||
+#else
|
||||
+ lea L(Got0)(%rip),%r11
|
||||
+ lea L(setPxQx)(%rip),%rcx
|
||||
+ movswq (%rcx,%r8,2),%rcx
|
||||
+ lea (%rcx,%r11,1),%r11
|
||||
+ jmpq *%r11
|
||||
+#endif
|
||||
+
|
||||
+ .balign 16
|
||||
+L(8byte_nt_move):
|
||||
+ movq %r8,%rcx
|
||||
+ shrq $7,%rcx
|
||||
+ jz L(8byte_nt_move_skip)
|
||||
+
|
||||
+ .balign 16
|
||||
+L(8byte_nt_move_loop):
|
||||
+ decq %rcx
|
||||
+
|
||||
+ movntiq %rdx, (%rdi)
|
||||
+ movntiq %rdx, 8 (%rdi)
|
||||
+ movntiq %rdx, 16 (%rdi)
|
||||
+ movntiq %rdx, 24 (%rdi)
|
||||
+ movntiq %rdx, 32 (%rdi)
|
||||
+ movntiq %rdx, 40 (%rdi)
|
||||
+ movntiq %rdx, 48 (%rdi)
|
||||
+ movntiq %rdx, 56 (%rdi)
|
||||
+ movntiq %rdx, 64 (%rdi)
|
||||
+ movntiq %rdx, 72 (%rdi)
|
||||
+ movntiq %rdx, 80 (%rdi)
|
||||
+ movntiq %rdx, 88 (%rdi)
|
||||
+ movntiq %rdx, 96 (%rdi)
|
||||
+ movntiq %rdx, 104 (%rdi)
|
||||
+ movntiq %rdx, 112 (%rdi)
|
||||
+ movntiq %rdx, 120 (%rdi)
|
||||
+
|
||||
+ leaq 128 (%rdi),%rdi
|
||||
+
|
||||
+ jnz L(8byte_nt_move_loop)
|
||||
+
|
||||
+ sfence
|
||||
+
|
||||
+L(8byte_nt_move_skip):
|
||||
+ andl $127,%r8d
|
||||
+
|
||||
+ lea (%rdi,%r8,1),%rdi
|
||||
+#ifndef PIC
|
||||
+ lea L(setPxQx)(%rip),%r11
|
||||
+ jmpq *(%r11,%r8,8) # old scheme remained for nonPIC
|
||||
+#else
|
||||
+ lea L(Got0)(%rip),%r11
|
||||
+ lea L(setPxQx)(%rip),%rcx
|
||||
+ movswq (%rcx,%r8,2),%rcx
|
||||
+ lea (%rcx,%r11,1),%r11
|
||||
+ jmpq *%r11
|
||||
+#endif
|
||||
|
||||
END (memset)
|
||||
libc_hidden_builtin_def (memset)
|
||||
|
||||
-#if defined PIC && !defined NOT_IN_libc
|
||||
+#if defined PIC && !defined NOT_IN_libc && !defined USE_MULTIARCH
|
||||
strong_alias (__memset_chk, __memset_zero_constant_len_parameter)
|
||||
.section .gnu.warning.__memset_zero_constant_len_parameter
|
||||
.string "memset used with constant zero length parameter; this could be due to transposed parameters"
|
||||
Index: glibc-2.12-2-gc4ccff1/sysdeps/x86_64/multiarch/Makefile
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/sysdeps/x86_64/multiarch/Makefile
|
||||
+++ glibc-2.12-2-gc4ccff1/sysdeps/x86_64/multiarch/Makefile
|
||||
@@ -7,7 +7,8 @@ ifeq ($(subdir),string)
|
||||
sysdep_routines += stpncpy-c strncpy-c strcmp-ssse3 strncmp-ssse3 \
|
||||
strend-sse4 memcmp-sse4 \
|
||||
strcasestr-nonascii strcasecmp_l-ssse3 \
|
||||
- strncase_l-ssse3
|
||||
+ strncase_l-ssse3 \
|
||||
+ memset-x86-64
|
||||
ifeq (yes,$(config-cflags-sse4))
|
||||
sysdep_routines += strcspn-c strpbrk-c strspn-c strstr-c strcasestr-c
|
||||
CFLAGS-strcspn-c.c += -msse4
|
||||
Index: glibc-2.12-2-gc4ccff1/sysdeps/x86_64/multiarch/bzero.S
|
||||
===================================================================
|
||||
--- /dev/null
|
||||
+++ glibc-2.12-2-gc4ccff1/sysdeps/x86_64/multiarch/bzero.S
|
||||
@@ -0,0 +1,56 @@
|
||||
+/* Multiple versions of bzero
|
||||
+ Copyright (C) 2010 Free Software Foundation, Inc.
|
||||
+ This file is part of the GNU C Library.
|
||||
+
|
||||
+ The GNU C Library is free software; you can redistribute it and/or
|
||||
+ modify it under the terms of the GNU Lesser General Public
|
||||
+ License as published by the Free Software Foundation; either
|
||||
+ version 2.1 of the License, or (at your option) any later version.
|
||||
+
|
||||
+ The GNU C Library is distributed in the hope that it will be useful,
|
||||
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
+ Lesser General Public License for more details.
|
||||
+
|
||||
+ You should have received a copy of the GNU Lesser General Public
|
||||
+ License along with the GNU C Library; if not, write to the Free
|
||||
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
+ 02111-1307 USA. */
|
||||
+
|
||||
+#include <sysdep.h>
|
||||
+#include <init-arch.h>
|
||||
+
|
||||
+ .text
|
||||
+ENTRY(__bzero)
|
||||
+ .type __bzero, @gnu_indirect_function
|
||||
+ cmpl $0, __cpu_features+KIND_OFFSET(%rip)
|
||||
+ jne 1f
|
||||
+ call __init_cpu_features
|
||||
+1: leaq __bzero_x86_64(%rip), %rax
|
||||
+ testl $bit_Prefer_SSE_for_memop, __cpu_features+FEATURE_OFFSET+index_Prefer_SSE_for_memop(%rip)
|
||||
+ jz 2f
|
||||
+ leaq __bzero_sse2(%rip), %rax
|
||||
+2: ret
|
||||
+END(__bzero)
|
||||
+
|
||||
+ .type __bzero_sse2, @function
|
||||
+__bzero_sse2:
|
||||
+ cfi_startproc
|
||||
+ CALL_MCOUNT
|
||||
+ mov %rsi,%rdx /* Adjust parameter. */
|
||||
+ xorl %esi,%esi /* Fill with 0s. */
|
||||
+ jmp __memset_sse2
|
||||
+ cfi_endproc
|
||||
+ .size __bzero_sse2, .-__bzero_sse2
|
||||
+
|
||||
+ .type __bzero_x86_64, @function
|
||||
+__bzero_x86_64:
|
||||
+ cfi_startproc
|
||||
+ CALL_MCOUNT
|
||||
+ mov %rsi,%rdx /* Adjust parameter. */
|
||||
+ xorl %esi,%esi /* Fill with 0s. */
|
||||
+ jmp __memset_x86_64
|
||||
+ cfi_endproc
|
||||
+ .size __bzero_x86_64, .-__bzero_x86_64
|
||||
+
|
||||
+weak_alias (__bzero, bzero)
|
||||
Index: glibc-2.12-2-gc4ccff1/sysdeps/x86_64/multiarch/cacheinfo.c
|
||||
===================================================================
|
||||
--- /dev/null
|
||||
+++ glibc-2.12-2-gc4ccff1/sysdeps/x86_64/multiarch/cacheinfo.c
|
||||
@@ -0,0 +1,2 @@
|
||||
+#define DISABLE_PREFERRED_MEMORY_INSTRUCTION
|
||||
+#include "../cacheinfo.c"
|
||||
Index: glibc-2.12-2-gc4ccff1/sysdeps/x86_64/multiarch/init-arch.c
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/sysdeps/x86_64/multiarch/init-arch.c
|
||||
+++ glibc-2.12-2-gc4ccff1/sysdeps/x86_64/multiarch/init-arch.c
|
||||
@@ -59,6 +59,11 @@ __init_cpu_features (void)
|
||||
|
||||
get_common_indeces (&family, &model);
|
||||
|
||||
+ /* Intel processors prefer SSE instruction for memory/string
|
||||
+ routines if they are avaiable. */
|
||||
+ __cpu_features.feature[index_Prefer_SSE_for_memop]
|
||||
+ |= bit_Prefer_SSE_for_memop;
|
||||
+
|
||||
unsigned int eax = __cpu_features.cpuid[COMMON_CPUID_INDEX_1].eax;
|
||||
unsigned int extended_family = (eax >> 20) & 0xff;
|
||||
unsigned int extended_model = (eax >> 12) & 0xf0;
|
||||
@@ -92,6 +97,14 @@ __init_cpu_features (void)
|
||||
kind = arch_kind_amd;
|
||||
|
||||
get_common_indeces (&family, &model);
|
||||
+
|
||||
+ unsigned int ecx = __cpu_features.cpuid[COMMON_CPUID_INDEX_1].ecx;
|
||||
+
|
||||
+ /* AMD processors prefer SSE instructions for memory/string routines
|
||||
+ if they are available, otherwise they prefer integer instructions. */
|
||||
+ if ((ecx & 0x200))
|
||||
+ __cpu_features.feature[index_Prefer_SSE_for_memop]
|
||||
+ |= bit_Prefer_SSE_for_memop;
|
||||
}
|
||||
else
|
||||
kind = arch_kind_other;
|
||||
Index: glibc-2.12-2-gc4ccff1/sysdeps/x86_64/multiarch/init-arch.h
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/sysdeps/x86_64/multiarch/init-arch.h
|
||||
+++ glibc-2.12-2-gc4ccff1/sysdeps/x86_64/multiarch/init-arch.h
|
||||
@@ -16,7 +16,8 @@
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA. */
|
||||
|
||||
-#define bit_Fast_Rep_String (1 << 0)
|
||||
+#define bit_Fast_Rep_String (1 << 0)
|
||||
+#define bit_Prefer_SSE_for_memop (1 << 3)
|
||||
|
||||
#ifdef __ASSEMBLER__
|
||||
|
||||
@@ -33,6 +34,7 @@
|
||||
# define index_SSE4_2 COMMON_CPUID_INDEX_1*CPUID_SIZE+CPUID_ECX_OFFSET
|
||||
|
||||
#define index_Fast_Rep_String FEATURE_INDEX_1*FEATURE_SIZE
|
||||
+# define index_Prefer_SSE_for_memop FEATURE_INDEX_1*FEATURE_SIZE
|
||||
|
||||
#else /* __ASSEMBLER__ */
|
||||
|
||||
@@ -103,5 +105,12 @@ extern const struct cpu_features *__get_
|
||||
# define HAS_FMA HAS_CPU_FEATURE (COMMON_CPUID_INDEX_1, ecx, 12)
|
||||
|
||||
# define index_Fast_Rep_String FEATURE_INDEX_1
|
||||
+# define index_Prefer_SSE_for_memop FEATURE_INDEX_1
|
||||
+
|
||||
+#define HAS_ARCH_FEATURE(idx, bit) \
|
||||
+ ((__get_cpu_features ()->feature[idx] & (bit)) != 0)
|
||||
+
|
||||
+#define HAS_PREFER_SSE_FOR_MEMOP \
|
||||
+ HAS_ARCH_FEATURE (index_Prefer_SSE_for_memop, bit_Prefer_SSE_for_memop)
|
||||
|
||||
#endif /* __ASSEMBLER__ */
|
||||
Index: glibc-2.12-2-gc4ccff1/sysdeps/x86_64/multiarch/memset-x86-64.S
|
||||
===================================================================
|
||||
--- /dev/null
|
||||
+++ glibc-2.12-2-gc4ccff1/sysdeps/x86_64/multiarch/memset-x86-64.S
|
||||
@@ -0,0 +1,18 @@
|
||||
+#include <sysdep.h>
|
||||
+
|
||||
+#ifndef NOT_IN_libc
|
||||
+# undef ENTRY_CHK
|
||||
+# define ENTRY_CHK(name) \
|
||||
+ .type __memset_chk_x86_64, @function; \
|
||||
+ .globl __memset_chk_x86_64; \
|
||||
+ .p2align 4; \
|
||||
+ __memset_chk_x86_64: cfi_startproc; \
|
||||
+ CALL_MCOUNT
|
||||
+# undef END_CHK
|
||||
+# define END_CHK(name) \
|
||||
+ cfi_endproc; .size __memset_chk_x86_64, .-__memset_chk_x86_64
|
||||
+
|
||||
+# define libc_hidden_builtin_def(name)
|
||||
+# define memset __memset_x86_64
|
||||
+# include "../memset.S"
|
||||
+#endif
|
||||
Index: glibc-2.12-2-gc4ccff1/sysdeps/x86_64/multiarch/memset.S
|
||||
===================================================================
|
||||
--- /dev/null
|
||||
+++ glibc-2.12-2-gc4ccff1/sysdeps/x86_64/multiarch/memset.S
|
||||
@@ -0,0 +1,74 @@
|
||||
+/* Multiple versions of memset
|
||||
+ Copyright (C) 2010 Free Software Foundation, Inc.
|
||||
+ This file is part of the GNU C Library.
|
||||
+
|
||||
+ The GNU C Library is free software; you can redistribute it and/or
|
||||
+ modify it under the terms of the GNU Lesser General Public
|
||||
+ License as published by the Free Software Foundation; either
|
||||
+ version 2.1 of the License, or (at your option) any later version.
|
||||
+
|
||||
+ The GNU C Library is distributed in the hope that it will be useful,
|
||||
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
+ Lesser General Public License for more details.
|
||||
+
|
||||
+ You should have received a copy of the GNU Lesser General Public
|
||||
+ License along with the GNU C Library; if not, write to the Free
|
||||
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
+ 02111-1307 USA. */
|
||||
+
|
||||
+#include <sysdep.h>
|
||||
+#include <init-arch.h>
|
||||
+
|
||||
+/* Define multiple versions only for the definition in lib. */
|
||||
+#ifndef NOT_IN_libc
|
||||
+ENTRY(memset)
|
||||
+ .type memset, @gnu_indirect_function
|
||||
+ cmpl $0, __cpu_features+KIND_OFFSET(%rip)
|
||||
+ jne 1f
|
||||
+ call __init_cpu_features
|
||||
+1: leaq __memset_x86_64(%rip), %rax
|
||||
+ testl $bit_Prefer_SSE_for_memop, __cpu_features+FEATURE_OFFSET+index_Prefer_SSE_for_memop(%rip)
|
||||
+ jz 2f
|
||||
+ leaq __memset_sse2(%rip), %rax
|
||||
+2: ret
|
||||
+END(memset)
|
||||
+
|
||||
+# define USE_SSE2 1
|
||||
+
|
||||
+# undef ENTRY
|
||||
+# define ENTRY(name) \
|
||||
+ .type __memset_sse2, @function; \
|
||||
+ .globl __memset_sse2; \
|
||||
+ .p2align 4; \
|
||||
+ __memset_sse2: cfi_startproc; \
|
||||
+ CALL_MCOUNT
|
||||
+# undef END
|
||||
+# define END(name) \
|
||||
+ cfi_endproc; .size __memset_sse2, .-__memset_sse2
|
||||
+
|
||||
+# undef ENTRY_CHK
|
||||
+# define ENTRY_CHK(name) \
|
||||
+ .type __memset_chk_sse2, @function; \
|
||||
+ .globl __memset_chk_sse2; \
|
||||
+ .p2align 4; \
|
||||
+ __memset_chk_sse2: cfi_startproc; \
|
||||
+ CALL_MCOUNT
|
||||
+# undef END_CHK
|
||||
+# define END_CHK(name) \
|
||||
+ cfi_endproc; .size __memset_chk_sse2, .-__memset_chk_sse2
|
||||
+
|
||||
+# ifdef SHARED
|
||||
+# undef libc_hidden_builtin_def
|
||||
+/* It doesn't make sense to send libc-internal memset calls through a PLT.
|
||||
+ The speedup we get from using GPR instruction is likely eaten away
|
||||
+ by the indirect call in the PLT. */
|
||||
+# define libc_hidden_builtin_def(name) \
|
||||
+ .globl __GI_memset; __GI_memset = __memset_sse2
|
||||
+# endif
|
||||
+
|
||||
+# undef strong_alias
|
||||
+# define strong_alias(original, alias)
|
||||
+#endif
|
||||
+
|
||||
+#include "../memset.S"
|
||||
Index: glibc-2.12-2-gc4ccff1/sysdeps/x86_64/multiarch/memset_chk.S
|
||||
===================================================================
|
||||
--- /dev/null
|
||||
+++ glibc-2.12-2-gc4ccff1/sysdeps/x86_64/multiarch/memset_chk.S
|
||||
@@ -0,0 +1,44 @@
|
||||
+/* Multiple versions of __memset_chk
|
||||
+ Copyright (C) 2010 Free Software Foundation, Inc.
|
||||
+ This file is part of the GNU C Library.
|
||||
+
|
||||
+ The GNU C Library is free software; you can redistribute it and/or
|
||||
+ modify it under the terms of the GNU Lesser General Public
|
||||
+ License as published by the Free Software Foundation; either
|
||||
+ version 2.1 of the License, or (at your option) any later version.
|
||||
+
|
||||
+ The GNU C Library is distributed in the hope that it will be useful,
|
||||
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
+ Lesser General Public License for more details.
|
||||
+
|
||||
+ You should have received a copy of the GNU Lesser General Public
|
||||
+ License along with the GNU C Library; if not, write to the Free
|
||||
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
+ 02111-1307 USA. */
|
||||
+
|
||||
+#include <sysdep.h>
|
||||
+#include <init-arch.h>
|
||||
+
|
||||
+/* Define multiple versions only for the definition in lib. */
|
||||
+#ifndef NOT_IN_libc
|
||||
+# ifdef SHARED
|
||||
+ENTRY(__memset_chk)
|
||||
+ .type __memset_chk, @gnu_indirect_function
|
||||
+ cmpl $0, __cpu_features+KIND_OFFSET(%rip)
|
||||
+ jne 1f
|
||||
+ call __init_cpu_features
|
||||
+1: leaq __memset_chk_x86_64(%rip), %rax
|
||||
+ testl $bit_Prefer_SSE_for_memop, __cpu_features+FEATURE_OFFSET+index_Prefer_SSE_for_memop(%rip)
|
||||
+ jz 2f
|
||||
+ leaq __memset_chk_sse2(%rip), %rax
|
||||
+2: ret
|
||||
+END(__memset_chk)
|
||||
+
|
||||
+strong_alias (__memset_chk, __memset_zero_constant_len_parameter)
|
||||
+ .section .gnu.warning.__memset_zero_constant_len_parameter
|
||||
+ .string "memset used with constant zero length parameter; this could be due to transposed parameters"
|
||||
+# else
|
||||
+# include "../memset_chk.S"
|
||||
+# endif
|
||||
+#endif
|
||||
352
src/patches/glibc/glibc-rh676591.patch
Normal file
352
src/patches/glibc/glibc-rh676591.patch
Normal file
@@ -0,0 +1,352 @@
|
||||
2011-05-15 Ulrich Drepper <drepper@gmail.com>
|
||||
|
||||
[BZ #11901]
|
||||
* include/stdlib.h: Move include protection to the right place.
|
||||
Define abort_msg_s. Declare __abort_msg with it.
|
||||
* stdlib/abort.c (__abort_msg): Adjust type.
|
||||
* assert/assert.c (__assert_fail_base): New function. Majority
|
||||
of code from __assert_fail. Allocate memory for __abort_msg with
|
||||
mmap.
|
||||
(__assert_fail): Now call __assert_fail_base.
|
||||
* assert/assert-perr.c: Remove bulk of implementation. Use
|
||||
__assert_fail_base.
|
||||
* include/assert.hL Declare __assert_fail_base.
|
||||
* sysdeps/posix/libc_fatal.c: Allocate memory for __abort_msg with
|
||||
mmap.
|
||||
* sysdeps/unix/sysv/linux/libc_fatal.c: Likewise.
|
||||
|
||||
Index: glibc-2.12-2-gc4ccff1/assert/assert-perr.c
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/assert/assert-perr.c
|
||||
+++ glibc-2.12-2-gc4ccff1/assert/assert-perr.c
|
||||
@@ -17,66 +17,23 @@
|
||||
02111-1307 USA. */
|
||||
|
||||
#include <assert.h>
|
||||
-#include <atomic.h>
|
||||
#include <libintl.h>
|
||||
-#include <stdio.h>
|
||||
-#include <stdlib.h>
|
||||
#include <string.h>
|
||||
-#include <sysdep.h>
|
||||
-#include <unistd.h>
|
||||
|
||||
|
||||
-extern const char *__progname;
|
||||
-
|
||||
-#ifdef USE_IN_LIBIO
|
||||
-# include <wchar.h>
|
||||
-# include <libio/iolibio.h>
|
||||
-# define fflush(s) INTUSE(_IO_fflush) (s)
|
||||
-#endif
|
||||
-
|
||||
/* This function, when passed an error number, a filename, and a line
|
||||
number, prints a message on the standard error stream of the form:
|
||||
- a.c:10: foobar: Unexpected error: Computer bought the farm
|
||||
+ a.c:10: foobar: Unexpected error: Computer bought the farm
|
||||
It then aborts program execution via a call to `abort'. */
|
||||
-
|
||||
-#ifdef FATAL_PREPARE_INCLUDE
|
||||
-# include FATAL_PREPARE_INCLUDE
|
||||
-#endif
|
||||
-
|
||||
void
|
||||
__assert_perror_fail (int errnum,
|
||||
const char *file, unsigned int line,
|
||||
const char *function)
|
||||
{
|
||||
char errbuf[1024];
|
||||
- char *buf;
|
||||
-
|
||||
-#ifdef FATAL_PREPARE
|
||||
- FATAL_PREPARE;
|
||||
-#endif
|
||||
-
|
||||
- if (__asprintf (&buf, _("%s%s%s:%u: %s%sUnexpected error: %s.\n"),
|
||||
- __progname, __progname[0] ? ": " : "",
|
||||
- file, line,
|
||||
- function ? function : "", function ? ": " : "",
|
||||
- __strerror_r (errnum, errbuf, sizeof errbuf)) >= 0)
|
||||
- {
|
||||
- /* Print the message. */
|
||||
- (void) __fxprintf (NULL, "%s", buf);
|
||||
- (void) fflush (stderr);
|
||||
-
|
||||
- /* We have to free the old buffer since the application might
|
||||
- catch the SIGABRT signal. */
|
||||
- char *old = atomic_exchange_acq (&__abort_msg, buf);
|
||||
- free (old);
|
||||
- }
|
||||
- else
|
||||
- {
|
||||
- /* At least print a minimal message. */
|
||||
- static const char errstr[] = "Unexpected error.\n";
|
||||
- __libc_write (STDERR_FILENO, errstr, sizeof (errstr) - 1);
|
||||
- }
|
||||
|
||||
- abort ();
|
||||
+ char *e = __strerror_r (errnum, errbuf, sizeof errbuf);
|
||||
+ __assert_fail_base (_("%s%s%s:%u: %s%sUnexpected error: %s.\n"),
|
||||
+ e, file, line, function);
|
||||
}
|
||||
libc_hidden_def (__assert_perror_fail)
|
||||
Index: glibc-2.12-2-gc4ccff1/assert/assert.c
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/assert/assert.c
|
||||
+++ glibc-2.12-2-gc4ccff1/assert/assert.c
|
||||
@@ -19,11 +19,13 @@
|
||||
|
||||
#include <assert.h>
|
||||
#include <atomic.h>
|
||||
+#include <ldsodefs.h>
|
||||
#include <libintl.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <sysdep.h>
|
||||
#include <unistd.h>
|
||||
+#include <sys/mman.h>
|
||||
|
||||
|
||||
extern const char *__progname;
|
||||
@@ -45,31 +47,44 @@ extern const char *__progname;
|
||||
#endif
|
||||
|
||||
|
||||
-#undef __assert_fail
|
||||
void
|
||||
-__assert_fail (const char *assertion, const char *file, unsigned int line,
|
||||
- const char *function)
|
||||
+__assert_fail_base (const char *fmt, const char *assertion, const char *file,
|
||||
+ unsigned int line, const char *function)
|
||||
{
|
||||
- char *buf;
|
||||
+ char *str;
|
||||
|
||||
#ifdef FATAL_PREPARE
|
||||
FATAL_PREPARE;
|
||||
#endif
|
||||
|
||||
- if (__asprintf (&buf, _("%s%s%s:%u: %s%sAssertion `%s' failed.\n"),
|
||||
+ int total;
|
||||
+ if (__asprintf (&str, fmt,
|
||||
__progname, __progname[0] ? ": " : "",
|
||||
file, line,
|
||||
function ? function : "", function ? ": " : "",
|
||||
- assertion) >= 0)
|
||||
+ assertion, &total) >= 0)
|
||||
{
|
||||
/* Print the message. */
|
||||
- (void) __fxprintf (NULL, "%s", buf);
|
||||
+ (void) __fxprintf (NULL, "%s", str);
|
||||
(void) fflush (stderr);
|
||||
|
||||
- /* We have to free the old buffer since the application might
|
||||
- catch the SIGABRT signal. */
|
||||
- char *old = atomic_exchange_acq (&__abort_msg, buf);
|
||||
- free (old);
|
||||
+ total = (total + 1 + GLRO(dl_pagesize) - 1) & ~(GLRO(dl_pagesize) - 1);
|
||||
+ struct abort_msg_s *buf = __mmap (NULL, total, PROT_READ | PROT_WRITE,
|
||||
+ MAP_ANON | MAP_PRIVATE, -1, 0);
|
||||
+ if (__builtin_expect (buf != MAP_FAILED, 1))
|
||||
+ {
|
||||
+ buf->size = total;
|
||||
+ strcpy (buf->msg, str);
|
||||
+
|
||||
+ /* We have to free the old buffer since the application might
|
||||
+ catch the SIGABRT signal. */
|
||||
+ struct abort_msg_s *old = atomic_exchange_acq (&__abort_msg, buf);
|
||||
+
|
||||
+ if (old != NULL)
|
||||
+ __munmap (old, old->size);
|
||||
+ }
|
||||
+
|
||||
+ free (str);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -80,4 +95,14 @@ __assert_fail (const char *assertion, co
|
||||
|
||||
abort ();
|
||||
}
|
||||
+
|
||||
+
|
||||
+#undef __assert_fail
|
||||
+void
|
||||
+__assert_fail (const char *assertion, const char *file, unsigned int line,
|
||||
+ const char *function)
|
||||
+{
|
||||
+ __assert_fail_base (_("%s%s%s:%u: %s%sAssertion `%s' failed.\n%n"),
|
||||
+ assertion, file, line, function);
|
||||
+}
|
||||
hidden_def(__assert_fail)
|
||||
Index: glibc-2.12-2-gc4ccff1/include/assert.h
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/include/assert.h
|
||||
+++ glibc-2.12-2-gc4ccff1/include/assert.h
|
||||
@@ -13,6 +13,12 @@ extern void __assert_perror_fail (int __
|
||||
__const char *__function)
|
||||
__THROW __attribute__ ((__noreturn__));
|
||||
|
||||
+/* The real implementation of the two functions above. */
|
||||
+extern void __assert_fail_base (const char *fmt, const char *assertion,
|
||||
+ const char *file, unsigned int line,
|
||||
+ const char *function)
|
||||
+ __THROW __attribute__ ((__noreturn__));
|
||||
+
|
||||
#if !defined NOT_IN_libc || defined IS_IN_rtld
|
||||
hidden_proto (__assert_fail)
|
||||
hidden_proto (__assert_perror_fail)
|
||||
Index: glibc-2.12-2-gc4ccff1/include/stdlib.h
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/include/stdlib.h
|
||||
+++ glibc-2.12-2-gc4ccff1/include/stdlib.h
|
||||
@@ -223,16 +223,21 @@ extern int __qfcvt_r (long double __valu
|
||||
# define __cxa_atexit(func, arg, d) INTUSE(__cxa_atexit) (func, arg, d)
|
||||
# endif
|
||||
|
||||
-#endif
|
||||
-
|
||||
extern void *__default_morecore (ptrdiff_t) __THROW;
|
||||
libc_hidden_proto (__default_morecore)
|
||||
|
||||
-extern char *__abort_msg;
|
||||
+struct abort_msg_s
|
||||
+{
|
||||
+ unsigned int size;
|
||||
+ char msg[0];
|
||||
+};
|
||||
+extern struct abort_msg_s *__abort_msg;
|
||||
libc_hidden_proto (__abort_msg)
|
||||
|
||||
__END_DECLS
|
||||
|
||||
+#endif
|
||||
+
|
||||
#undef __Need_M_And_C
|
||||
|
||||
#endif /* include/stdlib.h */
|
||||
Index: glibc-2.12-2-gc4ccff1/stdlib/abort.c
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/stdlib/abort.c
|
||||
+++ glibc-2.12-2-gc4ccff1/stdlib/abort.c
|
||||
@@ -37,7 +37,7 @@
|
||||
#endif
|
||||
|
||||
/* Exported variable to locate abort message in core files etc. */
|
||||
-char *__abort_msg __attribute__ ((nocommon));
|
||||
+struct abort_msg_s *__abort_msg __attribute__ ((nocommon));
|
||||
libc_hidden_def (__abort_msg)
|
||||
|
||||
/* We must avoid to run in circles. Therefore we remember how far we
|
||||
Index: glibc-2.12-2-gc4ccff1/sysdeps/posix/libc_fatal.c
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/sysdeps/posix/libc_fatal.c
|
||||
+++ glibc-2.12-2-gc4ccff1/sysdeps/posix/libc_fatal.c
|
||||
@@ -20,6 +20,7 @@
|
||||
#include <atomic.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
+#include <ldsodefs.h>
|
||||
#include <paths.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
@@ -125,18 +126,28 @@ __libc_message (int do_abort, const char
|
||||
if (TEMP_FAILURE_RETRY (__writev (fd, iov, nlist)) == total)
|
||||
written = true;
|
||||
|
||||
- char *buf = do_abort ? malloc (total + 1) : NULL;
|
||||
- if (buf != NULL)
|
||||
+ if (do_abort)
|
||||
{
|
||||
- char *wp = buf;
|
||||
- for (int cnt = 0; cnt < nlist; ++cnt)
|
||||
- wp = mempcpy (wp, iov[cnt].iov_base, iov[cnt].iov_len);
|
||||
- *wp = '\0';
|
||||
-
|
||||
- /* We have to free the old buffer since the application might
|
||||
- catch the SIGABRT signal. */
|
||||
- char *old = atomic_exchange_acq (&__abort_msg, buf);
|
||||
- free (old);
|
||||
+ total = ((total + 1 + GLRO(dl_pagesize) - 1)
|
||||
+ & ~(GLRO(dl_pagesize) - 1));
|
||||
+ struct abort_msg_s *buf = __mmap (NULL, total,
|
||||
+ PROT_READ | PROT_WRITE,
|
||||
+ MAP_ANON | MAP_PRIVATE, -1, 0);
|
||||
+ if (buf != MAP_FAILED)
|
||||
+ {
|
||||
+ buf->size = total;
|
||||
+ char *wp = buf->msg;
|
||||
+ for (int cnt = 0; cnt < nlist; ++cnt)
|
||||
+ wp = mempcpy (wp, iov[cnt].iov_base, iov[cnt].iov_len);
|
||||
+ *wp = '\0';
|
||||
+
|
||||
+ /* We have to free the old buffer since the application might
|
||||
+ catch the SIGABRT signal. */
|
||||
+ struct abort_msg_s *old = atomic_exchange_acq (&__abort_msg,
|
||||
+ buf);
|
||||
+ if (old != NULL)
|
||||
+ __munmap (old, old->size);
|
||||
+ }
|
||||
}
|
||||
}
|
||||
|
||||
Index: glibc-2.12-2-gc4ccff1/sysdeps/unix/sysv/linux/libc_fatal.c
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/sysdeps/unix/sysv/linux/libc_fatal.c
|
||||
+++ glibc-2.12-2-gc4ccff1/sysdeps/unix/sysv/linux/libc_fatal.c
|
||||
@@ -20,6 +20,7 @@
|
||||
#include <atomic.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
+#include <ldsodefs.h>
|
||||
#include <paths.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
@@ -28,6 +29,7 @@
|
||||
#include <string.h>
|
||||
#include <sysdep.h>
|
||||
#include <unistd.h>
|
||||
+#include <sys/mman.h>
|
||||
#include <sys/syslog.h>
|
||||
#include <execinfo.h>
|
||||
|
||||
@@ -134,18 +136,28 @@ __libc_message (int do_abort, const char
|
||||
if (cnt == total)
|
||||
written = true;
|
||||
|
||||
- char *buf = do_abort ? malloc (total + 1) : NULL;
|
||||
- if (buf != NULL)
|
||||
+ if (do_abort)
|
||||
{
|
||||
- char *wp = buf;
|
||||
- for (int cnt = 0; cnt < nlist; ++cnt)
|
||||
- wp = mempcpy (wp, iov[cnt].iov_base, iov[cnt].iov_len);
|
||||
- *wp = '\0';
|
||||
-
|
||||
- /* We have to free the old buffer since the application might
|
||||
- catch the SIGABRT signal. */
|
||||
- char *old = atomic_exchange_acq (&__abort_msg, buf);
|
||||
- free (old);
|
||||
+ total = ((total + 1 + GLRO(dl_pagesize) - 1)
|
||||
+ & ~(GLRO(dl_pagesize) - 1));
|
||||
+ struct abort_msg_s *buf = __mmap (NULL, total,
|
||||
+ PROT_READ | PROT_WRITE,
|
||||
+ MAP_ANON | MAP_PRIVATE, -1, 0);
|
||||
+ if (__builtin_expect (buf != MAP_FAILED, 1))
|
||||
+ {
|
||||
+ buf->size = total;
|
||||
+ char *wp = buf->msg;
|
||||
+ for (int cnt = 0; cnt < nlist; ++cnt)
|
||||
+ wp = mempcpy (wp, iov[cnt].iov_base, iov[cnt].iov_len);
|
||||
+ *wp = '\0';
|
||||
+
|
||||
+ /* We have to free the old buffer since the application might
|
||||
+ catch the SIGABRT signal. */
|
||||
+ struct abort_msg_s *old = atomic_exchange_acq (&__abort_msg,
|
||||
+ buf);
|
||||
+ if (old != NULL)
|
||||
+ __munmap (old, old->size);
|
||||
+ }
|
||||
}
|
||||
}
|
||||
|
||||
514
src/patches/glibc/glibc-rh681054.patch
Normal file
514
src/patches/glibc/glibc-rh681054.patch
Normal file
@@ -0,0 +1,514 @@
|
||||
2011-03-18 Ulrich Drepper <drepper@gmail.com>
|
||||
|
||||
* posix/fnmatch.c (fnmatch): Check size of pattern in wide
|
||||
character representation.
|
||||
Partly based on a patch by Tomas Hoger <thoger@redhat.com>.
|
||||
|
||||
2010-11-11 Andreas Schwab <schwab@redhat.com>
|
||||
|
||||
* posix/fnmatch_loop.c (NEW_PATTERN): Fix use of alloca.
|
||||
* posix/Makefile (tests): Add $(objpfx)tst-fnmatch-mem.
|
||||
(tst-fnmatch-ENV): Set MALLOC_TRACE.
|
||||
($(objpfx)tst-fnmatch-mem): New rule.
|
||||
(generated): Add tst-fnmatch-mem and tst-fnmatch.mtrace.
|
||||
* posix/tst-fnmatch.c (main): Call mtrace.
|
||||
|
||||
2010-08-09 Ulrich Drepper <drepper@redhat.com>
|
||||
|
||||
[BZ #11883]
|
||||
* posix/fnmatch.c: Keep track of alloca use and fall back on malloc.
|
||||
* posix/fnmatch_loop.c: Likewise.
|
||||
|
||||
Index: glibc-2.12-2-gc4ccff1/posix/Makefile
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/posix/Makefile
|
||||
+++ glibc-2.12-2-gc4ccff1/posix/Makefile
|
||||
@@ -114,7 +114,8 @@ generated := $(addprefix wordexp-test-re
|
||||
tst-rxspencer-mem tst-rxspencer.mtrace tst-getconf.out \
|
||||
tst-pcre-mem tst-pcre.mtrace tst-boost-mem tst-boost.mtrace \
|
||||
bug-ga2.mtrace bug-ga2-mem bug-glob2.mtrace bug-glob2-mem \
|
||||
- tst-vfork3-mem tst-vfork3.mtrace getconf.speclist
|
||||
+ tst-vfork3-mem tst-vfork3.mtrace getconf.speclist \
|
||||
+ tst-fnmatch-mem tst-fnmatch.mtrace
|
||||
|
||||
include ../Rules
|
||||
|
||||
@@ -226,7 +227,7 @@ ifeq (no,$(cross-compiling))
|
||||
tests: $(objpfx)bug-regex2-mem $(objpfx)bug-regex14-mem \
|
||||
$(objpfx)bug-regex21-mem $(objpfx)tst-rxspencer-mem \
|
||||
$(objpfx)tst-pcre-mem $(objpfx)tst-boost-mem $(objpfx)tst-getconf.out \
|
||||
- $(objpfx)bug-glob2-mem $(objpfx)tst-vfork3-mem
|
||||
+ $(objpfx)bug-glob2-mem $(objpfx)tst-vfork3-mem $(objpfx)tst-fnmatch-mem
|
||||
xtests: $(objpfx)bug-ga2-mem
|
||||
endif
|
||||
|
||||
@@ -238,6 +239,11 @@ annexc-CFLAGS = -O
|
||||
$(objpfx)annexc: annexc.c
|
||||
$(native-compile)
|
||||
|
||||
+tst-fnmatch-ENV += MALLOC_TRACE=$(objpfx)tst-fnmatch.mtrace
|
||||
+
|
||||
+$(objpfx)tst-fnmatch-mem: $(objpfx)tst-fnmatch.out
|
||||
+ $(common-objpfx)malloc/mtrace $(objpfx)tst-fnmatch.mtrace > $@
|
||||
+
|
||||
bug-regex2-ENV = MALLOC_TRACE=$(objpfx)bug-regex2.mtrace
|
||||
|
||||
$(objpfx)bug-regex2-mem: $(objpfx)bug-regex2.out
|
||||
Index: glibc-2.12-2-gc4ccff1/posix/fnmatch.c
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/posix/fnmatch.c
|
||||
+++ glibc-2.12-2-gc4ccff1/posix/fnmatch.c
|
||||
@@ -41,6 +41,12 @@
|
||||
# include <stdlib.h>
|
||||
#endif
|
||||
|
||||
+#ifdef _LIBC
|
||||
+# include <alloca.h>
|
||||
+#else
|
||||
+# define alloca_account(size., var) alloca (size)
|
||||
+#endif
|
||||
+
|
||||
/* For platform which support the ISO C amendement 1 functionality we
|
||||
support user defined character classes. */
|
||||
#if defined _LIBC || (defined HAVE_WCTYPE_H && defined HAVE_WCHAR_H)
|
||||
@@ -330,8 +336,11 @@ fnmatch (pattern, string, flags)
|
||||
mbstate_t ps;
|
||||
size_t n;
|
||||
const char *p;
|
||||
+ wchar_t *wpattern_malloc = NULL;
|
||||
wchar_t *wpattern;
|
||||
+ wchar_t *wstring_malloc = NULL;
|
||||
wchar_t *wstring;
|
||||
+ size_t alloca_used = 0;
|
||||
|
||||
/* Convert the strings into wide characters. */
|
||||
memset (&ps, '\0', sizeof (ps));
|
||||
@@ -343,7 +352,8 @@ fnmatch (pattern, string, flags)
|
||||
#endif
|
||||
if (__builtin_expect (n < 1024, 1))
|
||||
{
|
||||
- wpattern = (wchar_t *) alloca ((n + 1) * sizeof (wchar_t));
|
||||
+ wpattern = (wchar_t *) alloca_account ((n + 1) * sizeof (wchar_t),
|
||||
+ alloca_used);
|
||||
n = mbsrtowcs (wpattern, &p, n + 1, &ps);
|
||||
if (__builtin_expect (n == (size_t) -1, 0))
|
||||
/* Something wrong.
|
||||
@@ -365,8 +375,16 @@ fnmatch (pattern, string, flags)
|
||||
XXX Do we have to set `errno' to something which mbsrtows hasn't
|
||||
already done? */
|
||||
return -1;
|
||||
- wpattern = (wchar_t *) alloca ((n + 1) * sizeof (wchar_t));
|
||||
+ if (__builtin_expect (n >= (size_t) -1 / sizeof (wchar_t), 0))
|
||||
+ {
|
||||
+ __set_errno (ENOMEM);
|
||||
+ return -2;
|
||||
+ }
|
||||
+ wpattern_malloc = wpattern
|
||||
+ = (wchar_t *) malloc ((n + 1) * sizeof (wchar_t));
|
||||
assert (mbsinit (&ps));
|
||||
+ if (wpattern == NULL)
|
||||
+ return -2;
|
||||
(void) mbsrtowcs (wpattern, &pattern, n + 1, &ps);
|
||||
}
|
||||
|
||||
@@ -379,13 +397,18 @@ fnmatch (pattern, string, flags)
|
||||
p = string;
|
||||
if (__builtin_expect (n < 1024, 1))
|
||||
{
|
||||
- wstring = (wchar_t *) alloca ((n + 1) * sizeof (wchar_t));
|
||||
+ wstring = (wchar_t *) alloca_account ((n + 1) * sizeof (wchar_t),
|
||||
+ alloca_used);
|
||||
n = mbsrtowcs (wstring, &p, n + 1, &ps);
|
||||
if (__builtin_expect (n == (size_t) -1, 0))
|
||||
- /* Something wrong.
|
||||
- XXX Do we have to set `errno' to something which mbsrtows hasn't
|
||||
- already done? */
|
||||
- return -1;
|
||||
+ {
|
||||
+ /* Something wrong.
|
||||
+ XXX Do we have to set `errno' to something which
|
||||
+ mbsrtows hasn't already done? */
|
||||
+ free_return:
|
||||
+ free (wpattern_malloc);
|
||||
+ return -1;
|
||||
+ }
|
||||
if (p)
|
||||
{
|
||||
memset (&ps, '\0', sizeof (ps));
|
||||
@@ -400,19 +423,38 @@ fnmatch (pattern, string, flags)
|
||||
/* Something wrong.
|
||||
XXX Do we have to set `errno' to something which mbsrtows hasn't
|
||||
already done? */
|
||||
- return -1;
|
||||
- wstring = (wchar_t *) alloca ((n + 1) * sizeof (wchar_t));
|
||||
+ goto free_return;
|
||||
+ if (__builtin_expect (n >= (size_t) -1 / sizeof (wchar_t), 0))
|
||||
+ {
|
||||
+ free (wpattern_malloc);
|
||||
+ __set_errno (ENOMEM);
|
||||
+ return -2;
|
||||
+ }
|
||||
+
|
||||
+ wstring_malloc = wstring
|
||||
+ = (wchar_t *) malloc ((n + 1) * sizeof (wchar_t));
|
||||
+ if (wstring == NULL)
|
||||
+ {
|
||||
+ free (wpattern_malloc);
|
||||
+ return -2;
|
||||
+ }
|
||||
assert (mbsinit (&ps));
|
||||
(void) mbsrtowcs (wstring, &string, n + 1, &ps);
|
||||
}
|
||||
|
||||
- return internal_fnwmatch (wpattern, wstring, wstring + n,
|
||||
- flags & FNM_PERIOD, flags, NULL);
|
||||
+ int res = internal_fnwmatch (wpattern, wstring, wstring + n,
|
||||
+ flags & FNM_PERIOD, flags, NULL,
|
||||
+ alloca_used);
|
||||
+
|
||||
+ free (wstring_malloc);
|
||||
+ free (wpattern_malloc);
|
||||
+
|
||||
+ return res;
|
||||
}
|
||||
# endif /* mbstate_t and mbsrtowcs or _LIBC. */
|
||||
|
||||
return internal_fnmatch (pattern, string, string + strlen (string),
|
||||
- flags & FNM_PERIOD, flags, NULL);
|
||||
+ flags & FNM_PERIOD, flags, NULL, 0);
|
||||
}
|
||||
|
||||
# ifdef _LIBC
|
||||
Index: glibc-2.12-2-gc4ccff1/posix/fnmatch_loop.c
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/posix/fnmatch_loop.c
|
||||
+++ glibc-2.12-2-gc4ccff1/posix/fnmatch_loop.c
|
||||
@@ -28,22 +28,24 @@ struct STRUCT
|
||||
it matches, nonzero if not. */
|
||||
static int FCT (const CHAR *pattern, const CHAR *string,
|
||||
const CHAR *string_end, int no_leading_period, int flags,
|
||||
- struct STRUCT *ends)
|
||||
+ struct STRUCT *ends, size_t alloca_used)
|
||||
internal_function;
|
||||
static int EXT (INT opt, const CHAR *pattern, const CHAR *string,
|
||||
- const CHAR *string_end, int no_leading_period, int flags)
|
||||
+ const CHAR *string_end, int no_leading_period, int flags,
|
||||
+ size_t alloca_used)
|
||||
internal_function;
|
||||
static const CHAR *END (const CHAR *patternp) internal_function;
|
||||
|
||||
static int
|
||||
internal_function
|
||||
-FCT (pattern, string, string_end, no_leading_period, flags, ends)
|
||||
+FCT (pattern, string, string_end, no_leading_period, flags, ends, alloca_used)
|
||||
const CHAR *pattern;
|
||||
const CHAR *string;
|
||||
const CHAR *string_end;
|
||||
int no_leading_period;
|
||||
int flags;
|
||||
struct STRUCT *ends;
|
||||
+ size_t alloca_used;
|
||||
{
|
||||
register const CHAR *p = pattern, *n = string;
|
||||
register UCHAR c;
|
||||
@@ -67,10 +69,8 @@ FCT (pattern, string, string_end, no_lea
|
||||
case L('?'):
|
||||
if (__builtin_expect (flags & FNM_EXTMATCH, 0) && *p == '(')
|
||||
{
|
||||
- int res;
|
||||
-
|
||||
- res = EXT (c, p, n, string_end, no_leading_period,
|
||||
- flags);
|
||||
+ int res = EXT (c, p, n, string_end, no_leading_period,
|
||||
+ flags, alloca_used);
|
||||
if (res != -1)
|
||||
return res;
|
||||
}
|
||||
@@ -99,10 +99,8 @@ FCT (pattern, string, string_end, no_lea
|
||||
case L('*'):
|
||||
if (__builtin_expect (flags & FNM_EXTMATCH, 0) && *p == '(')
|
||||
{
|
||||
- int res;
|
||||
-
|
||||
- res = EXT (c, p, n, string_end, no_leading_period,
|
||||
- flags);
|
||||
+ int res = EXT (c, p, n, string_end, no_leading_period,
|
||||
+ flags, alloca_used);
|
||||
if (res != -1)
|
||||
return res;
|
||||
}
|
||||
@@ -191,7 +189,7 @@ FCT (pattern, string, string_end, no_lea
|
||||
|
||||
for (--p; n < endp; ++n, no_leading_period = 0)
|
||||
if (FCT (p, n, string_end, no_leading_period, flags2,
|
||||
- &end) == 0)
|
||||
+ &end, alloca_used) == 0)
|
||||
goto found;
|
||||
}
|
||||
else if (c == L('/') && (flags & FNM_FILE_NAME))
|
||||
@@ -200,7 +198,7 @@ FCT (pattern, string, string_end, no_lea
|
||||
++n;
|
||||
if (n < string_end && *n == L('/')
|
||||
&& (FCT (p, n + 1, string_end, flags & FNM_PERIOD, flags,
|
||||
- NULL) == 0))
|
||||
+ NULL, alloca_used) == 0))
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
@@ -214,7 +212,7 @@ FCT (pattern, string, string_end, no_lea
|
||||
for (--p; n < endp; ++n, no_leading_period = 0)
|
||||
if (FOLD ((UCHAR) *n) == c
|
||||
&& (FCT (p, n, string_end, no_leading_period, flags2,
|
||||
- &end) == 0))
|
||||
+ &end, alloca_used) == 0))
|
||||
{
|
||||
found:
|
||||
if (end.pattern == NULL)
|
||||
@@ -749,7 +747,7 @@ FCT (pattern, string, string_end, no_lea
|
||||
_NL_COLLATE_SYMB_EXTRAMB);
|
||||
|
||||
/* Locate the character in the hashing
|
||||
- table. */
|
||||
+ table. */
|
||||
hash = elem_hash (str, c1);
|
||||
|
||||
idx = 0;
|
||||
@@ -971,9 +969,8 @@ FCT (pattern, string, string_end, no_lea
|
||||
case L('!'):
|
||||
if (__builtin_expect (flags & FNM_EXTMATCH, 0) && *p == '(')
|
||||
{
|
||||
- int res;
|
||||
-
|
||||
- res = EXT (c, p, n, string_end, no_leading_period, flags);
|
||||
+ int res = EXT (c, p, n, string_end, no_leading_period, flags,
|
||||
+ alloca_used);
|
||||
if (res != -1)
|
||||
return res;
|
||||
}
|
||||
@@ -1052,26 +1049,32 @@ END (const CHAR *pattern)
|
||||
static int
|
||||
internal_function
|
||||
EXT (INT opt, const CHAR *pattern, const CHAR *string, const CHAR *string_end,
|
||||
- int no_leading_period, int flags)
|
||||
+ int no_leading_period, int flags, size_t alloca_used)
|
||||
{
|
||||
const CHAR *startp;
|
||||
int level;
|
||||
struct patternlist
|
||||
{
|
||||
struct patternlist *next;
|
||||
+ CHAR malloced;
|
||||
CHAR str[0];
|
||||
} *list = NULL;
|
||||
struct patternlist **lastp = &list;
|
||||
size_t pattern_len = STRLEN (pattern);
|
||||
+ int any_malloced = 0;
|
||||
const CHAR *p;
|
||||
const CHAR *rs;
|
||||
+ int retval = 0;
|
||||
|
||||
/* Parse the pattern. Store the individual parts in the list. */
|
||||
level = 0;
|
||||
for (startp = p = pattern + 1; level >= 0; ++p)
|
||||
if (*p == L('\0'))
|
||||
- /* This is an invalid pattern. */
|
||||
- return -1;
|
||||
+ {
|
||||
+ /* This is an invalid pattern. */
|
||||
+ retval = -1;
|
||||
+ goto out;
|
||||
+ }
|
||||
else if (*p == L('['))
|
||||
{
|
||||
/* Handle brackets special. */
|
||||
@@ -1088,8 +1091,11 @@ EXT (INT opt, const CHAR *pattern, const
|
||||
/* Skip over all characters of the list. */
|
||||
while (*p != L(']'))
|
||||
if (*p++ == L('\0'))
|
||||
- /* This is no valid pattern. */
|
||||
- return -1;
|
||||
+ {
|
||||
+ /* This is no valid pattern. */
|
||||
+ retval = -1;
|
||||
+ goto out;
|
||||
+ }
|
||||
}
|
||||
else if ((*p == L('?') || *p == L('*') || *p == L('+') || *p == L('@')
|
||||
|| *p == L('!')) && p[1] == L('('))
|
||||
@@ -1102,15 +1108,25 @@ EXT (INT opt, const CHAR *pattern, const
|
||||
/* This means we found the end of the pattern. */
|
||||
#define NEW_PATTERN \
|
||||
struct patternlist *newp; \
|
||||
- \
|
||||
- if (opt == L('?') || opt == L('@')) \
|
||||
- newp = alloca (sizeof (struct patternlist) \
|
||||
- + (pattern_len * sizeof (CHAR))); \
|
||||
+ size_t slen = (opt == L('?') || opt == L('@') \
|
||||
+ ? pattern_len : (p - startp + 1)); \
|
||||
+ slen = sizeof (struct patternlist) + (slen * sizeof (CHAR)); \
|
||||
+ int malloced = ! __libc_use_alloca (alloca_used + slen); \
|
||||
+ if (__builtin_expect (malloced, 0)) \
|
||||
+ { \
|
||||
+ newp = malloc (slen); \
|
||||
+ if (newp == NULL) \
|
||||
+ { \
|
||||
+ retval = -2; \
|
||||
+ goto out; \
|
||||
+ } \
|
||||
+ any_malloced = 1; \
|
||||
+ } \
|
||||
else \
|
||||
- newp = alloca (sizeof (struct patternlist) \
|
||||
- + ((p - startp + 1) * sizeof (CHAR))); \
|
||||
- *((CHAR *) MEMPCPY (newp->str, startp, p - startp)) = L('\0'); \
|
||||
+ newp = alloca_account (slen, alloca_used); \
|
||||
newp->next = NULL; \
|
||||
+ newp->malloced = malloced; \
|
||||
+ *((CHAR *) MEMPCPY (newp->str, startp, p - startp)) = L('\0'); \
|
||||
*lastp = newp; \
|
||||
lastp = &newp->next
|
||||
NEW_PATTERN;
|
||||
@@ -1131,8 +1147,9 @@ EXT (INT opt, const CHAR *pattern, const
|
||||
switch (opt)
|
||||
{
|
||||
case L('*'):
|
||||
- if (FCT (p, string, string_end, no_leading_period, flags, NULL) == 0)
|
||||
- return 0;
|
||||
+ if (FCT (p, string, string_end, no_leading_period, flags, NULL,
|
||||
+ alloca_used) == 0)
|
||||
+ goto success;
|
||||
/* FALLTHROUGH */
|
||||
|
||||
case L('+'):
|
||||
@@ -1143,7 +1160,7 @@ EXT (INT opt, const CHAR *pattern, const
|
||||
current pattern. */
|
||||
if (FCT (list->str, string, rs, no_leading_period,
|
||||
flags & FNM_FILE_NAME ? flags : flags & ~FNM_PERIOD,
|
||||
- NULL) == 0
|
||||
+ NULL, alloca_used) == 0
|
||||
/* This was successful. Now match the rest with the rest
|
||||
of the pattern. */
|
||||
&& (FCT (p, rs, string_end,
|
||||
@@ -1151,7 +1168,7 @@ EXT (INT opt, const CHAR *pattern, const
|
||||
? no_leading_period
|
||||
: rs[-1] == '/' && NO_LEADING_PERIOD (flags) ? 1 : 0,
|
||||
flags & FNM_FILE_NAME
|
||||
- ? flags : flags & ~FNM_PERIOD, NULL) == 0
|
||||
+ ? flags : flags & ~FNM_PERIOD, NULL, alloca_used) == 0
|
||||
/* This didn't work. Try the whole pattern. */
|
||||
|| (rs != string
|
||||
&& FCT (pattern - 1, rs, string_end,
|
||||
@@ -1160,18 +1177,21 @@ EXT (INT opt, const CHAR *pattern, const
|
||||
: (rs[-1] == '/' && NO_LEADING_PERIOD (flags)
|
||||
? 1 : 0),
|
||||
flags & FNM_FILE_NAME
|
||||
- ? flags : flags & ~FNM_PERIOD, NULL) == 0)))
|
||||
+ ? flags : flags & ~FNM_PERIOD, NULL,
|
||||
+ alloca_used) == 0)))
|
||||
/* It worked. Signal success. */
|
||||
- return 0;
|
||||
+ goto success;
|
||||
}
|
||||
while ((list = list->next) != NULL);
|
||||
|
||||
/* None of the patterns lead to a match. */
|
||||
- return FNM_NOMATCH;
|
||||
+ retval = FNM_NOMATCH;
|
||||
+ break;
|
||||
|
||||
case L('?'):
|
||||
- if (FCT (p, string, string_end, no_leading_period, flags, NULL) == 0)
|
||||
- return 0;
|
||||
+ if (FCT (p, string, string_end, no_leading_period, flags, NULL,
|
||||
+ alloca_used) == 0)
|
||||
+ goto success;
|
||||
/* FALLTHROUGH */
|
||||
|
||||
case L('@'):
|
||||
@@ -1183,13 +1203,14 @@ EXT (INT opt, const CHAR *pattern, const
|
||||
if (FCT (STRCAT (list->str, p), string, string_end,
|
||||
no_leading_period,
|
||||
flags & FNM_FILE_NAME ? flags : flags & ~FNM_PERIOD,
|
||||
- NULL) == 0)
|
||||
+ NULL, alloca_used) == 0)
|
||||
/* It worked. Signal success. */
|
||||
- return 0;
|
||||
+ goto success;
|
||||
while ((list = list->next) != NULL);
|
||||
|
||||
/* None of the patterns lead to a match. */
|
||||
- return FNM_NOMATCH;
|
||||
+ retval = FNM_NOMATCH;
|
||||
+ break;
|
||||
|
||||
case L('!'):
|
||||
for (rs = string; rs <= string_end; ++rs)
|
||||
@@ -1199,7 +1220,7 @@ EXT (INT opt, const CHAR *pattern, const
|
||||
for (runp = list; runp != NULL; runp = runp->next)
|
||||
if (FCT (runp->str, string, rs, no_leading_period,
|
||||
flags & FNM_FILE_NAME ? flags : flags & ~FNM_PERIOD,
|
||||
- NULL) == 0)
|
||||
+ NULL, alloca_used) == 0)
|
||||
break;
|
||||
|
||||
/* If none of the patterns matched see whether the rest does. */
|
||||
@@ -1209,21 +1230,34 @@ EXT (INT opt, const CHAR *pattern, const
|
||||
? no_leading_period
|
||||
: rs[-1] == '/' && NO_LEADING_PERIOD (flags) ? 1 : 0,
|
||||
flags & FNM_FILE_NAME ? flags : flags & ~FNM_PERIOD,
|
||||
- NULL) == 0))
|
||||
+ NULL, alloca_used) == 0))
|
||||
/* This is successful. */
|
||||
- return 0;
|
||||
+ goto success;
|
||||
}
|
||||
|
||||
/* None of the patterns together with the rest of the pattern
|
||||
lead to a match. */
|
||||
- return FNM_NOMATCH;
|
||||
+ retval = FNM_NOMATCH;
|
||||
+ break;
|
||||
|
||||
default:
|
||||
assert (! "Invalid extended matching operator");
|
||||
+ retval = -1;
|
||||
break;
|
||||
}
|
||||
|
||||
- return -1;
|
||||
+ success:
|
||||
+ out:
|
||||
+ if (any_malloced)
|
||||
+ while (list != NULL)
|
||||
+ {
|
||||
+ struct patternlist *old = list;
|
||||
+ list = list->next;
|
||||
+ if (old->malloced)
|
||||
+ free (old);
|
||||
+ }
|
||||
+
|
||||
+ return retval;
|
||||
}
|
||||
|
||||
|
||||
Index: glibc-2.12-2-gc4ccff1/posix/tst-fnmatch.c
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/posix/tst-fnmatch.c
|
||||
+++ glibc-2.12-2-gc4ccff1/posix/tst-fnmatch.c
|
||||
@@ -25,6 +25,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
+#include <mcheck.h>
|
||||
|
||||
|
||||
static char *next_input (char **line, int first, int last);
|
||||
@@ -46,6 +47,8 @@ main (void)
|
||||
size_t escpatternlen = 0;
|
||||
int nr = 0;
|
||||
|
||||
+ mtrace ();
|
||||
+
|
||||
/* Read lines from stdin with the following format:
|
||||
|
||||
locale input-string match-string flags result
|
||||
1638
src/patches/glibc/glibc-rh688720.patch
Normal file
1638
src/patches/glibc/glibc-rh688720.patch
Normal file
File diff suppressed because it is too large
Load Diff
20
src/patches/glibc/glibc-rh688980.patch
Normal file
20
src/patches/glibc/glibc-rh688980.patch
Normal file
@@ -0,0 +1,20 @@
|
||||
2011-05-11 Ulrich Drepper <drepper@gmail.com>
|
||||
|
||||
[BZ #12625]
|
||||
* misc/mntent_r.c (addmntent): Flush the stream after the output
|
||||
|
||||
Index: glibc-2.12-2-gc4ccff1/misc/mntent_r.c
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/misc/mntent_r.c
|
||||
+++ glibc-2.12-2-gc4ccff1/misc/mntent_r.c
|
||||
@@ -263,8 +263,8 @@ __addmntent (FILE *stream, const struct
|
||||
mntcopy.mnt_type,
|
||||
mntcopy.mnt_opts,
|
||||
mntcopy.mnt_freq,
|
||||
- mntcopy.mnt_passno)
|
||||
- < 0 ? 1 : 0);
|
||||
+ mntcopy.mnt_passno) < 0
|
||||
+ || fflush (stream) != 0);
|
||||
}
|
||||
weak_alias (__addmntent, addmntent)
|
||||
|
||||
333
src/patches/glibc/glibc-rh689471.patch
Normal file
333
src/patches/glibc/glibc-rh689471.patch
Normal file
@@ -0,0 +1,333 @@
|
||||
2011-03-20 H.J. Lu <hongjiu.lu@intel.com>
|
||||
|
||||
[BZ #12597]
|
||||
* string/test-strncmp.c (do_page_test): New function.
|
||||
(check2): Likewise.
|
||||
(test_main): Call check2.
|
||||
* sysdeps/x86_64/multiarch/strcmp.S: Properly cross page boundary.
|
||||
|
||||
Index: glibc-2.12-2-gc4ccff1/string/test-strncmp.c
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/string/test-strncmp.c
|
||||
+++ glibc-2.12-2-gc4ccff1/string/test-strncmp.c
|
||||
@@ -200,6 +200,27 @@ do_test (size_t align1, size_t align2, s
|
||||
}
|
||||
|
||||
static void
|
||||
+do_page_test (size_t offset1, size_t offset2, char *s2)
|
||||
+{
|
||||
+ char *s1;
|
||||
+ int exp_result;
|
||||
+
|
||||
+ if (offset1 >= page_size || offset2 >= page_size)
|
||||
+ return;
|
||||
+
|
||||
+ s1 = (char *) (buf1 + offset1);
|
||||
+ s2 += offset2;
|
||||
+
|
||||
+ exp_result= *s1;
|
||||
+
|
||||
+ FOR_EACH_IMPL (impl, 0)
|
||||
+ {
|
||||
+ check_result (impl, s1, s2, page_size, -exp_result);
|
||||
+ check_result (impl, s2, s1, page_size, exp_result);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
do_random_tests (void)
|
||||
{
|
||||
size_t i, j, n, align1, align2, pos, len1, len2, size;
|
||||
@@ -312,6 +333,25 @@ check1 (void)
|
||||
}
|
||||
}
|
||||
|
||||
+static void
|
||||
+check2 (void)
|
||||
+{
|
||||
+ size_t i;
|
||||
+ char *s1, *s2;
|
||||
+
|
||||
+ s1 = (char *) buf1;
|
||||
+ for (i = 0; i < page_size - 1; i++)
|
||||
+ s1[i] = 23;
|
||||
+ s1[i] = 0;
|
||||
+
|
||||
+ s2 = strdup (s1);
|
||||
+
|
||||
+ for (i = 0; i < 64; ++i)
|
||||
+ do_page_test (3990 + i, 2635, s2);
|
||||
+
|
||||
+ free (s2);
|
||||
+}
|
||||
+
|
||||
int
|
||||
test_main (void)
|
||||
{
|
||||
@@ -320,6 +360,7 @@ test_main (void)
|
||||
test_init ();
|
||||
|
||||
check1 ();
|
||||
+ check2 ();
|
||||
|
||||
printf ("%23s", "");
|
||||
FOR_EACH_IMPL (impl, 0)
|
||||
Index: glibc-2.12-2-gc4ccff1/sysdeps/x86_64/multiarch/strcmp.S
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/sysdeps/x86_64/multiarch/strcmp.S
|
||||
+++ glibc-2.12-2-gc4ccff1/sysdeps/x86_64/multiarch/strcmp.S
|
||||
@@ -452,6 +452,7 @@ LABEL(loop_ashr_1_use_sse4_2):
|
||||
add $16, %r10
|
||||
jg LABEL(nibble_ashr_1_use_sse4_2)
|
||||
|
||||
+LABEL(nibble_ashr_1_use_sse4_2_restart):
|
||||
movdqa (%rdi, %rdx), %xmm0
|
||||
palignr $1, -16(%rdi, %rdx), %xmm0
|
||||
# if !defined USE_AS_STRCASECMP_L && !defined USE_AS_STRNCASECMP_L
|
||||
@@ -499,7 +500,7 @@ LABEL(nibble_ashr_1_use_sse4_2):
|
||||
jae LABEL(nibble_ashr_use_sse4_2_exit)
|
||||
# endif
|
||||
cmp $14, %ecx
|
||||
- ja LABEL(loop_ashr_1_use_sse4_2)
|
||||
+ ja LABEL(nibble_ashr_1_use_sse4_2_restart)
|
||||
|
||||
jmp LABEL(nibble_ashr_use_sse4_2_exit)
|
||||
|
||||
@@ -544,6 +545,7 @@ LABEL(loop_ashr_2_use_sse4_2):
|
||||
add $16, %r10
|
||||
jg LABEL(nibble_ashr_2_use_sse4_2)
|
||||
|
||||
+LABEL(nibble_ashr_2_use_sse4_2_restart):
|
||||
movdqa (%rdi, %rdx), %xmm0
|
||||
palignr $2, -16(%rdi, %rdx), %xmm0
|
||||
# if !defined USE_AS_STRCASECMP_L && !defined USE_AS_STRNCASECMP_L
|
||||
@@ -591,7 +593,7 @@ LABEL(nibble_ashr_2_use_sse4_2):
|
||||
jae LABEL(nibble_ashr_use_sse4_2_exit)
|
||||
# endif
|
||||
cmp $13, %ecx
|
||||
- ja LABEL(loop_ashr_2_use_sse4_2)
|
||||
+ ja LABEL(nibble_ashr_2_use_sse4_2_restart)
|
||||
|
||||
jmp LABEL(nibble_ashr_use_sse4_2_exit)
|
||||
|
||||
@@ -636,6 +638,7 @@ LABEL(loop_ashr_3_use_sse4_2):
|
||||
add $16, %r10
|
||||
jg LABEL(nibble_ashr_3_use_sse4_2)
|
||||
|
||||
+LABEL(nibble_ashr_3_use_sse4_2_restart):
|
||||
movdqa (%rdi, %rdx), %xmm0
|
||||
palignr $3, -16(%rdi, %rdx), %xmm0
|
||||
# if !defined USE_AS_STRCASECMP_L && !defined USE_AS_STRNCASECMP_L
|
||||
@@ -683,7 +686,7 @@ LABEL(nibble_ashr_3_use_sse4_2):
|
||||
jae LABEL(nibble_ashr_use_sse4_2_exit)
|
||||
# endif
|
||||
cmp $12, %ecx
|
||||
- ja LABEL(loop_ashr_3_use_sse4_2)
|
||||
+ ja LABEL(nibble_ashr_3_use_sse4_2_restart)
|
||||
|
||||
jmp LABEL(nibble_ashr_use_sse4_2_exit)
|
||||
|
||||
@@ -729,6 +732,7 @@ LABEL(loop_ashr_4_use_sse4_2):
|
||||
add $16, %r10
|
||||
jg LABEL(nibble_ashr_4_use_sse4_2)
|
||||
|
||||
+LABEL(nibble_ashr_4_use_sse4_2_restart):
|
||||
movdqa (%rdi, %rdx), %xmm0
|
||||
palignr $4, -16(%rdi, %rdx), %xmm0
|
||||
# if !defined USE_AS_STRCASECMP_L && !defined USE_AS_STRNCASECMP_L
|
||||
@@ -776,7 +780,7 @@ LABEL(nibble_ashr_4_use_sse4_2):
|
||||
jae LABEL(nibble_ashr_use_sse4_2_exit)
|
||||
# endif
|
||||
cmp $11, %ecx
|
||||
- ja LABEL(loop_ashr_4_use_sse4_2)
|
||||
+ ja LABEL(nibble_ashr_4_use_sse4_2_restart)
|
||||
|
||||
jmp LABEL(nibble_ashr_use_sse4_2_exit)
|
||||
|
||||
@@ -822,6 +826,7 @@ LABEL(loop_ashr_5_use_sse4_2):
|
||||
add $16, %r10
|
||||
jg LABEL(nibble_ashr_5_use_sse4_2)
|
||||
|
||||
+LABEL(nibble_ashr_5_use_sse4_2_restart):
|
||||
movdqa (%rdi, %rdx), %xmm0
|
||||
palignr $5, -16(%rdi, %rdx), %xmm0
|
||||
# if !defined USE_AS_STRCASECMP_L && !defined USE_AS_STRNCASECMP_L
|
||||
@@ -870,7 +875,7 @@ LABEL(nibble_ashr_5_use_sse4_2):
|
||||
jae LABEL(nibble_ashr_use_sse4_2_exit)
|
||||
# endif
|
||||
cmp $10, %ecx
|
||||
- ja LABEL(loop_ashr_5_use_sse4_2)
|
||||
+ ja LABEL(nibble_ashr_5_use_sse4_2_restart)
|
||||
|
||||
jmp LABEL(nibble_ashr_use_sse4_2_exit)
|
||||
|
||||
@@ -916,6 +921,7 @@ LABEL(loop_ashr_6_use_sse4_2):
|
||||
add $16, %r10
|
||||
jg LABEL(nibble_ashr_6_use_sse4_2)
|
||||
|
||||
+LABEL(nibble_ashr_6_use_sse4_2_restart):
|
||||
movdqa (%rdi, %rdx), %xmm0
|
||||
palignr $6, -16(%rdi, %rdx), %xmm0
|
||||
# if !defined USE_AS_STRCASECMP_L && !defined USE_AS_STRNCASECMP_L
|
||||
@@ -963,7 +969,7 @@ LABEL(nibble_ashr_6_use_sse4_2):
|
||||
jae LABEL(nibble_ashr_use_sse4_2_exit)
|
||||
# endif
|
||||
cmp $9, %ecx
|
||||
- ja LABEL(loop_ashr_6_use_sse4_2)
|
||||
+ ja LABEL(nibble_ashr_6_use_sse4_2_restart)
|
||||
|
||||
jmp LABEL(nibble_ashr_use_sse4_2_exit)
|
||||
|
||||
@@ -1009,6 +1015,7 @@ LABEL(loop_ashr_7_use_sse4_2):
|
||||
add $16, %r10
|
||||
jg LABEL(nibble_ashr_7_use_sse4_2)
|
||||
|
||||
+LABEL(nibble_ashr_7_use_sse4_2_restart):
|
||||
movdqa (%rdi, %rdx), %xmm0
|
||||
palignr $7, -16(%rdi, %rdx), %xmm0
|
||||
# if !defined USE_AS_STRCASECMP_L && !defined USE_AS_STRNCASECMP_L
|
||||
@@ -1056,7 +1063,7 @@ LABEL(nibble_ashr_7_use_sse4_2):
|
||||
jae LABEL(nibble_ashr_use_sse4_2_exit)
|
||||
# endif
|
||||
cmp $8, %ecx
|
||||
- ja LABEL(loop_ashr_7_use_sse4_2)
|
||||
+ ja LABEL(nibble_ashr_7_use_sse4_2_restart)
|
||||
|
||||
jmp LABEL(nibble_ashr_use_sse4_2_exit)
|
||||
|
||||
@@ -1102,6 +1109,7 @@ LABEL(loop_ashr_8_use_sse4_2):
|
||||
add $16, %r10
|
||||
jg LABEL(nibble_ashr_8_use_sse4_2)
|
||||
|
||||
+LABEL(nibble_ashr_8_use_sse4_2_restart):
|
||||
movdqa (%rdi, %rdx), %xmm0
|
||||
palignr $8, -16(%rdi, %rdx), %xmm0
|
||||
# if !defined USE_AS_STRCASECMP_L && !defined USE_AS_STRNCASECMP_L
|
||||
@@ -1149,7 +1157,7 @@ LABEL(nibble_ashr_8_use_sse4_2):
|
||||
jae LABEL(nibble_ashr_use_sse4_2_exit)
|
||||
# endif
|
||||
cmp $7, %ecx
|
||||
- ja LABEL(loop_ashr_8_use_sse4_2)
|
||||
+ ja LABEL(nibble_ashr_8_use_sse4_2_restart)
|
||||
|
||||
jmp LABEL(nibble_ashr_use_sse4_2_exit)
|
||||
|
||||
@@ -1195,6 +1203,7 @@ LABEL(loop_ashr_9_use_sse4_2):
|
||||
add $16, %r10
|
||||
jg LABEL(nibble_ashr_9_use_sse4_2)
|
||||
|
||||
+LABEL(nibble_ashr_9_use_sse4_2_restart):
|
||||
movdqa (%rdi, %rdx), %xmm0
|
||||
|
||||
palignr $9, -16(%rdi, %rdx), %xmm0
|
||||
@@ -1243,7 +1252,7 @@ LABEL(nibble_ashr_9_use_sse4_2):
|
||||
jae LABEL(nibble_ashr_use_sse4_2_exit)
|
||||
# endif
|
||||
cmp $6, %ecx
|
||||
- ja LABEL(loop_ashr_9_use_sse4_2)
|
||||
+ ja LABEL(nibble_ashr_9_use_sse4_2_restart)
|
||||
|
||||
jmp LABEL(nibble_ashr_use_sse4_2_exit)
|
||||
|
||||
@@ -1289,6 +1298,7 @@ LABEL(loop_ashr_10_use_sse4_2):
|
||||
add $16, %r10
|
||||
jg LABEL(nibble_ashr_10_use_sse4_2)
|
||||
|
||||
+LABEL(nibble_ashr_10_use_sse4_2_restart):
|
||||
movdqa (%rdi, %rdx), %xmm0
|
||||
palignr $10, -16(%rdi, %rdx), %xmm0
|
||||
# if !defined USE_AS_STRCASECMP_L && !defined USE_AS_STRNCASECMP_L
|
||||
@@ -1336,7 +1346,7 @@ LABEL(nibble_ashr_10_use_sse4_2):
|
||||
jae LABEL(nibble_ashr_use_sse4_2_exit)
|
||||
# endif
|
||||
cmp $5, %ecx
|
||||
- ja LABEL(loop_ashr_10_use_sse4_2)
|
||||
+ ja LABEL(nibble_ashr_10_use_sse4_2_restart)
|
||||
|
||||
jmp LABEL(nibble_ashr_use_sse4_2_exit)
|
||||
|
||||
@@ -1382,6 +1392,7 @@ LABEL(loop_ashr_11_use_sse4_2):
|
||||
add $16, %r10
|
||||
jg LABEL(nibble_ashr_11_use_sse4_2)
|
||||
|
||||
+LABEL(nibble_ashr_11_use_sse4_2_restart):
|
||||
movdqa (%rdi, %rdx), %xmm0
|
||||
palignr $11, -16(%rdi, %rdx), %xmm0
|
||||
# if !defined USE_AS_STRCASECMP_L && !defined USE_AS_STRNCASECMP_L
|
||||
@@ -1429,7 +1440,7 @@ LABEL(nibble_ashr_11_use_sse4_2):
|
||||
jae LABEL(nibble_ashr_use_sse4_2_exit)
|
||||
# endif
|
||||
cmp $4, %ecx
|
||||
- ja LABEL(loop_ashr_11_use_sse4_2)
|
||||
+ ja LABEL(nibble_ashr_11_use_sse4_2_restart)
|
||||
|
||||
jmp LABEL(nibble_ashr_use_sse4_2_exit)
|
||||
|
||||
@@ -1475,6 +1486,7 @@ LABEL(loop_ashr_12_use_sse4_2):
|
||||
add $16, %r10
|
||||
jg LABEL(nibble_ashr_12_use_sse4_2)
|
||||
|
||||
+LABEL(nibble_ashr_12_use_sse4_2_restart):
|
||||
movdqa (%rdi, %rdx), %xmm0
|
||||
palignr $12, -16(%rdi, %rdx), %xmm0
|
||||
# if !defined USE_AS_STRCASECMP_L && !defined USE_AS_STRNCASECMP_L
|
||||
@@ -1522,7 +1534,7 @@ LABEL(nibble_ashr_12_use_sse4_2):
|
||||
jae LABEL(nibble_ashr_use_sse4_2_exit)
|
||||
# endif
|
||||
cmp $3, %ecx
|
||||
- ja LABEL(loop_ashr_12_use_sse4_2)
|
||||
+ ja LABEL(nibble_ashr_12_use_sse4_2_restart)
|
||||
|
||||
jmp LABEL(nibble_ashr_use_sse4_2_exit)
|
||||
|
||||
@@ -1569,6 +1581,7 @@ LABEL(loop_ashr_13_use_sse4_2):
|
||||
add $16, %r10
|
||||
jg LABEL(nibble_ashr_13_use_sse4_2)
|
||||
|
||||
+LABEL(nibble_ashr_13_use_sse4_2_restart):
|
||||
movdqa (%rdi, %rdx), %xmm0
|
||||
palignr $13, -16(%rdi, %rdx), %xmm0
|
||||
# if !defined USE_AS_STRCASECMP_L && !defined USE_AS_STRNCASECMP_L
|
||||
@@ -1616,7 +1629,7 @@ LABEL(nibble_ashr_13_use_sse4_2):
|
||||
jae LABEL(nibble_ashr_use_sse4_2_exit)
|
||||
# endif
|
||||
cmp $2, %ecx
|
||||
- ja LABEL(loop_ashr_13_use_sse4_2)
|
||||
+ ja LABEL(nibble_ashr_13_use_sse4_2_restart)
|
||||
|
||||
jmp LABEL(nibble_ashr_use_sse4_2_exit)
|
||||
|
||||
@@ -1663,6 +1676,7 @@ LABEL(loop_ashr_14_use_sse4_2):
|
||||
add $16, %r10
|
||||
jg LABEL(nibble_ashr_14_use_sse4_2)
|
||||
|
||||
+LABEL(nibble_ashr_14_use_sse4_2_restart):
|
||||
movdqa (%rdi, %rdx), %xmm0
|
||||
palignr $14, -16(%rdi, %rdx), %xmm0
|
||||
# if !defined USE_AS_STRCASECMP_L && !defined USE_AS_STRNCASECMP_L
|
||||
@@ -1710,7 +1724,7 @@ LABEL(nibble_ashr_14_use_sse4_2):
|
||||
jae LABEL(nibble_ashr_use_sse4_2_exit)
|
||||
# endif
|
||||
cmp $1, %ecx
|
||||
- ja LABEL(loop_ashr_14_use_sse4_2)
|
||||
+ ja LABEL(nibble_ashr_14_use_sse4_2_restart)
|
||||
|
||||
jmp LABEL(nibble_ashr_use_sse4_2_exit)
|
||||
|
||||
@@ -1759,6 +1773,7 @@ LABEL(loop_ashr_15_use_sse4_2):
|
||||
add $16, %r10
|
||||
jg LABEL(nibble_ashr_15_use_sse4_2)
|
||||
|
||||
+LABEL(nibble_ashr_15_use_sse4_2_restart):
|
||||
movdqa (%rdi, %rdx), %xmm0
|
||||
palignr $15, -16(%rdi, %rdx), %xmm0
|
||||
# if !defined USE_AS_STRCASECMP_L && !defined USE_AS_STRNCASECMP_L
|
||||
@@ -1806,7 +1821,7 @@ LABEL(nibble_ashr_15_use_sse4_2):
|
||||
jae LABEL(nibble_ashr_use_sse4_2_exit)
|
||||
# endif
|
||||
cmp $0, %ecx
|
||||
- ja LABEL(loop_ashr_15_use_sse4_2)
|
||||
+ ja LABEL(nibble_ashr_15_use_sse4_2_restart)
|
||||
|
||||
LABEL(nibble_ashr_use_sse4_2_exit):
|
||||
# if !defined USE_AS_STRCASECMP_L && !defined USE_AS_STRNCASECMP_L
|
||||
137
src/patches/glibc/glibc-rh692177.patch
Normal file
137
src/patches/glibc/glibc-rh692177.patch
Normal file
@@ -0,0 +1,137 @@
|
||||
2011-03-22 Ulrich Drepper <drepper@gmail.com>
|
||||
|
||||
* sysdeps/unix/sysv/linux/i386/sysconf.c (intel_check_word): Increment
|
||||
round counter.
|
||||
* sysdeps/x86_64/cacheinfo.c (intel_check_word): Likewise.
|
||||
|
||||
2011-03-20 Ulrich Drepper <drepper@gmail.com>
|
||||
|
||||
[BZ #12587]
|
||||
* sysdeps/unix/sysv/linux/i386/sysconf.c (intel_check_word):
|
||||
Handle cache information in CPU leaf 4.
|
||||
* sysdeps/x86_64/cacheinfo.c (intel_check_word): Likewise.
|
||||
|
||||
Index: glibc-2.12-2-gc4ccff1/sysdeps/unix/sysv/linux/i386/sysconf.c
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/sysdeps/unix/sysv/linux/i386/sysconf.c
|
||||
+++ glibc-2.12-2-gc4ccff1/sysdeps/unix/sysv/linux/i386/sysconf.c
|
||||
@@ -186,6 +186,57 @@ intel_check_word (int name, unsigned int
|
||||
/* No need to look further. */
|
||||
break;
|
||||
}
|
||||
+ else if (byte == 0xff)
|
||||
+ {
|
||||
+ /* CPUID leaf 0x4 contains all the information. We need to
|
||||
+ iterate over it. */
|
||||
+ unsigned int eax;
|
||||
+ unsigned int ebx;
|
||||
+ unsigned int ecx;
|
||||
+ unsigned int edx;
|
||||
+
|
||||
+ unsigned int round = 0;
|
||||
+ while (1)
|
||||
+ {
|
||||
+ asm volatile ("xchgl %%ebx, %1; cpuid; xchgl %%ebx, %1"
|
||||
+ : "=a" (eax), "=r" (ebx), "=c" (ecx), "=d" (edx)
|
||||
+ : "0" (4), "2" (round));
|
||||
+
|
||||
+ enum { null = 0, data = 1, inst = 2, uni = 3 } type = eax & 0x1f;
|
||||
+ if (type == null)
|
||||
+ /* That was the end. */
|
||||
+ break;
|
||||
+
|
||||
+ unsigned int level = (eax >> 5) & 0x7;
|
||||
+
|
||||
+ if ((level == 1 && type == data
|
||||
+ && folded_rel_name == M(_SC_LEVEL1_DCACHE_SIZE))
|
||||
+ || (level == 1 && type == inst
|
||||
+ && folded_rel_name == M(_SC_LEVEL1_ICACHE_SIZE))
|
||||
+ || (level == 2 && folded_rel_name == M(_SC_LEVEL2_CACHE_SIZE))
|
||||
+ || (level == 3 && folded_rel_name == M(_SC_LEVEL3_CACHE_SIZE))
|
||||
+ || (level == 4 && folded_rel_name == M(_SC_LEVEL4_CACHE_SIZE)))
|
||||
+ {
|
||||
+ unsigned int offset = M(name) - folded_rel_name;
|
||||
+
|
||||
+ if (offset == 0)
|
||||
+ /* Cache size. */
|
||||
+ return (((ebx >> 22) + 1)
|
||||
+ * (((ebx >> 12) & 0x3ff) + 1)
|
||||
+ * ((ebx & 0xfff) + 1)
|
||||
+ * (ecx + 1));
|
||||
+ if (offset == 1)
|
||||
+ return (ebx >> 22) + 1;
|
||||
+
|
||||
+ assert (offset == 2);
|
||||
+ return (ebx & 0xfff) + 1;
|
||||
+ }
|
||||
+
|
||||
+ ++round;
|
||||
+ }
|
||||
+ /* There is no other cache information anywhere else. */
|
||||
+ break;
|
||||
+ }
|
||||
else
|
||||
{
|
||||
if (byte == 0x49 && folded_rel_name == M(_SC_LEVEL3_CACHE_SIZE))
|
||||
Index: glibc-2.12-2-gc4ccff1/sysdeps/x86_64/cacheinfo.c
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/sysdeps/x86_64/cacheinfo.c
|
||||
+++ glibc-2.12-2-gc4ccff1/sysdeps/x86_64/cacheinfo.c
|
||||
@@ -181,6 +181,57 @@ intel_check_word (int name, unsigned int
|
||||
/* No need to look further. */
|
||||
break;
|
||||
}
|
||||
+ else if (byte == 0xff)
|
||||
+ {
|
||||
+ /* CPUID leaf 0x4 contains all the information. We need to
|
||||
+ iterate over it. */
|
||||
+ unsigned int eax;
|
||||
+ unsigned int ebx;
|
||||
+ unsigned int ecx;
|
||||
+ unsigned int edx;
|
||||
+
|
||||
+ unsigned int round = 0;
|
||||
+ while (1)
|
||||
+ {
|
||||
+ asm volatile ("xchgl %%ebx, %1; cpuid; xchgl %%ebx, %1"
|
||||
+ : "=a" (eax), "=r" (ebx), "=c" (ecx), "=d" (edx)
|
||||
+ : "0" (4), "2" (round));
|
||||
+
|
||||
+ enum { null = 0, data = 1, inst = 2, uni = 3 } type = eax & 0x1f;
|
||||
+ if (type == null)
|
||||
+ /* That was the end. */
|
||||
+ break;
|
||||
+
|
||||
+ unsigned int level = (eax >> 5) & 0x7;
|
||||
+
|
||||
+ if ((level == 1 && type == data
|
||||
+ && folded_rel_name == M(_SC_LEVEL1_DCACHE_SIZE))
|
||||
+ || (level == 1 && type == inst
|
||||
+ && folded_rel_name == M(_SC_LEVEL1_ICACHE_SIZE))
|
||||
+ || (level == 2 && folded_rel_name == M(_SC_LEVEL2_CACHE_SIZE))
|
||||
+ || (level == 3 && folded_rel_name == M(_SC_LEVEL3_CACHE_SIZE))
|
||||
+ || (level == 4 && folded_rel_name == M(_SC_LEVEL4_CACHE_SIZE)))
|
||||
+ {
|
||||
+ unsigned int offset = M(name) - folded_rel_name;
|
||||
+
|
||||
+ if (offset == 0)
|
||||
+ /* Cache size. */
|
||||
+ return (((ebx >> 22) + 1)
|
||||
+ * (((ebx >> 12) & 0x3ff) + 1)
|
||||
+ * ((ebx & 0xfff) + 1)
|
||||
+ * (ecx + 1));
|
||||
+ if (offset == 1)
|
||||
+ return (ebx >> 22) + 1;
|
||||
+
|
||||
+ assert (offset == 2);
|
||||
+ return (ebx & 0xfff) + 1;
|
||||
+ }
|
||||
+
|
||||
+ ++round;
|
||||
+ }
|
||||
+ /* There is no other cache information anywhere else. */
|
||||
+ break;
|
||||
+ }
|
||||
else
|
||||
{
|
||||
if (byte == 0x49 && folded_rel_name == M(_SC_LEVEL3_CACHE_SIZE))
|
||||
6165
src/patches/glibc/glibc-rh692838.patch
Normal file
6165
src/patches/glibc/glibc-rh692838.patch
Normal file
File diff suppressed because it is too large
Load Diff
86
src/patches/glibc/glibc-rh694386.patch
Normal file
86
src/patches/glibc/glibc-rh694386.patch
Normal file
@@ -0,0 +1,86 @@
|
||||
2011-03-28 Andreas Schwab <schwab@linux-m68k.org>
|
||||
|
||||
* sysdeps/powerpc/powerpc32/power4/strncmp.S: Don't read past
|
||||
differing bytes.
|
||||
* sysdeps/powerpc/powerpc64/power4/strncmp.S: Likewise.
|
||||
|
||||
diff --git a/sysdeps/powerpc/powerpc32/power4/strncmp.S b/sysdeps/powerpc/powerpc32/power4/strncmp.S
|
||||
index fc0835e..f5d47af 100644
|
||||
--- a/sysdeps/powerpc/powerpc32/power4/strncmp.S
|
||||
+++ b/sysdeps/powerpc/powerpc32/power4/strncmp.S
|
||||
@@ -139,30 +139,31 @@ L(u1):
|
||||
bdz L(u4)
|
||||
cmpw rWORD1, rWORD2
|
||||
beq- cr1, L(u4)
|
||||
+ bne- L(u4)
|
||||
lbzu rWORD3, 1(rSTR1)
|
||||
lbzu rWORD4, 1(rSTR2)
|
||||
- bne- L(u4)
|
||||
cmpwi cr1, rWORD3, 0
|
||||
bdz L(u3)
|
||||
cmpw rWORD3, rWORD4
|
||||
beq- cr1, L(u3)
|
||||
+ bne- L(u3)
|
||||
lbzu rWORD1, 1(rSTR1)
|
||||
lbzu rWORD2, 1(rSTR2)
|
||||
- bne- L(u3)
|
||||
cmpwi cr1, rWORD1, 0
|
||||
bdz L(u4)
|
||||
cmpw rWORD1, rWORD2
|
||||
beq- cr1, L(u4)
|
||||
+ bne- L(u4)
|
||||
lbzu rWORD3, 1(rSTR1)
|
||||
lbzu rWORD4, 1(rSTR2)
|
||||
- bne- L(u4)
|
||||
cmpwi cr1, rWORD3, 0
|
||||
bdz L(u3)
|
||||
cmpw rWORD3, rWORD4
|
||||
beq- cr1, L(u3)
|
||||
+ bne- L(u3)
|
||||
lbzu rWORD1, 1(rSTR1)
|
||||
lbzu rWORD2, 1(rSTR2)
|
||||
- beq+ L(u1)
|
||||
+ b L(u1)
|
||||
|
||||
L(u3): sub rRTN, rWORD3, rWORD4
|
||||
blr
|
||||
diff --git a/sysdeps/powerpc/powerpc64/power4/strncmp.S b/sysdeps/powerpc/powerpc64/power4/strncmp.S
|
||||
index 7a1665d..94ae85b 100644
|
||||
--- a/sysdeps/powerpc/powerpc64/power4/strncmp.S
|
||||
+++ b/sysdeps/powerpc/powerpc64/power4/strncmp.S
|
||||
@@ -143,30 +143,31 @@ L(u1):
|
||||
bdz L(u4)
|
||||
cmpd rWORD1, rWORD2
|
||||
beq- cr1, L(u4)
|
||||
+ bne- L(u4)
|
||||
lbzu rWORD3, 1(rSTR1)
|
||||
lbzu rWORD4, 1(rSTR2)
|
||||
- bne- L(u4)
|
||||
cmpdi cr1, rWORD3, 0
|
||||
bdz L(u3)
|
||||
cmpd rWORD3, rWORD4
|
||||
beq- cr1, L(u3)
|
||||
+ bne- L(u3)
|
||||
lbzu rWORD1, 1(rSTR1)
|
||||
lbzu rWORD2, 1(rSTR2)
|
||||
- bne- L(u3)
|
||||
cmpdi cr1, rWORD1, 0
|
||||
bdz L(u4)
|
||||
cmpd rWORD1, rWORD2
|
||||
beq- cr1, L(u4)
|
||||
+ bne- L(u4)
|
||||
lbzu rWORD3, 1(rSTR1)
|
||||
lbzu rWORD4, 1(rSTR2)
|
||||
- bne- L(u4)
|
||||
cmpdi cr1, rWORD3, 0
|
||||
bdz L(u3)
|
||||
cmpd rWORD3, rWORD4
|
||||
beq- cr1, L(u3)
|
||||
+ bne- L(u3)
|
||||
lbzu rWORD1, 1(rSTR1)
|
||||
lbzu rWORD2, 1(rSTR2)
|
||||
- beq+ L(u1)
|
||||
+ b L(u1)
|
||||
|
||||
L(u3): sub rRTN, rWORD3, rWORD4
|
||||
blr
|
||||
17
src/patches/glibc/glibc-rh695595.patch
Normal file
17
src/patches/glibc/glibc-rh695595.patch
Normal file
@@ -0,0 +1,17 @@
|
||||
2010-11-11 H.J. Lu <hongjiu.lu@intel.com>
|
||||
|
||||
* sysdeps/x86_64/multiarch/init-arch.c (__init_cpu_features):
|
||||
Support Intel processor model 6 and model 0x2c.
|
||||
|
||||
Index: glibc-2.12-2-gc4ccff1/sysdeps/x86_64/multiarch/init-arch.c
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/sysdeps/x86_64/multiarch/init-arch.c
|
||||
+++ glibc-2.12-2-gc4ccff1/sysdeps/x86_64/multiarch/init-arch.c
|
||||
@@ -81,6 +81,7 @@ __init_cpu_features (void)
|
||||
case 0x1e:
|
||||
case 0x1f:
|
||||
case 0x25:
|
||||
+ case 0x2c:
|
||||
case 0x2e:
|
||||
case 0x2f:
|
||||
/* Rep string instructions are fast on Intel Core i3, i5
|
||||
1284
src/patches/glibc/glibc-rh695963.patch
Normal file
1284
src/patches/glibc/glibc-rh695963.patch
Normal file
File diff suppressed because it is too large
Load Diff
36
src/patches/glibc/glibc-rh696472.patch
Normal file
36
src/patches/glibc/glibc-rh696472.patch
Normal file
@@ -0,0 +1,36 @@
|
||||
commit 3d29045b5e8329d97693eda8d98f1d1e60b99c8f
|
||||
Author: H.J. Lu <hongjiu.lu@intel.com>
|
||||
Date: Fri Jun 3 07:01:25 2011 -0400
|
||||
|
||||
Assume Intel Core i3/i5/i7 processor if AVX is available
|
||||
|
||||
2011-06-02 H.J. Lu <hongjiu.lu@intel.com>
|
||||
|
||||
* sysdeps/x86_64/multiarch/init-arch.c (__init_cpu_features):
|
||||
Assume Intel Core i3/i5/i7 processor if AVX is available.
|
||||
|
||||
diff --git a/sysdeps/x86_64/multiarch/init-arch.c b/sysdeps/x86_64/multiarch/init-arch.c
|
||||
index 34ec2df..809d105 100644
|
||||
--- a/sysdeps/x86_64/multiarch/init-arch.c
|
||||
+++ b/sysdeps/x86_64/multiarch/init-arch.c
|
||||
@@ -74,6 +74,7 @@ __init_cpu_features (void)
|
||||
}
|
||||
else if (family == 0x06)
|
||||
{
|
||||
+ ecx = __cpu_features.cpuid[COMMON_CPUID_INDEX_1].ecx;
|
||||
model += extended_model;
|
||||
switch (model)
|
||||
{
|
||||
@@ -83,6 +84,12 @@ __init_cpu_features (void)
|
||||
__cpu_features.feature[index_Slow_BSF] |= bit_Slow_BSF;
|
||||
break;
|
||||
|
||||
+ default:
|
||||
+ /* Unknown family 0x06 processors. Assuming this is one
|
||||
+ of Core i3/i5/i7 processors if AVX is available. */
|
||||
+ if ((ecx & bit_AVX) == 0)
|
||||
+ break;
|
||||
+
|
||||
case 0x1a:
|
||||
case 0x1e:
|
||||
case 0x1f:
|
||||
10
src/patches/glibc/glibc-rh697421.patch
Normal file
10
src/patches/glibc/glibc-rh697421.patch
Normal file
@@ -0,0 +1,10 @@
|
||||
diff -rup a/iconvdata/gconv-modules b/iconvdata/gconv-modules
|
||||
--- a/iconvdata/gconv-modules 2010-05-04 05:27:23.000000000 -0600
|
||||
+++ b/iconvdata/gconv-modules 2012-01-26 10:58:24.181895489 -0700
|
||||
@@ -1954,3 +1954,6 @@ alias HPGREEK8// HP-GREEK8//
|
||||
alias OSF10010004// HP-GREEK8//
|
||||
module HP-GREEK8// INTERNAL HP-GREEK8 1
|
||||
module INTERNAL HP-GREEK8// HP-GREEK8 1
|
||||
+
|
||||
+alias ISO-10646-UCS-2// UNICODE//
|
||||
+alias ISO-10646-UCS-2// ISO-10646/UTF8/
|
||||
188
src/patches/glibc/glibc-rh699724.patch
Normal file
188
src/patches/glibc/glibc-rh699724.patch
Normal file
@@ -0,0 +1,188 @@
|
||||
2011-02-23 Andreas Schwab <schwab@redhat.com>
|
||||
|
||||
[BZ #12509]
|
||||
* elf/dl-load.c (_dl_map_object_from_fd): Free realname before
|
||||
returning unsuccessfully.
|
||||
* elf/Makefile ($(objpfx)noload-mem): New rule.
|
||||
(noload-ENV): Define.
|
||||
(tests): Add $(objpfx)noload-mem.
|
||||
* elf/noload.c: Include <memcheck.h>.
|
||||
(main): Call mtrace. Close all opened handles.
|
||||
|
||||
2010-09-27 Andreas Schwab <schwab@redhat.com>
|
||||
|
||||
* include/link.h (struct link_map): Add l_free_initfini.
|
||||
* elf/dl-deps.c (_dl_map_object_deps): Set it when assigning
|
||||
l_initfini.
|
||||
* elf/rtld.c (dl_main): Clear it on all objects loaded on startup.
|
||||
* elf/dl-libc.c (free_mem): Free l_initfini if l_free_initfini is
|
||||
set.
|
||||
|
||||
Index: glibc-2.12-2-gc4ccff1/elf/Makefile
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/elf/Makefile
|
||||
+++ glibc-2.12-2-gc4ccff1/elf/Makefile
|
||||
@@ -211,7 +211,7 @@ endif
|
||||
ifeq (yesyes,$(have-fpie)$(build-shared))
|
||||
tests: $(objpfx)tst-pie1.out
|
||||
endif
|
||||
-tests: $(objpfx)tst-leaks1-mem
|
||||
+tests: $(objpfx)tst-leaks1-mem $(objpfx)noload-mem
|
||||
tlsmod17a-suffixes = 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
|
||||
tlsmod18a-suffixes = 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
|
||||
modules-names = testobj1 testobj2 testobj3 testobj4 testobj5 testobj6 \
|
||||
@@ -664,6 +664,10 @@ $(objpfx)noload: $(objpfx)testobj1.so $(
|
||||
LDFLAGS-noload = -rdynamic
|
||||
$(objpfx)noload.out: $(objpfx)testobj5.so
|
||||
|
||||
+$(objpfx)noload-mem: $(objpfx)noload.out
|
||||
+ $(common-objpfx)malloc/mtrace $(objpfx)noload.mtrace > $@
|
||||
+noload-ENV = MALLOC_TRACE=$(objpfx)noload.mtrace
|
||||
+
|
||||
LDFLAGS-nodelete = -rdynamic
|
||||
LDFLAGS-nodelmod1.so = -Wl,--enable-new-dtags,-z,nodelete
|
||||
LDFLAGS-nodelmod4.so = -Wl,--enable-new-dtags,-z,nodelete
|
||||
Index: glibc-2.12-2-gc4ccff1/elf/dl-deps.c
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/elf/dl-deps.c
|
||||
+++ glibc-2.12-2-gc4ccff1/elf/dl-deps.c
|
||||
@@ -478,6 +478,7 @@ _dl_map_object_deps (struct link_map *ma
|
||||
nneeded * sizeof needed[0]);
|
||||
atomic_write_barrier ();
|
||||
l->l_initfini = l_initfini;
|
||||
+ l->l_free_initfini = 1;
|
||||
}
|
||||
|
||||
/* If we have no auxiliary objects just go on to the next map. */
|
||||
@@ -662,6 +663,7 @@ Filters not supported with LD_TRACE_PREL
|
||||
l_initfini[nlist] = NULL;
|
||||
atomic_write_barrier ();
|
||||
map->l_initfini = l_initfini;
|
||||
+ map->l_free_initfini = 1;
|
||||
if (l_reldeps != NULL)
|
||||
{
|
||||
atomic_write_barrier ();
|
||||
Index: glibc-2.12-2-gc4ccff1/elf/dl-libc.c
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/elf/dl-libc.c
|
||||
+++ glibc-2.12-2-gc4ccff1/elf/dl-libc.c
|
||||
@@ -250,5 +250,9 @@ libc_freeres_fn (free_mem)
|
||||
if (! old->dont_free)
|
||||
free (old);
|
||||
}
|
||||
+
|
||||
+ /* Free the initfini dependency list. */
|
||||
+ if (l->l_free_initfini)
|
||||
+ free (l->l_initfini);
|
||||
}
|
||||
}
|
||||
Index: glibc-2.12-2-gc4ccff1/elf/dl-load.c
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/elf/dl-load.c
|
||||
+++ glibc-2.12-2-gc4ccff1/elf/dl-load.c
|
||||
@@ -907,6 +907,7 @@ _dl_map_object_from_fd (const char *name
|
||||
{
|
||||
/* We are not supposed to load the object unless it is already
|
||||
loaded. So return now. */
|
||||
+ free (realname);
|
||||
__close (fd);
|
||||
return NULL;
|
||||
}
|
||||
@@ -925,6 +926,7 @@ _dl_map_object_from_fd (const char *name
|
||||
_dl_zerofd = _dl_sysdep_open_zero_fill ();
|
||||
if (_dl_zerofd == -1)
|
||||
{
|
||||
+ free (realname);
|
||||
__close (fd);
|
||||
_dl_signal_error (errno, NULL, NULL,
|
||||
N_("cannot open zero fill device"));
|
||||
Index: glibc-2.12-2-gc4ccff1/elf/noload.c
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/elf/noload.c
|
||||
+++ glibc-2.12-2-gc4ccff1/elf/noload.c
|
||||
@@ -1,20 +1,28 @@
|
||||
#include <dlfcn.h>
|
||||
#include <stdio.h>
|
||||
+#include <mcheck.h>
|
||||
|
||||
int
|
||||
main (void)
|
||||
{
|
||||
int result = 0;
|
||||
+ void *p;
|
||||
+
|
||||
+ mtrace ();
|
||||
|
||||
/* First try to load an object which is a dependency. This should
|
||||
succeed. */
|
||||
- if (dlopen ("testobj1.so", RTLD_LAZY | RTLD_NOLOAD) == NULL)
|
||||
+ p = dlopen ("testobj1.so", RTLD_LAZY | RTLD_NOLOAD);
|
||||
+ if (p == NULL)
|
||||
{
|
||||
printf ("cannot open \"testobj1.so\": %s\n", dlerror ());
|
||||
result = 1;
|
||||
}
|
||||
else
|
||||
- puts ("loading \"testobj1.so\" succeeded, OK");
|
||||
+ {
|
||||
+ puts ("loading \"testobj1.so\" succeeded, OK");
|
||||
+ dlclose (p);
|
||||
+ }
|
||||
|
||||
/* Now try loading an object which is not already loaded. */
|
||||
if (dlopen ("testobj5.so", RTLD_LAZY | RTLD_NOLOAD) != NULL)
|
||||
@@ -25,8 +33,6 @@ main (void)
|
||||
else
|
||||
{
|
||||
/* Load the object and run the same test again. */
|
||||
- void *p;
|
||||
-
|
||||
puts ("\"testobj5.so\" wasn't loaded and RTLD_NOLOAD prevented it, OK");
|
||||
|
||||
p = dlopen ("testobj5.so", RTLD_LAZY);
|
||||
@@ -41,13 +47,17 @@ main (void)
|
||||
{
|
||||
puts ("loading \"testobj5.so\" succeeded, OK");
|
||||
|
||||
- if (dlopen ("testobj5.so", RTLD_LAZY | RTLD_NOLOAD) == NULL)
|
||||
+ void *q = dlopen ("testobj5.so", RTLD_LAZY | RTLD_NOLOAD);
|
||||
+ if (q == NULL)
|
||||
{
|
||||
printf ("cannot open \"testobj5.so\": %s\n", dlerror ());
|
||||
result = 1;
|
||||
}
|
||||
else
|
||||
- puts ("loading \"testobj5.so\" with RTLD_NOLOAD succeeded, OK");
|
||||
+ {
|
||||
+ puts ("loading \"testobj5.so\" with RTLD_NOLOAD succeeded, OK");
|
||||
+ dlclose (q);
|
||||
+ }
|
||||
|
||||
if (dlclose (p) != 0)
|
||||
{
|
||||
Index: glibc-2.12-2-gc4ccff1/elf/rtld.c
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/elf/rtld.c
|
||||
+++ glibc-2.12-2-gc4ccff1/elf/rtld.c
|
||||
@@ -2249,6 +2249,7 @@ ERROR: ld.so: object '%s' cannot be load
|
||||
lnp->dont_free = 1;
|
||||
lnp = lnp->next;
|
||||
}
|
||||
+ l->l_free_initfini = 0;
|
||||
|
||||
if (l != &GL(dl_rtld_map))
|
||||
_dl_relocate_object (l, l->l_scope, GLRO(dl_lazy) ? RTLD_LAZY : 0,
|
||||
Index: glibc-2.12-2-gc4ccff1/include/link.h
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/include/link.h
|
||||
+++ glibc-2.12-2-gc4ccff1/include/link.h
|
||||
@@ -192,6 +192,9 @@ struct link_map
|
||||
during LD_TRACE_PRELINKING=1
|
||||
contains any DT_SYMBOLIC
|
||||
libraries. */
|
||||
+ unsigned int l_free_initfini:1; /* Nonzero if l_initfini can be
|
||||
+ freed, ie. not allocated with
|
||||
+ the dummy malloc in ld.so. */
|
||||
|
||||
/* Collected information about own RPATH directories. */
|
||||
struct r_search_path_struct l_rpath_dirs;
|
||||
26
src/patches/glibc/glibc-rh700507.patch
Normal file
26
src/patches/glibc/glibc-rh700507.patch
Normal file
@@ -0,0 +1,26 @@
|
||||
Index: glibc-2.12-2-gc4ccff1/nscd/nscd.c
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/nscd/nscd.c
|
||||
+++ glibc-2.12-2-gc4ccff1/nscd/nscd.c
|
||||
@@ -260,10 +260,6 @@ main (int argc, char **argv)
|
||||
/* In foreground mode we are not paranoid. */
|
||||
paranoia = 0;
|
||||
|
||||
- /* Start the SELinux AVC. */
|
||||
- if (selinux_enabled)
|
||||
- nscd_avc_init ();
|
||||
-
|
||||
signal (SIGINT, termination_handler);
|
||||
signal (SIGQUIT, termination_handler);
|
||||
signal (SIGTERM, termination_handler);
|
||||
@@ -278,6 +274,10 @@ main (int argc, char **argv)
|
||||
/* Init databases. */
|
||||
nscd_init ();
|
||||
|
||||
+ /* Start the SELinux AVC. */
|
||||
+ if (selinux_enabled)
|
||||
+ nscd_avc_init ();
|
||||
+
|
||||
/* Handle incoming requests */
|
||||
start_threads ();
|
||||
|
||||
68
src/patches/glibc/glibc-rh703480.patch
Normal file
68
src/patches/glibc/glibc-rh703480.patch
Normal file
@@ -0,0 +1,68 @@
|
||||
2011-01-15 Ulrich Drepper <drepper@gmail.com>
|
||||
|
||||
[BZ #6812]
|
||||
* nscd/hstcache.c (tryagain): Define.
|
||||
(cache_addhst): Return tryagain not notfound for temporary errors.
|
||||
(addhstbyX): Also set h_errno to TRY_AGAIN when memory allocation
|
||||
failed.
|
||||
|
||||
Index: glibc-2.12-2-gc4ccff1/nscd/hstcache.c
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/nscd/hstcache.c
|
||||
+++ glibc-2.12-2-gc4ccff1/nscd/hstcache.c
|
||||
@@ -77,6 +77,20 @@ static const hst_response_header notfoun
|
||||
};
|
||||
|
||||
|
||||
+/* This is the standard reply in case there are temporary problems. */
|
||||
+static const hst_response_header tryagain =
|
||||
+{
|
||||
+ .version = NSCD_VERSION,
|
||||
+ .found = 0,
|
||||
+ .h_name_len = 0,
|
||||
+ .h_aliases_cnt = 0,
|
||||
+ .h_addrtype = -1,
|
||||
+ .h_length = -1,
|
||||
+ .h_addr_list_cnt = 0,
|
||||
+ .error = TRY_AGAIN
|
||||
+};
|
||||
+
|
||||
+
|
||||
static void
|
||||
cache_addhst (struct database_dyn *db, int fd, request_header *req,
|
||||
const void *key, struct hostent *hst, uid_t owner,
|
||||
@@ -111,11 +125,15 @@ cache_addhst (struct database_dyn *db, i
|
||||
else
|
||||
{
|
||||
/* We have no data. This means we send the standard reply for this
|
||||
- case. */
|
||||
+ case. Possibly this is only temporary. */
|
||||
ssize_t total = sizeof (notfound);
|
||||
+ assert (sizeof (notfound) == sizeof (tryagain));
|
||||
+
|
||||
+ const hst_response_header *resp = (errval == EAGAIN
|
||||
+ ? &tryagain : ¬found);
|
||||
|
||||
if (fd != -1 &&
|
||||
- TEMP_FAILURE_RETRY (send (fd, ¬found, total,
|
||||
+ TEMP_FAILURE_RETRY (send (fd, resp, total,
|
||||
MSG_NOSIGNAL)) != total)
|
||||
all_written = false;
|
||||
|
||||
@@ -135,7 +153,7 @@ cache_addhst (struct database_dyn *db, i
|
||||
? db->negtimeout : ttl);
|
||||
|
||||
/* This is the reply. */
|
||||
- memcpy (&dataset->resp, ¬found, total);
|
||||
+ memcpy (&dataset->resp, resp, total);
|
||||
|
||||
/* Copy the key data. */
|
||||
memcpy (dataset->strdata, key, req->key_len);
|
||||
@@ -490,6 +508,7 @@ addhstbyX (struct database_dyn *db, int
|
||||
/* We set the error to indicate this is (possibly) a
|
||||
temporary error and that it does not mean the entry
|
||||
is not available at all. */
|
||||
+ h_errno = TRY_AGAIN;
|
||||
errval = EAGAIN;
|
||||
break;
|
||||
}
|
||||
875
src/patches/glibc/glibc-rh703481.patch
Normal file
875
src/patches/glibc/glibc-rh703481.patch
Normal file
@@ -0,0 +1,875 @@
|
||||
2011-02-05 Ulrich Drepper <drepper@gmail.com>
|
||||
|
||||
* nscd/nscd-client.h: Define MAX_TIMEOUT_VALUE.
|
||||
(struct datahead): Reuse 32 bits of the alignment for a TTL field.
|
||||
* nscd/aicache.c (addhstaiX): Return timeout of added value.
|
||||
(readdhstai): Return value of addhstaiX call.
|
||||
* nscd/grpcache.c (cache_addgr): Return timeout of added value.
|
||||
(addgrbyX): Return value returned by cache_addgr.
|
||||
(readdgrbyname): Return value returned by addgrbyX.
|
||||
(readdgrbygid): Likewise.
|
||||
* nscd/pwdcache.c (cache_addpw): Return timeout of added value.
|
||||
(addpwbyX): Return value returned by cache_addpw.
|
||||
(readdpwbyname): Return value returned by addhstbyX.
|
||||
(readdpwbyuid): Likewise.
|
||||
* nscd/servicescache.c (cache_addserv): Return timeout of added value.
|
||||
(addservbyX): Return value returned by cache_addserv.
|
||||
(readdservbyname): Return value returned by addservbyX:
|
||||
(readdservbyport): Likewise.
|
||||
* nscd/hstcache.c (cache_addhst): Return timeout of added value.
|
||||
(addhstbyX): Return value returned by cache_addhst.
|
||||
(readdhstbyname): Return value returned by addhstbyX.
|
||||
(readdhstbyaddr): Likewise.
|
||||
(readdhstbynamev6): Likewise.
|
||||
(readdhstbyaddrv6): Likewise.
|
||||
* nscd/initgrcache.c (addinitgroupsX): Return timeout of added value.
|
||||
(readdinitgroups): Return value returned by addinitgroupsX.
|
||||
* nscd/cache.c (readdfcts): Change return value of functions to time_t.
|
||||
(prune_cache): Keep track of timeout value of re-added entries.
|
||||
* nscd/connections.c (nscd_run_prune): Use MAX_TIMEOUT_VALUE.
|
||||
* nscd/nscd.h: Adjust prototypes of readd* functions.
|
||||
|
||||
Index: glibc-2.12-2-gc4ccff1/nscd/aicache.c
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/nscd/aicache.c
|
||||
+++ glibc-2.12-2-gc4ccff1/nscd/aicache.c
|
||||
@@ -58,7 +58,7 @@ static const ai_response_header notfound
|
||||
};
|
||||
|
||||
|
||||
-static void
|
||||
+static time_t
|
||||
addhstaiX (struct database_dyn *db, int fd, request_header *req,
|
||||
void *key, uid_t uid, struct hashentry *const he,
|
||||
struct datahead *dh)
|
||||
@@ -119,6 +119,7 @@ addhstaiX (struct database_dyn *db, int
|
||||
ssize_t total = 0;
|
||||
char *key_copy = NULL;
|
||||
bool alloca_used = false;
|
||||
+ time_t timeout = MAX_TIMEOUT_VALUE;
|
||||
|
||||
while (!no_more)
|
||||
{
|
||||
@@ -388,8 +389,8 @@ addhstaiX (struct database_dyn *db, int
|
||||
dataset->head.usable = true;
|
||||
|
||||
/* Compute the timeout time. */
|
||||
- dataset->head.timeout = time (NULL) + (ttl == INT32_MAX
|
||||
- ? db->postimeout : ttl);
|
||||
+ dataset->head.ttl = ttl == INT32_MAX ? db->postimeout : ttl;
|
||||
+ timeout = dataset->head.timeout = time (NULL) + dataset->head.ttl;
|
||||
|
||||
dataset->resp.version = NSCD_VERSION;
|
||||
dataset->resp.found = 1;
|
||||
@@ -421,6 +422,7 @@ addhstaiX (struct database_dyn *db, int
|
||||
timeout value. Note that the new record has been
|
||||
allocated on the stack and need not be freed. */
|
||||
dh->timeout = dataset->head.timeout;
|
||||
+ dh->ttl = dataset->head.ttl;
|
||||
++dh->nreloads;
|
||||
}
|
||||
else
|
||||
@@ -496,6 +498,9 @@ next_nip:
|
||||
if (reload_count != UINT_MAX && dh->nreloads == reload_count)
|
||||
/* Do not reset the value if we never not reload the record. */
|
||||
dh->nreloads = reload_count - 1;
|
||||
+
|
||||
+ /* Reload with the same time-to-live value. */
|
||||
+ timeout = dh->timeout = time (NULL) + dh->ttl;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -517,7 +522,8 @@ next_nip:
|
||||
dataset->head.usable = true;
|
||||
|
||||
/* Compute the timeout time. */
|
||||
- dataset->head.timeout = time (NULL) + db->negtimeout;
|
||||
+ timeout = dataset->head.timeout = time (NULL) + db->negtimeout;
|
||||
+ dataset->head.ttl = db->negtimeout;
|
||||
|
||||
/* This is the reply. */
|
||||
memcpy (&dataset->resp, ¬found, total);
|
||||
@@ -551,6 +557,8 @@ next_nip:
|
||||
if (dh != NULL)
|
||||
dh->usable = false;
|
||||
}
|
||||
+
|
||||
+ return timeout;
|
||||
}
|
||||
|
||||
|
||||
@@ -562,7 +570,7 @@ addhstai (struct database_dyn *db, int f
|
||||
}
|
||||
|
||||
|
||||
-void
|
||||
+time_t
|
||||
readdhstai (struct database_dyn *db, struct hashentry *he, struct datahead *dh)
|
||||
{
|
||||
request_header req =
|
||||
@@ -571,5 +579,5 @@ readdhstai (struct database_dyn *db, str
|
||||
.key_len = he->len
|
||||
};
|
||||
|
||||
- addhstaiX (db, -1, &req, db->data + he->key, he->owner, he, dh);
|
||||
+ return addhstaiX (db, -1, &req, db->data + he->key, he->owner, he, dh);
|
||||
}
|
||||
Index: glibc-2.12-2-gc4ccff1/nscd/cache.c
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/nscd/cache.c
|
||||
+++ glibc-2.12-2-gc4ccff1/nscd/cache.c
|
||||
@@ -45,9 +45,9 @@ extern void *xcalloc (size_t n, size_t s
|
||||
unsigned int reload_count = DEFAULT_RELOAD_LIMIT;
|
||||
|
||||
|
||||
-static void (*const readdfcts[LASTREQ]) (struct database_dyn *,
|
||||
- struct hashentry *,
|
||||
- struct datahead *) =
|
||||
+static time_t (*const readdfcts[LASTREQ]) (struct database_dyn *,
|
||||
+ struct hashentry *,
|
||||
+ struct datahead *) =
|
||||
{
|
||||
[GETPWBYNAME] = readdpwbyname,
|
||||
[GETPWBYUID] = readdpwbyuid,
|
||||
@@ -389,7 +389,8 @@ prune_cache (struct database_dyn *table,
|
||||
assert (runp->type < LASTREQ
|
||||
&& readdfcts[runp->type] != NULL);
|
||||
|
||||
- readdfcts[runp->type] (table, runp, dh);
|
||||
+ time_t timeout = readdfcts[runp->type] (table, runp, dh);
|
||||
+ next_timeout = MIN (next_timeout, timeout);
|
||||
|
||||
/* If the entry has been replaced, we might need
|
||||
cleanup. */
|
||||
Index: glibc-2.12-2-gc4ccff1/nscd/connections.c
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/nscd/connections.c
|
||||
+++ glibc-2.12-2-gc4ccff1/nscd/connections.c
|
||||
@@ -1533,10 +1533,7 @@ nscd_run_prune (void *p)
|
||||
pruning we want to know about it. Therefore set the
|
||||
timeout to the maximum. It will be descreased when adding
|
||||
new entries to the cache, if necessary. */
|
||||
- if (sizeof (time_t) == sizeof (long int))
|
||||
- dbs[my_number].wakeup_time = LONG_MAX;
|
||||
- else
|
||||
- dbs[my_number].wakeup_time = INT_MAX;
|
||||
+ dbs[my_number].wakeup_time = MAX_TIMEOUT_VALUE;
|
||||
|
||||
/* Unconditionally reset the flag. */
|
||||
time_t prune_now = dbs[my_number].clear_cache ? LONG_MAX : now;
|
||||
Index: glibc-2.12-2-gc4ccff1/nscd/grpcache.c
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/nscd/grpcache.c
|
||||
+++ glibc-2.12-2-gc4ccff1/nscd/grpcache.c
|
||||
@@ -71,7 +71,7 @@ static const gr_response_header notfound
|
||||
};
|
||||
|
||||
|
||||
-static void
|
||||
+static time_t
|
||||
cache_addgr (struct database_dyn *db, int fd, request_header *req,
|
||||
const void *key, struct group *grp, uid_t owner,
|
||||
struct hashentry *const he, struct datahead *dh, int errval)
|
||||
@@ -91,6 +91,7 @@ cache_addgr (struct database_dyn *db, in
|
||||
|
||||
assert (offsetof (struct dataset, resp) == offsetof (struct datahead, data));
|
||||
|
||||
+ time_t timeout = MAX_TIMEOUT_VALUE;
|
||||
if (grp == NULL)
|
||||
{
|
||||
if (he != NULL && errval == EAGAIN)
|
||||
@@ -102,6 +103,9 @@ cache_addgr (struct database_dyn *db, in
|
||||
/* Do not reset the value if we never not reload the record. */
|
||||
dh->nreloads = reload_count - 1;
|
||||
|
||||
+ /* Reload with the same time-to-live value. */
|
||||
+ timeout = dh->timeout = t + db->postimeout;
|
||||
+
|
||||
written = total = 0;
|
||||
}
|
||||
else
|
||||
@@ -125,7 +129,7 @@ cache_addgr (struct database_dyn *db, in
|
||||
dataset->head.usable = true;
|
||||
|
||||
/* Compute the timeout time. */
|
||||
- dataset->head.timeout = t + db->negtimeout;
|
||||
+ timeout = dataset->head.timeout = t + db->negtimeout;
|
||||
|
||||
/* This is the reply. */
|
||||
memcpy (&dataset->resp, ¬found, total);
|
||||
@@ -217,7 +221,7 @@ cache_addgr (struct database_dyn *db, in
|
||||
dataset->head.usable = true;
|
||||
|
||||
/* Compute the timeout time. */
|
||||
- dataset->head.timeout = t + db->postimeout;
|
||||
+ timeout = dataset->head.timeout = t + db->postimeout;
|
||||
|
||||
dataset->resp.version = NSCD_VERSION;
|
||||
dataset->resp.found = 1;
|
||||
@@ -379,6 +383,8 @@ cache_addgr (struct database_dyn *db, in
|
||||
dbg_log (_("short write in %s: %s"), __FUNCTION__,
|
||||
strerror_r (errno, buf, sizeof (buf)));
|
||||
}
|
||||
+
|
||||
+ return timeout;
|
||||
}
|
||||
|
||||
|
||||
@@ -400,7 +406,7 @@ lookup (int type, union keytype key, str
|
||||
}
|
||||
|
||||
|
||||
-static void
|
||||
+static time_t
|
||||
addgrbyX (struct database_dyn *db, int fd, request_header *req,
|
||||
union keytype key, const char *keystr, uid_t uid,
|
||||
struct hashentry *he, struct datahead *dh)
|
||||
@@ -456,10 +462,12 @@ addgrbyX (struct database_dyn *db, int f
|
||||
buffer = (char *) extend_alloca (buffer, buflen, 2 * buflen);
|
||||
}
|
||||
|
||||
- cache_addgr (db, fd, req, keystr, grp, uid, he, dh, errval);
|
||||
+ time_t timeout = cache_addgr (db, fd, req, keystr, grp, uid, he, dh, errval);
|
||||
|
||||
if (use_malloc)
|
||||
free (buffer);
|
||||
+
|
||||
+ return timeout;
|
||||
}
|
||||
|
||||
|
||||
@@ -473,7 +481,7 @@ addgrbyname (struct database_dyn *db, in
|
||||
}
|
||||
|
||||
|
||||
-void
|
||||
+time_t
|
||||
readdgrbyname (struct database_dyn *db, struct hashentry *he,
|
||||
struct datahead *dh)
|
||||
{
|
||||
@@ -484,7 +492,7 @@ readdgrbyname (struct database_dyn *db,
|
||||
};
|
||||
union keytype u = { .v = db->data + he->key };
|
||||
|
||||
- addgrbyX (db, -1, &req, u, db->data + he->key, he->owner, he, dh);
|
||||
+ return addgrbyX (db, -1, &req, u, db->data + he->key, he->owner, he, dh);
|
||||
}
|
||||
|
||||
|
||||
@@ -510,7 +518,7 @@ addgrbygid (struct database_dyn *db, int
|
||||
}
|
||||
|
||||
|
||||
-void
|
||||
+time_t
|
||||
readdgrbygid (struct database_dyn *db, struct hashentry *he,
|
||||
struct datahead *dh)
|
||||
{
|
||||
@@ -527,5 +535,5 @@ readdgrbygid (struct database_dyn *db, s
|
||||
};
|
||||
union keytype u = { .g = gid };
|
||||
|
||||
- addgrbyX (db, -1, &req, u, db->data + he->key, he->owner, he, dh);
|
||||
+ return addgrbyX (db, -1, &req, u, db->data + he->key, he->owner, he, dh);
|
||||
}
|
||||
Index: glibc-2.12-2-gc4ccff1/nscd/hstcache.c
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/nscd/hstcache.c
|
||||
+++ glibc-2.12-2-gc4ccff1/nscd/hstcache.c
|
||||
@@ -91,7 +91,7 @@ static const hst_response_header tryagai
|
||||
};
|
||||
|
||||
|
||||
-static void
|
||||
+static time_t
|
||||
cache_addhst (struct database_dyn *db, int fd, request_header *req,
|
||||
const void *key, struct hostent *hst, uid_t owner,
|
||||
struct hashentry *const he, struct datahead *dh, int errval,
|
||||
@@ -111,6 +111,7 @@ cache_addhst (struct database_dyn *db, i
|
||||
|
||||
assert (offsetof (struct dataset, resp) == offsetof (struct datahead, data));
|
||||
|
||||
+ time_t timeout = MAX_TIMEOUT_VALUE;
|
||||
if (hst == NULL)
|
||||
{
|
||||
if (he != NULL && errval == EAGAIN)
|
||||
@@ -121,6 +122,9 @@ cache_addhst (struct database_dyn *db, i
|
||||
if (reload_count != UINT_MAX)
|
||||
/* Do not reset the value if we never not reload the record. */
|
||||
dh->nreloads = reload_count - 1;
|
||||
+
|
||||
+ /* Reload with the same time-to-live value. */
|
||||
+ timeout = dh->timeout = t + dh->ttl;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -149,8 +153,8 @@ cache_addhst (struct database_dyn *db, i
|
||||
dataset->head.usable = true;
|
||||
|
||||
/* Compute the timeout time. */
|
||||
- dataset->head.timeout = t + (ttl == INT32_MAX
|
||||
- ? db->negtimeout : ttl);
|
||||
+ dataset->head.ttl = ttl == INT32_MAX ? db->negtimeout : ttl;
|
||||
+ timeout = dataset->head.timeout = t + dataset->head.ttl;
|
||||
|
||||
/* This is the reply. */
|
||||
memcpy (&dataset->resp, resp, total);
|
||||
@@ -214,7 +218,7 @@ cache_addhst (struct database_dyn *db, i
|
||||
|
||||
if (h_addr_list_cnt == 0)
|
||||
/* Invalid entry. */
|
||||
- return;
|
||||
+ return MAX_TIMEOUT_VALUE;
|
||||
|
||||
total += (sizeof (struct dataset)
|
||||
+ h_name_len
|
||||
@@ -255,7 +259,8 @@ cache_addhst (struct database_dyn *db, i
|
||||
dataset->head.usable = true;
|
||||
|
||||
/* Compute the timeout time. */
|
||||
- dataset->head.timeout = t + (ttl == INT32_MAX ? db->postimeout : ttl);
|
||||
+ dataset->head.ttl = ttl == INT32_MAX ? db->postimeout : ttl;
|
||||
+ timeout = dataset->head.timeout = t + dataset->head.ttl;
|
||||
|
||||
dataset->resp.version = NSCD_VERSION;
|
||||
dataset->resp.found = 1;
|
||||
@@ -312,6 +317,7 @@ cache_addhst (struct database_dyn *db, i
|
||||
timeout value. Note that the new record has been
|
||||
allocated on the stack and need not be freed. */
|
||||
assert (h_addr_list_cnt == 1);
|
||||
+ dh->ttl = dataset->head.ttl;
|
||||
dh->timeout = dataset->head.timeout;
|
||||
++dh->nreloads;
|
||||
}
|
||||
@@ -433,6 +439,8 @@ cache_addhst (struct database_dyn *db, i
|
||||
dbg_log (_("short write in %s: %s"), __FUNCTION__,
|
||||
strerror_r (errno, buf, sizeof (buf)));
|
||||
}
|
||||
+
|
||||
+ return timeout;
|
||||
}
|
||||
|
||||
|
||||
@@ -454,7 +462,7 @@ lookup (int type, void *key, struct host
|
||||
}
|
||||
|
||||
|
||||
-static void
|
||||
+static time_t
|
||||
addhstbyX (struct database_dyn *db, int fd, request_header *req,
|
||||
void *key, uid_t uid, struct hashentry *he, struct datahead *dh)
|
||||
{
|
||||
@@ -520,11 +528,13 @@ addhstbyX (struct database_dyn *db, int
|
||||
buffer = (char *) extend_alloca (buffer, buflen, 2 * buflen);
|
||||
}
|
||||
|
||||
- cache_addhst (db, fd, req, key, hst, uid, he, dh,
|
||||
- h_errno == TRY_AGAIN ? errval : 0, ttl);
|
||||
+ time_t timeout = cache_addhst (db, fd, req, key, hst, uid, he, dh,
|
||||
+ h_errno == TRY_AGAIN ? errval : 0, ttl);
|
||||
|
||||
if (use_malloc)
|
||||
free (buffer);
|
||||
+
|
||||
+ return timeout;
|
||||
}
|
||||
|
||||
|
||||
@@ -536,7 +546,7 @@ addhstbyname (struct database_dyn *db, i
|
||||
}
|
||||
|
||||
|
||||
-void
|
||||
+time_t
|
||||
readdhstbyname (struct database_dyn *db, struct hashentry *he,
|
||||
struct datahead *dh)
|
||||
{
|
||||
@@ -546,7 +556,7 @@ readdhstbyname (struct database_dyn *db,
|
||||
.key_len = he->len
|
||||
};
|
||||
|
||||
- addhstbyX (db, -1, &req, db->data + he->key, he->owner, he, dh);
|
||||
+ return addhstbyX (db, -1, &req, db->data + he->key, he->owner, he, dh);
|
||||
}
|
||||
|
||||
|
||||
@@ -558,7 +568,7 @@ addhstbyaddr (struct database_dyn *db, i
|
||||
}
|
||||
|
||||
|
||||
-void
|
||||
+time_t
|
||||
readdhstbyaddr (struct database_dyn *db, struct hashentry *he,
|
||||
struct datahead *dh)
|
||||
{
|
||||
@@ -568,7 +578,7 @@ readdhstbyaddr (struct database_dyn *db,
|
||||
.key_len = he->len
|
||||
};
|
||||
|
||||
- addhstbyX (db, -1, &req, db->data + he->key, he->owner, he, dh);
|
||||
+ return addhstbyX (db, -1, &req, db->data + he->key, he->owner, he, dh);
|
||||
}
|
||||
|
||||
|
||||
@@ -580,7 +590,7 @@ addhstbynamev6 (struct database_dyn *db,
|
||||
}
|
||||
|
||||
|
||||
-void
|
||||
+time_t
|
||||
readdhstbynamev6 (struct database_dyn *db, struct hashentry *he,
|
||||
struct datahead *dh)
|
||||
{
|
||||
@@ -590,7 +600,7 @@ readdhstbynamev6 (struct database_dyn *d
|
||||
.key_len = he->len
|
||||
};
|
||||
|
||||
- addhstbyX (db, -1, &req, db->data + he->key, he->owner, he, dh);
|
||||
+ return addhstbyX (db, -1, &req, db->data + he->key, he->owner, he, dh);
|
||||
}
|
||||
|
||||
|
||||
@@ -602,7 +612,7 @@ addhstbyaddrv6 (struct database_dyn *db,
|
||||
}
|
||||
|
||||
|
||||
-void
|
||||
+time_t
|
||||
readdhstbyaddrv6 (struct database_dyn *db, struct hashentry *he,
|
||||
struct datahead *dh)
|
||||
{
|
||||
@@ -612,5 +622,5 @@ readdhstbyaddrv6 (struct database_dyn *d
|
||||
.key_len = he->len
|
||||
};
|
||||
|
||||
- addhstbyX (db, -1, &req, db->data + he->key, he->owner, he, dh);
|
||||
+ return addhstbyX (db, -1, &req, db->data + he->key, he->owner, he, dh);
|
||||
}
|
||||
Index: glibc-2.12-2-gc4ccff1/nscd/initgrcache.c
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/nscd/initgrcache.c
|
||||
+++ glibc-2.12-2-gc4ccff1/nscd/initgrcache.c
|
||||
@@ -52,7 +52,7 @@ static const initgr_response_header notf
|
||||
#include "../grp/compat-initgroups.c"
|
||||
|
||||
|
||||
-static void
|
||||
+static time_t
|
||||
addinitgroupsX (struct database_dyn *db, int fd, request_header *req,
|
||||
void *key, uid_t uid, struct hashentry *const he,
|
||||
struct datahead *dh)
|
||||
@@ -174,7 +174,9 @@ addinitgroupsX (struct database_dyn *db,
|
||||
|
||||
ssize_t total;
|
||||
ssize_t written;
|
||||
+ time_t timeout;
|
||||
out:
|
||||
+ timeout = MAX_TIMEOUT_VALUE;
|
||||
if (!any_success)
|
||||
{
|
||||
/* Nothing found. Create a negative result record. */
|
||||
@@ -188,6 +190,9 @@ addinitgroupsX (struct database_dyn *db,
|
||||
if (reload_count != UINT_MAX && dh->nreloads == reload_count)
|
||||
/* Do not reset the value if we never not reload the record. */
|
||||
dh->nreloads = reload_count - 1;
|
||||
+
|
||||
+ /* Reload with the same time-to-live value. */
|
||||
+ timeout = dh->timeout = time (NULL) + db->postimeout;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -209,7 +214,7 @@ addinitgroupsX (struct database_dyn *db,
|
||||
dataset->head.usable = true;
|
||||
|
||||
/* Compute the timeout time. */
|
||||
- dataset->head.timeout = time (NULL) + db->negtimeout;
|
||||
+ timeout = dataset->head.timeout = time (NULL) + db->negtimeout;
|
||||
|
||||
/* This is the reply. */
|
||||
memcpy (&dataset->resp, ¬found, total);
|
||||
@@ -273,7 +278,7 @@ addinitgroupsX (struct database_dyn *db,
|
||||
dataset->head.usable = true;
|
||||
|
||||
/* Compute the timeout time. */
|
||||
- dataset->head.timeout = time (NULL) + db->postimeout;
|
||||
+ timeout = dataset->head.timeout = time (NULL) + db->postimeout;
|
||||
|
||||
dataset->resp.version = NSCD_VERSION;
|
||||
dataset->resp.found = 1;
|
||||
@@ -401,6 +406,8 @@ addinitgroupsX (struct database_dyn *db,
|
||||
dbg_log (_("short write in %s: %s"), __FUNCTION__,
|
||||
strerror_r (errno, buf, sizeof (buf)));
|
||||
}
|
||||
+
|
||||
+ return timeout;
|
||||
}
|
||||
|
||||
|
||||
@@ -412,7 +419,7 @@ addinitgroups (struct database_dyn *db,
|
||||
}
|
||||
|
||||
|
||||
-void
|
||||
+time_t
|
||||
readdinitgroups (struct database_dyn *db, struct hashentry *he,
|
||||
struct datahead *dh)
|
||||
{
|
||||
@@ -422,5 +429,5 @@ readdinitgroups (struct database_dyn *db
|
||||
.key_len = he->len
|
||||
};
|
||||
|
||||
- addinitgroupsX (db, -1, &req, db->data + he->key, he->owner, he, dh);
|
||||
+ return addinitgroupsX (db, -1, &req, db->data + he->key, he->owner, he, dh);
|
||||
}
|
||||
Index: glibc-2.12-2-gc4ccff1/nscd/nscd-client.h
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/nscd/nscd-client.h
|
||||
+++ glibc-2.12-2-gc4ccff1/nscd/nscd-client.h
|
||||
@@ -179,6 +179,10 @@ typedef uint32_t ref_t;
|
||||
/* Timestamp type. */
|
||||
typedef uint64_t nscd_time_t;
|
||||
|
||||
+/* Maximum timestamp. */
|
||||
+#define MAX_TIMEOUT_VALUE \
|
||||
+ (sizeof (time_t) == sizeof (long int) ? LONG_MAX : INT_MAX)
|
||||
+
|
||||
/* Alignment requirement of the beginning of the data region. */
|
||||
#define ALIGN 16
|
||||
|
||||
@@ -192,7 +196,8 @@ struct datahead
|
||||
uint8_t notfound; /* Nonzero if data has not been found. */
|
||||
uint8_t nreloads; /* Reloads without use. */
|
||||
uint8_t usable; /* False if the entry must be ignored. */
|
||||
- uint64_t :40; /* Alignment. */
|
||||
+ uint8_t unused; /* Unused. */
|
||||
+ uint32_t ttl; /* TTL value used. */
|
||||
|
||||
/* We need to have the following element aligned for the response
|
||||
header data types and their use in the 'struct dataset' types
|
||||
Index: glibc-2.12-2-gc4ccff1/nscd/nscd.h
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/nscd/nscd.h
|
||||
+++ glibc-2.12-2-gc4ccff1/nscd/nscd.h
|
||||
@@ -217,20 +217,20 @@ extern void addpwbyname (struct database
|
||||
void *key, uid_t uid);
|
||||
extern void addpwbyuid (struct database_dyn *db, int fd, request_header *req,
|
||||
void *key, uid_t uid);
|
||||
-extern void readdpwbyname (struct database_dyn *db, struct hashentry *he,
|
||||
- struct datahead *dh);
|
||||
-extern void readdpwbyuid (struct database_dyn *db, struct hashentry *he,
|
||||
- struct datahead *dh);
|
||||
+extern time_t readdpwbyname (struct database_dyn *db, struct hashentry *he,
|
||||
+ struct datahead *dh);
|
||||
+extern time_t readdpwbyuid (struct database_dyn *db, struct hashentry *he,
|
||||
+ struct datahead *dh);
|
||||
|
||||
/* grpcache.c */
|
||||
extern void addgrbyname (struct database_dyn *db, int fd, request_header *req,
|
||||
void *key, uid_t uid);
|
||||
extern void addgrbygid (struct database_dyn *db, int fd, request_header *req,
|
||||
void *key, uid_t uid);
|
||||
-extern void readdgrbyname (struct database_dyn *db, struct hashentry *he,
|
||||
- struct datahead *dh);
|
||||
-extern void readdgrbygid (struct database_dyn *db, struct hashentry *he,
|
||||
- struct datahead *dh);
|
||||
+extern time_t readdgrbyname (struct database_dyn *db, struct hashentry *he,
|
||||
+ struct datahead *dh);
|
||||
+extern time_t readdgrbygid (struct database_dyn *db, struct hashentry *he,
|
||||
+ struct datahead *dh);
|
||||
|
||||
/* hstcache.c */
|
||||
extern void addhstbyname (struct database_dyn *db, int fd, request_header *req,
|
||||
@@ -241,37 +241,37 @@ extern void addhstbynamev6 (struct datab
|
||||
request_header *req, void *key, uid_t uid);
|
||||
extern void addhstbyaddrv6 (struct database_dyn *db, int fd,
|
||||
request_header *req, void *key, uid_t uid);
|
||||
-extern void readdhstbyname (struct database_dyn *db, struct hashentry *he,
|
||||
- struct datahead *dh);
|
||||
-extern void readdhstbyaddr (struct database_dyn *db, struct hashentry *he,
|
||||
- struct datahead *dh);
|
||||
-extern void readdhstbynamev6 (struct database_dyn *db, struct hashentry *he,
|
||||
+extern time_t readdhstbyname (struct database_dyn *db, struct hashentry *he,
|
||||
struct datahead *dh);
|
||||
-extern void readdhstbyaddrv6 (struct database_dyn *db, struct hashentry *he,
|
||||
+extern time_t readdhstbyaddr (struct database_dyn *db, struct hashentry *he,
|
||||
struct datahead *dh);
|
||||
+extern time_t readdhstbynamev6 (struct database_dyn *db, struct hashentry *he,
|
||||
+ struct datahead *dh);
|
||||
+extern time_t readdhstbyaddrv6 (struct database_dyn *db, struct hashentry *he,
|
||||
+ struct datahead *dh);
|
||||
|
||||
/* aicache.c */
|
||||
extern void addhstai (struct database_dyn *db, int fd, request_header *req,
|
||||
void *key, uid_t uid);
|
||||
-extern void readdhstai (struct database_dyn *db, struct hashentry *he,
|
||||
- struct datahead *dh);
|
||||
+extern time_t readdhstai (struct database_dyn *db, struct hashentry *he,
|
||||
+ struct datahead *dh);
|
||||
|
||||
|
||||
/* initgrcache.c */
|
||||
extern void addinitgroups (struct database_dyn *db, int fd,
|
||||
request_header *req, void *key, uid_t uid);
|
||||
-extern void readdinitgroups (struct database_dyn *db, struct hashentry *he,
|
||||
- struct datahead *dh);
|
||||
+extern time_t readdinitgroups (struct database_dyn *db, struct hashentry *he,
|
||||
+ struct datahead *dh);
|
||||
|
||||
/* servicecache.c */
|
||||
extern void addservbyname (struct database_dyn *db, int fd,
|
||||
request_header *req, void *key, uid_t uid);
|
||||
-extern void readdservbyname (struct database_dyn *db, struct hashentry *he,
|
||||
- struct datahead *dh);
|
||||
+extern time_t readdservbyname (struct database_dyn *db, struct hashentry *he,
|
||||
+ struct datahead *dh);
|
||||
extern void addservbyport (struct database_dyn *db, int fd,
|
||||
request_header *req, void *key, uid_t uid);
|
||||
-extern void readdservbyport (struct database_dyn *db, struct hashentry *he,
|
||||
- struct datahead *dh);
|
||||
+extern time_t readdservbyport (struct database_dyn *db, struct hashentry *he,
|
||||
+ struct datahead *dh);
|
||||
|
||||
/* mem.c */
|
||||
extern void *mempool_alloc (struct database_dyn *db, size_t len,
|
||||
Index: glibc-2.12-2-gc4ccff1/nscd/pwdcache.c
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/nscd/pwdcache.c
|
||||
+++ glibc-2.12-2-gc4ccff1/nscd/pwdcache.c
|
||||
@@ -77,7 +77,7 @@ static const pw_response_header notfound
|
||||
};
|
||||
|
||||
|
||||
-static void
|
||||
+static time_t
|
||||
cache_addpw (struct database_dyn *db, int fd, request_header *req,
|
||||
const void *key, struct passwd *pwd, uid_t owner,
|
||||
struct hashentry *const he, struct datahead *dh, int errval)
|
||||
@@ -97,6 +97,7 @@ cache_addpw (struct database_dyn *db, in
|
||||
|
||||
assert (offsetof (struct dataset, resp) == offsetof (struct datahead, data));
|
||||
|
||||
+ time_t timeout = MAX_TIMEOUT_VALUE;
|
||||
if (pwd == NULL)
|
||||
{
|
||||
if (he != NULL && errval == EAGAIN)
|
||||
@@ -108,6 +109,9 @@ cache_addpw (struct database_dyn *db, in
|
||||
/* Do not reset the value if we never not reload the record. */
|
||||
dh->nreloads = reload_count - 1;
|
||||
|
||||
+ /* Reload with the same time-to-live value. */
|
||||
+ timeout = dh->timeout = t + db->postimeout;
|
||||
+
|
||||
written = total = 0;
|
||||
}
|
||||
else
|
||||
@@ -132,7 +136,7 @@ cache_addpw (struct database_dyn *db, in
|
||||
dataset->head.usable = true;
|
||||
|
||||
/* Compute the timeout time. */
|
||||
- dataset->head.timeout = t + db->negtimeout;
|
||||
+ timeout = dataset->head.timeout = t + db->negtimeout;
|
||||
|
||||
/* This is the reply. */
|
||||
memcpy (&dataset->resp, ¬found, total);
|
||||
@@ -212,7 +216,7 @@ cache_addpw (struct database_dyn *db, in
|
||||
dataset->head.usable = true;
|
||||
|
||||
/* Compute the timeout time. */
|
||||
- dataset->head.timeout = t + db->postimeout;
|
||||
+ timeout = dataset->head.timeout = t + db->postimeout;
|
||||
|
||||
dataset->resp.version = NSCD_VERSION;
|
||||
dataset->resp.found = 1;
|
||||
@@ -293,8 +297,8 @@ cache_addpw (struct database_dyn *db, in
|
||||
assert ((char *) dataset - (char *) db->head
|
||||
+ total
|
||||
<= (sizeof (struct database_pers_head)
|
||||
- + db->head->module * sizeof (ref_t)
|
||||
- + db->head->data_size));
|
||||
+ + db->head->module * sizeof (ref_t)
|
||||
+ + db->head->data_size));
|
||||
written = sendfileall (fd, db->wr_fd,
|
||||
(char *) &dataset->resp
|
||||
- (char *) db->head, dataset->head.recsize );
|
||||
@@ -374,6 +378,8 @@ cache_addpw (struct database_dyn *db, in
|
||||
dbg_log (_("short write in %s: %s"), __FUNCTION__,
|
||||
strerror_r (errno, buf, sizeof (buf)));
|
||||
}
|
||||
+
|
||||
+ return timeout;
|
||||
}
|
||||
|
||||
|
||||
@@ -395,7 +401,7 @@ lookup (int type, union keytype key, str
|
||||
}
|
||||
|
||||
|
||||
-static void
|
||||
+static time_t
|
||||
addpwbyX (struct database_dyn *db, int fd, request_header *req,
|
||||
union keytype key, const char *keystr, uid_t c_uid,
|
||||
struct hashentry *he, struct datahead *dh)
|
||||
@@ -452,10 +458,13 @@ addpwbyX (struct database_dyn *db, int f
|
||||
}
|
||||
|
||||
/* Add the entry to the cache. */
|
||||
- cache_addpw (db, fd, req, keystr, pwd, c_uid, he, dh, errval);
|
||||
+ time_t timeout = cache_addpw (db, fd, req, keystr, pwd, c_uid, he, dh,
|
||||
+ errval);
|
||||
|
||||
if (use_malloc)
|
||||
free (buffer);
|
||||
+
|
||||
+ return timeout;
|
||||
}
|
||||
|
||||
|
||||
@@ -469,7 +478,7 @@ addpwbyname (struct database_dyn *db, in
|
||||
}
|
||||
|
||||
|
||||
-void
|
||||
+time_t
|
||||
readdpwbyname (struct database_dyn *db, struct hashentry *he,
|
||||
struct datahead *dh)
|
||||
{
|
||||
@@ -480,7 +489,7 @@ readdpwbyname (struct database_dyn *db,
|
||||
};
|
||||
union keytype u = { .v = db->data + he->key };
|
||||
|
||||
- addpwbyX (db, -1, &req, u, db->data + he->key, he->owner, he, dh);
|
||||
+ return addpwbyX (db, -1, &req, u, db->data + he->key, he->owner, he, dh);
|
||||
}
|
||||
|
||||
|
||||
@@ -506,7 +515,7 @@ addpwbyuid (struct database_dyn *db, int
|
||||
}
|
||||
|
||||
|
||||
-void
|
||||
+time_t
|
||||
readdpwbyuid (struct database_dyn *db, struct hashentry *he,
|
||||
struct datahead *dh)
|
||||
{
|
||||
@@ -523,5 +532,5 @@ readdpwbyuid (struct database_dyn *db, s
|
||||
};
|
||||
union keytype u = { .u = uid };
|
||||
|
||||
- addpwbyX (db, -1, &req, u, db->data + he->key, he->owner, he, dh);
|
||||
+ return addpwbyX (db, -1, &req, u, db->data + he->key, he->owner, he, dh);
|
||||
}
|
||||
Index: glibc-2.12-2-gc4ccff1/nscd/servicescache.c
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/nscd/servicescache.c
|
||||
+++ glibc-2.12-2-gc4ccff1/nscd/servicescache.c
|
||||
@@ -61,7 +61,7 @@ static const serv_response_header notfou
|
||||
};
|
||||
|
||||
|
||||
-static void
|
||||
+static time_t
|
||||
cache_addserv (struct database_dyn *db, int fd, request_header *req,
|
||||
const void *key, struct servent *serv, uid_t owner,
|
||||
struct hashentry *const he, struct datahead *dh, int errval)
|
||||
@@ -81,6 +81,7 @@ cache_addserv (struct database_dyn *db,
|
||||
|
||||
assert (offsetof (struct dataset, resp) == offsetof (struct datahead, data));
|
||||
|
||||
+ time_t timeout = MAX_TIMEOUT_VALUE;
|
||||
if (serv == NULL)
|
||||
{
|
||||
if (he != NULL && errval == EAGAIN)
|
||||
@@ -92,6 +93,9 @@ cache_addserv (struct database_dyn *db,
|
||||
/* Do not reset the value if we never not reload the record. */
|
||||
dh->nreloads = reload_count - 1;
|
||||
|
||||
+ /* Reload with the same time-to-live value. */
|
||||
+ timeout = dh->timeout = t + db->postimeout;
|
||||
+
|
||||
written = total = 0;
|
||||
}
|
||||
else
|
||||
@@ -115,7 +119,7 @@ cache_addserv (struct database_dyn *db,
|
||||
dataset->head.usable = true;
|
||||
|
||||
/* Compute the timeout time. */
|
||||
- dataset->head.timeout = t + db->negtimeout;
|
||||
+ timeout = dataset->head.timeout = t + db->negtimeout;
|
||||
|
||||
/* This is the reply. */
|
||||
memcpy (&dataset->resp, ¬found, total);
|
||||
@@ -203,7 +207,7 @@ cache_addserv (struct database_dyn *db,
|
||||
dataset->head.usable = true;
|
||||
|
||||
/* Compute the timeout time. */
|
||||
- dataset->head.timeout = t + db->postimeout;
|
||||
+ timeout = dataset->head.timeout = t + db->postimeout;
|
||||
|
||||
dataset->resp.version = NSCD_VERSION;
|
||||
dataset->resp.found = 1;
|
||||
@@ -328,6 +332,8 @@ cache_addserv (struct database_dyn *db,
|
||||
dbg_log (_("short write in %s: %s"), __FUNCTION__,
|
||||
strerror_r (errno, buf, sizeof (buf)));
|
||||
}
|
||||
+
|
||||
+ return timeout;
|
||||
}
|
||||
|
||||
|
||||
@@ -354,7 +360,7 @@ lookup (int type, char *key, struct serv
|
||||
}
|
||||
|
||||
|
||||
-static void
|
||||
+static time_t
|
||||
addservbyX (struct database_dyn *db, int fd, request_header *req,
|
||||
char *key, uid_t uid, struct hashentry *he, struct datahead *dh)
|
||||
{
|
||||
@@ -409,10 +415,12 @@ addservbyX (struct database_dyn *db, int
|
||||
buffer = (char *) extend_alloca (buffer, buflen, 2 * buflen);
|
||||
}
|
||||
|
||||
- cache_addserv (db, fd, req, key, serv, uid, he, dh, errval);
|
||||
+ time_t timeout = cache_addserv (db, fd, req, key, serv, uid, he, dh, errval);
|
||||
|
||||
if (use_malloc)
|
||||
free (buffer);
|
||||
+
|
||||
+ return timeout;
|
||||
}
|
||||
|
||||
|
||||
@@ -424,7 +432,7 @@ addservbyname (struct database_dyn *db,
|
||||
}
|
||||
|
||||
|
||||
-void
|
||||
+time_t
|
||||
readdservbyname (struct database_dyn *db, struct hashentry *he,
|
||||
struct datahead *dh)
|
||||
{
|
||||
@@ -434,7 +442,7 @@ readdservbyname (struct database_dyn *db
|
||||
.key_len = he->len
|
||||
};
|
||||
|
||||
- addservbyX (db, -1, &req, db->data + he->key, he->owner, he, dh);
|
||||
+ return addservbyX (db, -1, &req, db->data + he->key, he->owner, he, dh);
|
||||
}
|
||||
|
||||
|
||||
@@ -446,7 +454,7 @@ addservbyport (struct database_dyn *db,
|
||||
}
|
||||
|
||||
|
||||
-void
|
||||
+time_t
|
||||
readdservbyport (struct database_dyn *db, struct hashentry *he,
|
||||
struct datahead *dh)
|
||||
{
|
||||
@@ -456,5 +464,5 @@ readdservbyport (struct database_dyn *db
|
||||
.key_len = he->len
|
||||
};
|
||||
|
||||
- addservbyX (db, -1, &req, db->data + he->key, he->owner, he, dh);
|
||||
+ return addservbyX (db, -1, &req, db->data + he->key, he->owner, he, dh);
|
||||
}
|
||||
449
src/patches/glibc/glibc-rh705465.patch
Normal file
449
src/patches/glibc/glibc-rh705465.patch
Normal file
@@ -0,0 +1,449 @@
|
||||
2011-11-07 Andreas Schwab <schwab@redhat.com>
|
||||
|
||||
* nss/nss_files/files-initgroups.c (_nss_files_initgroups_dyn):
|
||||
Fix size of allocated buffer.
|
||||
|
||||
2011-05-10 Ulrich Drepper <drepper@gmail.com>
|
||||
|
||||
[BZ #11257]
|
||||
* grp/initgroups.c (internal_getgrouplist): When we found the service
|
||||
list through the initgroups entry in nsswitch.conf do not always
|
||||
continue on a successful lookup. Don't always use the
|
||||
__nss_group_data-ase value if it is set.
|
||||
* nss/nsswitch.conf (initgroups): Change action for successful db
|
||||
lookup to continue for compatibility.
|
||||
|
||||
2011-05-06 Ulrich Drepper <drepper@gmail.com>
|
||||
|
||||
* nss/nss_files/files-initgroups.c (_nss_files_initgroups_dyn): Return
|
||||
NSS_STATUS_NOTFOUND if no record was found.
|
||||
|
||||
2011-04-29 Ulrich Drepper <drepper@gmail.com>
|
||||
|
||||
* grp/initgroups.c (internal_getgrouplist): Prefer initgroups setting
|
||||
to groups setting in database lookup.
|
||||
* nss/nsswitch.conf: Add initgroups entry.
|
||||
|
||||
2011-04-21 Ulrich Drepper <drepper@gmail.com>
|
||||
|
||||
* nss/nss_files/files-initgroups.c (_nss_files_initgroups_dyn): Fix
|
||||
problem in reallocation in last patch.
|
||||
|
||||
2011-04-19 Ulrich Drepper <drepper@gmail.com>
|
||||
|
||||
* nss/nss_files/files-initgroups.c: New file.
|
||||
* nss/Makefile (libnss_files-routines): Add files-initgroups.
|
||||
* nss/Versions (libnss_files) [GLIBC_PRIVATE]: Export
|
||||
_nss_files_initgroups_dyn.
|
||||
|
||||
2011-01-13 Ulrich Drepper <drepper@gmail.com>
|
||||
|
||||
[BZ #10484]
|
||||
* nss/nss_files/files-hosts.c (HOST_DB_LOOKUP): Handle overflows of
|
||||
temporary buffer used to handle multi lookups locally.
|
||||
* include/alloca.h: Add libc_hidden_proto for __libc_alloca_cutoff.
|
||||
|
||||
2011-01-13 Ulrich Drepper <drepper@gmail.com>
|
||||
|
||||
[BZ #10484]
|
||||
* Versions [libc] (GLIBC_PRIVATE): Export __libc_alloca_cutoff.
|
||||
* alloca_cutoff.c: Add libc_hidden_def.
|
||||
|
||||
Index: glibc-2.12-2-gc4ccff1/grp/initgroups.c
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/grp/initgroups.c
|
||||
+++ glibc-2.12-2-gc4ccff1/grp/initgroups.c
|
||||
@@ -43,6 +43,8 @@ extern int __nss_group_lookup (service_u
|
||||
extern void *__nss_lookup_function (service_user *ni, const char *fct_name);
|
||||
|
||||
extern service_user *__nss_group_database attribute_hidden;
|
||||
+static service_user *initgroups_database;
|
||||
+static bool use_initgroups_entry;
|
||||
|
||||
|
||||
#include "compat-initgroups.c"
|
||||
@@ -67,32 +69,41 @@ internal_getgrouplist (const char *user,
|
||||
}
|
||||
#endif
|
||||
|
||||
- service_user *nip = NULL;
|
||||
- initgroups_dyn_function fct;
|
||||
enum nss_status status = NSS_STATUS_UNAVAIL;
|
||||
- int no_more;
|
||||
- /* Start is one, because we have the first group as parameter. */
|
||||
- long int start = 1;
|
||||
+ int no_more = 0;
|
||||
|
||||
/* Never store more than the starting *SIZE number of elements. */
|
||||
assert (*size > 0);
|
||||
(*groupsp)[0] = group;
|
||||
+ /* Start is one, because we have the first group as parameter. */
|
||||
+ long int start = 1;
|
||||
|
||||
- if (__nss_group_database != NULL)
|
||||
+ if (initgroups_database == NULL)
|
||||
{
|
||||
- no_more = 0;
|
||||
- nip = __nss_group_database;
|
||||
+ no_more = __nss_database_lookup ("initgroups", NULL, "",
|
||||
+ &initgroups_database);
|
||||
+ if (no_more == 0 && initgroups_database == NULL)
|
||||
+ {
|
||||
+ if (__nss_group_database == NULL)
|
||||
+ no_more = __nss_database_lookup ("group", NULL, "compat files",
|
||||
+ &__nss_group_database);
|
||||
+
|
||||
+ initgroups_database = __nss_group_database;
|
||||
+ }
|
||||
+ else if (initgroups_database != NULL)
|
||||
+ {
|
||||
+ assert (no_more == 0);
|
||||
+ use_initgroups_entry = true;
|
||||
+ }
|
||||
}
|
||||
- else
|
||||
- no_more = __nss_database_lookup ("group", NULL,
|
||||
- "compat [NOTFOUND=return] files", &nip);
|
||||
|
||||
+ service_user *nip = initgroups_database;
|
||||
while (! no_more)
|
||||
{
|
||||
long int prev_start = start;
|
||||
|
||||
- fct = __nss_lookup_function (nip, "initgroups_dyn");
|
||||
-
|
||||
+ initgroups_dyn_function fct = __nss_lookup_function (nip,
|
||||
+ "initgroups_dyn");
|
||||
if (fct == NULL)
|
||||
status = compat_call (nip, user, group, &start, size, groupsp,
|
||||
limit, &errno);
|
||||
@@ -119,7 +130,13 @@ internal_getgrouplist (const char *user,
|
||||
if (NSS_STATUS_TRYAGAIN > status || status > NSS_STATUS_RETURN)
|
||||
__libc_fatal ("illegal status in internal_getgrouplist");
|
||||
|
||||
- if (status != NSS_STATUS_SUCCESS
|
||||
+ /* For compatibility reason we will continue to look for more
|
||||
+ entries using the next service even though data has already
|
||||
+ been found if the nsswitch.conf file contained only a 'groups'
|
||||
+ line and no 'initgroups' line. If the latter is available
|
||||
+ we always respect the status. This means that the default
|
||||
+ for successful lookups is to return. */
|
||||
+ if ((use_initgroups_entry || status != NSS_STATUS_SUCCESS)
|
||||
&& nss_next_action (nip, status) == NSS_ACTION_RETURN)
|
||||
break;
|
||||
|
||||
Index: glibc-2.12-2-gc4ccff1/include/alloca.h
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/include/alloca.h
|
||||
+++ glibc-2.12-2-gc4ccff1/include/alloca.h
|
||||
@@ -14,6 +14,7 @@ extern void *__alloca (size_t __size);
|
||||
|
||||
extern int __libc_use_alloca (size_t size) __attribute__ ((const));
|
||||
extern int __libc_alloca_cutoff (size_t size) __attribute__ ((const));
|
||||
+libc_hidden_proto (__libc_alloca_cutoff)
|
||||
|
||||
#define __MAX_ALLOCA_CUTOFF 65536
|
||||
|
||||
Index: glibc-2.12-2-gc4ccff1/nptl/Versions
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/nptl/Versions
|
||||
+++ glibc-2.12-2-gc4ccff1/nptl/Versions
|
||||
@@ -27,6 +27,7 @@ libc {
|
||||
pthread_cond_broadcast; pthread_cond_timedwait;
|
||||
}
|
||||
GLIBC_PRIVATE {
|
||||
+ __libc_alloca_cutoff;
|
||||
# Internal libc interface to libpthread
|
||||
__libc_dl_error_tsd;
|
||||
}
|
||||
Index: glibc-2.12-2-gc4ccff1/nptl/alloca_cutoff.c
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/nptl/alloca_cutoff.c
|
||||
+++ glibc-2.12-2-gc4ccff1/nptl/alloca_cutoff.c
|
||||
@@ -34,3 +34,4 @@ __libc_alloca_cutoff (size_t size)
|
||||
assume the maximum available stack space. */
|
||||
?: __MAX_ALLOCA_CUTOFF * 4));
|
||||
}
|
||||
+libc_hidden_def (__libc_alloca_cutoff)
|
||||
Index: glibc-2.12-2-gc4ccff1/nss/Makefile
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/nss/Makefile
|
||||
+++ glibc-2.12-2-gc4ccff1/nss/Makefile
|
||||
@@ -63,7 +63,7 @@ vpath %.c $(subdir-dirs)
|
||||
|
||||
|
||||
libnss_files-routines := $(addprefix files-,$(databases)) \
|
||||
- files-have_o_cloexec
|
||||
+ files-initgroups files-have_o_cloexec
|
||||
distribute += files-XXX.c files-parse.c
|
||||
|
||||
|
||||
Index: glibc-2.12-2-gc4ccff1/nss/Versions
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/nss/Versions
|
||||
+++ glibc-2.12-2-gc4ccff1/nss/Versions
|
||||
@@ -95,5 +95,7 @@ libnss_files {
|
||||
_nss_netgroup_parseline;
|
||||
_nss_files_getpublickey;
|
||||
_nss_files_getsecretkey;
|
||||
+
|
||||
+ _nss_files_initgroups_dyn;
|
||||
}
|
||||
}
|
||||
Index: glibc-2.12-2-gc4ccff1/nss/nss_files/files-hosts.c
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/nss/nss_files/files-hosts.c
|
||||
+++ glibc-2.12-2-gc4ccff1/nss/nss_files/files-hosts.c
|
||||
@@ -129,19 +129,22 @@ _nss_files_get##name##_r (proto,
|
||||
&& _res_hconf.flags & HCONF_FLAG_MULTI) \
|
||||
{ \
|
||||
/* We have to get all host entries from the file. */ \
|
||||
- const size_t tmp_buflen = MIN (buflen, 4096); \
|
||||
- char tmp_buffer[tmp_buflen] \
|
||||
+ size_t tmp_buflen = MIN (buflen, 4096); \
|
||||
+ char tmp_buffer_stack[tmp_buflen] \
|
||||
__attribute__ ((__aligned__ (__alignof__ (struct hostent_data))));\
|
||||
+ char *tmp_buffer = tmp_buffer_stack; \
|
||||
struct hostent tmp_result_buf; \
|
||||
int naddrs = 1; \
|
||||
int naliases = 0; \
|
||||
char *bufferend; \
|
||||
+ bool tmp_buffer_malloced = false; \
|
||||
\
|
||||
while (result->h_aliases[naliases] != NULL) \
|
||||
++naliases; \
|
||||
\
|
||||
bufferend = (char *) &result->h_aliases[naliases + 1]; \
|
||||
\
|
||||
+ again: \
|
||||
while ((status = internal_getent (&tmp_result_buf, tmp_buffer, \
|
||||
tmp_buflen, errnop H_ERRNO_ARG \
|
||||
EXTRA_ARGS_VALUE)) \
|
||||
@@ -182,7 +185,7 @@ _nss_files_get##name##_r (proto,
|
||||
} \
|
||||
/* If the real name is different add it also to the \
|
||||
aliases. This means that there is a duplication \
|
||||
- in the alias list but this is really the users \
|
||||
+ in the alias list but this is really the user's \
|
||||
problem. */ \
|
||||
if (strcmp (old_result->h_name, \
|
||||
tmp_result_buf.h_name) != 0) \
|
||||
@@ -204,7 +207,7 @@ _nss_files_get##name##_r (proto,
|
||||
*errnop = ERANGE; \
|
||||
*herrnop = NETDB_INTERNAL; \
|
||||
status = NSS_STATUS_TRYAGAIN; \
|
||||
- break; \
|
||||
+ goto out; \
|
||||
} \
|
||||
\
|
||||
new_h_addr_list = \
|
||||
@@ -268,8 +271,54 @@ _nss_files_get##name##_r (proto,
|
||||
} \
|
||||
} \
|
||||
\
|
||||
- if (status != NSS_STATUS_TRYAGAIN) \
|
||||
+ if (status == NSS_STATUS_TRYAGAIN) \
|
||||
+ { \
|
||||
+ size_t newsize = 2 * tmp_buflen; \
|
||||
+ if (tmp_buffer_malloced) \
|
||||
+ { \
|
||||
+ char *newp = realloc (tmp_buffer, newsize); \
|
||||
+ if (newp != NULL) \
|
||||
+ { \
|
||||
+ assert ((((uintptr_t) newp) \
|
||||
+ & (__alignof__ (struct hostent_data) - 1)) \
|
||||
+ == 0); \
|
||||
+ tmp_buffer = newp; \
|
||||
+ tmp_buflen = newsize; \
|
||||
+ goto again; \
|
||||
+ } \
|
||||
+ } \
|
||||
+ else if (!__libc_use_alloca (buflen + newsize)) \
|
||||
+ { \
|
||||
+ tmp_buffer = malloc (newsize); \
|
||||
+ if (tmp_buffer != NULL) \
|
||||
+ { \
|
||||
+ assert ((((uintptr_t) tmp_buffer) \
|
||||
+ & (__alignof__ (struct hostent_data) - 1)) \
|
||||
+ == 0); \
|
||||
+ tmp_buffer_malloced = true; \
|
||||
+ tmp_buflen = newsize; \
|
||||
+ goto again; \
|
||||
+ } \
|
||||
+ } \
|
||||
+ else \
|
||||
+ { \
|
||||
+ tmp_buffer \
|
||||
+ = extend_alloca (tmp_buffer, tmp_buflen, \
|
||||
+ newsize \
|
||||
+ + __alignof__ (struct hostent_data)); \
|
||||
+ tmp_buffer = (char *) (((uintptr_t) tmp_buffer \
|
||||
+ + __alignof__ (struct hostent_data) \
|
||||
+ - 1) \
|
||||
+ & ~(__alignof__ (struct hostent_data)\
|
||||
+ - 1)); \
|
||||
+ goto again; \
|
||||
+ } \
|
||||
+ } \
|
||||
+ else \
|
||||
status = NSS_STATUS_SUCCESS; \
|
||||
+ out: \
|
||||
+ if (tmp_buffer_malloced) \
|
||||
+ free (tmp_buffer); \
|
||||
} \
|
||||
\
|
||||
\
|
||||
Index: glibc-2.12-2-gc4ccff1/nss/nss_files/files-initgroups.c
|
||||
===================================================================
|
||||
--- /dev/null
|
||||
+++ glibc-2.12-2-gc4ccff1/nss/nss_files/files-initgroups.c
|
||||
@@ -0,0 +1,137 @@
|
||||
+/* Initgroups handling in nss_files module.
|
||||
+ Copyright (C) 2011 Free Software Foundation, Inc.
|
||||
+ This file is part of the GNU C Library.
|
||||
+
|
||||
+ The GNU C Library is free software; you can redistribute it and/or
|
||||
+ modify it under the terms of the GNU Lesser General Public
|
||||
+ License as published by the Free Software Foundation; either
|
||||
+ version 2.1 of the License, or (at your option) any later version.
|
||||
+
|
||||
+ The GNU C Library is distributed in the hope that it will be useful,
|
||||
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
+ Lesser General Public License for more details.
|
||||
+
|
||||
+ You should have received a copy of the GNU Lesser General Public
|
||||
+ License along with the GNU C Library; if not, write to the Free
|
||||
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
+ 02111-1307 USA. */
|
||||
+
|
||||
+#include <alloca.h>
|
||||
+#include <errno.h>
|
||||
+#include <grp.h>
|
||||
+#include <nss.h>
|
||||
+#include <stdio_ext.h>
|
||||
+#include <string.h>
|
||||
+#include <sys/param.h>
|
||||
+
|
||||
+enum nss_status
|
||||
+_nss_files_initgroups_dyn (const char *user, gid_t group, long int *start,
|
||||
+ long int *size, gid_t **groupsp, long int limit,
|
||||
+ int *errnop)
|
||||
+{
|
||||
+ FILE *stream = fopen ("/etc/group", "re");
|
||||
+ if (stream == NULL)
|
||||
+ {
|
||||
+ *errnop = errno;
|
||||
+ return *errnop == ENOMEM ? NSS_STATUS_TRYAGAIN : NSS_STATUS_UNAVAIL;
|
||||
+ }
|
||||
+
|
||||
+ /* No other thread using this stream. */
|
||||
+ __fsetlocking (stream, FSETLOCKING_BYCALLER);
|
||||
+
|
||||
+ char *line = NULL;
|
||||
+ size_t linelen = 0;
|
||||
+ enum nss_status status = NSS_STATUS_SUCCESS;
|
||||
+ bool any = false;
|
||||
+
|
||||
+ size_t buflen = 1024;
|
||||
+ void *buffer = alloca (buflen);
|
||||
+ bool buffer_use_malloc = false;
|
||||
+
|
||||
+ gid_t *groups = *groupsp;
|
||||
+
|
||||
+ /* We have to iterate over the entire file. */
|
||||
+ while (!feof_unlocked (stream))
|
||||
+ {
|
||||
+ ssize_t n = getline (&line, &linelen, stream);
|
||||
+ if (n < 0)
|
||||
+ {
|
||||
+ if (! feof_unlocked (stream))
|
||||
+ status = ((*errnop = errno) == ENOMEM
|
||||
+ ? NSS_STATUS_TRYAGAIN : NSS_STATUS_UNAVAIL);
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ struct group grp;
|
||||
+ int res;
|
||||
+ while ((res = _nss_files_parse_grent (line, &grp, buffer, buflen,
|
||||
+ errnop)) == -1)
|
||||
+ {
|
||||
+ size_t newbuflen = 2 * buflen;
|
||||
+ if (buffer_use_malloc || ! __libc_use_alloca (buflen + newbuflen))
|
||||
+ {
|
||||
+ void *newbuf = realloc (buffer_use_malloc ? buffer : NULL,
|
||||
+ newbuflen);
|
||||
+ if (newbuf == NULL)
|
||||
+ {
|
||||
+ *errnop = ENOMEM;
|
||||
+ status = NSS_STATUS_TRYAGAIN;
|
||||
+ goto out;
|
||||
+ }
|
||||
+ buffer = newbuf;
|
||||
+ buflen = newbuflen;
|
||||
+ buffer_use_malloc = true;
|
||||
+ }
|
||||
+ else
|
||||
+ buffer = extend_alloca (buffer, buflen, newbuflen);
|
||||
+ }
|
||||
+
|
||||
+ if (res > 0 && grp.gr_gid != group)
|
||||
+ for (char **m = grp.gr_mem; *m != NULL; ++m)
|
||||
+ if (strcmp (*m, user) == 0)
|
||||
+ {
|
||||
+ /* Matches user. Insert this group. */
|
||||
+ if (*start == *size)
|
||||
+ {
|
||||
+ /* Need a bigger buffer. */
|
||||
+ if (limit > 0 && *size == limit)
|
||||
+ /* We reached the maximum. */
|
||||
+ goto out;
|
||||
+
|
||||
+ long int newsize;
|
||||
+ if (limit <= 0)
|
||||
+ newsize = 2 * *size;
|
||||
+ else
|
||||
+ newsize = MIN (limit, 2 * *size);
|
||||
+
|
||||
+ gid_t *newgroups = realloc (groups,
|
||||
+ newsize * sizeof (*groups));
|
||||
+ if (newgroups == NULL)
|
||||
+ {
|
||||
+ *errnop = ENOMEM;
|
||||
+ status = NSS_STATUS_TRYAGAIN;
|
||||
+ goto out;
|
||||
+ }
|
||||
+ *groupsp = groups = newgroups;
|
||||
+ *size = newsize;
|
||||
+ }
|
||||
+
|
||||
+ groups[*start] = grp.gr_gid;
|
||||
+ *start += 1;
|
||||
+ any = true;
|
||||
+
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ out:
|
||||
+ /* Free memory. */
|
||||
+ if (buffer_use_malloc)
|
||||
+ free (buffer);
|
||||
+ free (line);
|
||||
+
|
||||
+ fclose (stream);
|
||||
+
|
||||
+ return status == NSS_STATUS_SUCCESS && !any ? NSS_STATUS_NOTFOUND : status;
|
||||
+}
|
||||
Index: glibc-2.12-2-gc4ccff1/nss/nsswitch.conf
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/nss/nsswitch.conf
|
||||
+++ glibc-2.12-2-gc4ccff1/nss/nsswitch.conf
|
||||
@@ -5,6 +5,7 @@
|
||||
|
||||
passwd: db files
|
||||
group: db files
|
||||
+initgroups: db [SUCCESS=continue] files
|
||||
shadow: db files
|
||||
gshadow: files
|
||||
|
||||
503
src/patches/glibc/glibc-rh711927.patch
Normal file
503
src/patches/glibc/glibc-rh711927.patch
Normal file
@@ -0,0 +1,503 @@
|
||||
Index: glibc-2.12-2-gc4ccff1/config.h.in
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/config.h.in
|
||||
+++ glibc-2.12-2-gc4ccff1/config.h.in
|
||||
@@ -201,6 +201,9 @@
|
||||
/* Define if multi-arch DSOs should be generated. */
|
||||
#undef USE_MULTIARCH
|
||||
|
||||
+/* Define if Systemtap <sys/sdt.h> probes should be defined. */
|
||||
+#undef USE_STAP_PROBE
|
||||
+
|
||||
/*
|
||||
*/
|
||||
|
||||
Index: glibc-2.12-2-gc4ccff1/configure
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/configure
|
||||
+++ glibc-2.12-2-gc4ccff1/configure
|
||||
@@ -830,6 +830,7 @@ enable_all_warnings
|
||||
enable_multi_arch
|
||||
enable_experimental_malloc
|
||||
enable_nss_crypt
|
||||
+enable_systemtap
|
||||
with_cpu
|
||||
'
|
||||
ac_precious_vars='build_alias
|
||||
@@ -1501,6 +1502,7 @@ Optional Features:
|
||||
--enable-experimental-malloc
|
||||
enable experimental malloc features
|
||||
--enable-nss-crypt enable libcrypt to use nss
|
||||
+ --enable-systemtap enable systemtap static probe points [default=no]
|
||||
|
||||
Optional Packages:
|
||||
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
|
||||
@@ -3932,6 +3934,79 @@ else
|
||||
fi
|
||||
|
||||
|
||||
+# Check whether --enable-systemtap was given.
|
||||
+if test "${enable_systemtap+set}" = set; then
|
||||
+ enableval=$enable_systemtap; systemtap=$enableval
|
||||
+else
|
||||
+ systemtap=no
|
||||
+fi
|
||||
+
|
||||
+if test x$systemtap != xno; then
|
||||
+
|
||||
+ { $as_echo "$as_me:$LINENO: checking for systemtap static probe support" >&5
|
||||
+$as_echo_n "checking for systemtap static probe support... " >&6; }
|
||||
+if test "${libc_cv_sdt+set}" = set; then
|
||||
+ $as_echo_n "(cached) " >&6
|
||||
+else
|
||||
+ old_CFLAGS="$CFLAGS"
|
||||
+ CFLAGS="-std=gnu99 $CFLAGS"
|
||||
+ cat >conftest.$ac_ext <<_ACEOF
|
||||
+#include <sys/sdt.h>
|
||||
+void foo (int i, void *p)
|
||||
+{
|
||||
+ asm ("" STAP_PROBE_ASM (foo, bar, STAP_PROBE_ASM_TEMPLATE (2)) ""
|
||||
+ :: STAP_PROBE_ASM_OPERANDS (2, i, p));
|
||||
+}
|
||||
+_ACEOF
|
||||
+rm -f conftest.$ac_objext
|
||||
+if { (ac_try="$ac_compile"
|
||||
+case "(($ac_try" in
|
||||
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
|
||||
+ *) ac_try_echo=$ac_try;;
|
||||
+esac
|
||||
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
|
||||
+$as_echo "$ac_try_echo") >&5
|
||||
+ (eval "$ac_compile") 2>conftest.er1
|
||||
+ ac_status=$?
|
||||
+ grep -v '^ *+' conftest.er1 >conftest.err
|
||||
+ rm -f conftest.er1
|
||||
+ cat conftest.err >&5
|
||||
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
+ (exit $ac_status); } && {
|
||||
+ test -z "$ac_c_werror_flag" ||
|
||||
+ test ! -s conftest.err
|
||||
+ } && test -s conftest.$ac_objext; then
|
||||
+ libc_cv_sdt=yes
|
||||
+else
|
||||
+ $as_echo "$as_me: failed program was:" >&5
|
||||
+sed 's/^/| /' conftest.$ac_ext >&5
|
||||
+
|
||||
+ libc_cv_sdt=no
|
||||
+fi
|
||||
+
|
||||
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||
+ CFLAGS="$old_CFLAGS"
|
||||
+fi
|
||||
+{ $as_echo "$as_me:$LINENO: result: $libc_cv_sdt" >&5
|
||||
+$as_echo "$libc_cv_sdt" >&6; }
|
||||
+ if test $libc_cv_sdt = yes; then
|
||||
+ cat >>confdefs.h <<\_ACEOF
|
||||
+#define USE_STAP_PROBE 1
|
||||
+_ACEOF
|
||||
+
|
||||
+ else
|
||||
+ { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
|
||||
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
|
||||
+{ { $as_echo "$as_me:$LINENO: error: systemtap support needs sys/sdt.h with asm support
|
||||
+See \`config.log' for more details." >&5
|
||||
+$as_echo "$as_me: error: systemtap support needs sys/sdt.h with asm support
|
||||
+See \`config.log' for more details." >&2;}
|
||||
+ { (exit 1); exit 1; }; }; }
|
||||
+ fi
|
||||
+
|
||||
+fi
|
||||
+
|
||||
+
|
||||
# The way shlib-versions is used to generate soversions.mk uses a
|
||||
# fairly simplistic model for name recognition that can't distinguish
|
||||
# i486-pc-linux-gnu fully from i486-pc-gnu. So we mutate a $host_os
|
||||
Index: glibc-2.12-2-gc4ccff1/configure.in
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/configure.in
|
||||
+++ glibc-2.12-2-gc4ccff1/configure.in
|
||||
@@ -319,6 +319,29 @@ else
|
||||
fi
|
||||
AC_SUBST(libc_cv_nss_crypt)
|
||||
|
||||
+AC_ARG_ENABLE([systemtap],
|
||||
+ [AS_HELP_STRING([--enable-systemtap],
|
||||
+ [enable systemtap static probe points @<:@default=no@:>@])],
|
||||
+ [systemtap=$enableval],
|
||||
+ [systemtap=no])
|
||||
+AS_IF([test x$systemtap != xno], [
|
||||
+ AC_CACHE_CHECK([for systemtap static probe support], libc_cv_sdt, [dnl
|
||||
+ old_CFLAGS="$CFLAGS"
|
||||
+ CFLAGS="-std=gnu99 $CFLAGS"
|
||||
+ AC_COMPILE_IFELSE([#include <sys/sdt.h>
|
||||
+void foo (int i, void *p)
|
||||
+{
|
||||
+ asm ("" STAP_PROBE_ASM (foo, bar, STAP_PROBE_ASM_TEMPLATE (2)) ""
|
||||
+ :: STAP_PROBE_ASM_OPERANDS (2, i, p));
|
||||
+}], [libc_cv_sdt=yes], [libc_cv_sdt=no])
|
||||
+ CFLAGS="$old_CFLAGS"])
|
||||
+ if test $libc_cv_sdt = yes; then
|
||||
+ AC_DEFINE([USE_STAP_PROBE])
|
||||
+ else
|
||||
+ AC_MSG_FAILURE([systemtap support needs sys/sdt.h with asm support])
|
||||
+ fi
|
||||
+])
|
||||
+
|
||||
# The way shlib-versions is used to generate soversions.mk uses a
|
||||
# fairly simplistic model for name recognition that can't distinguish
|
||||
# i486-pc-linux-gnu fully from i486-pc-gnu. So we mutate a $host_os
|
||||
Index: glibc-2.12-2-gc4ccff1/elf/Makefile
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/elf/Makefile
|
||||
+++ glibc-2.12-2-gc4ccff1/elf/Makefile
|
||||
@@ -458,7 +458,8 @@ CFLAGS-ldconfig.c = $(SYSCONF-FLAGS) -D'
|
||||
CFLAGS-dl-cache.c = $(SYSCONF-FLAGS)
|
||||
CFLAGS-cache.c = $(SYSCONF-FLAGS)
|
||||
|
||||
-CPPFLAGS-.os += $(if $(filter $(@F),$(patsubst %,%.os,$(all-rtld-routines))),-DNOT_IN_libc=1 -DIS_IN_rtld=1)
|
||||
+CPPFLAGS-.os += $(if $(filter $(@F),$(patsubst %,%.os,$(all-rtld-routines))),\
|
||||
+ -DNOT_IN_libc=1 -DIS_IN_rtld=1 -DIN_LIB=rtld)
|
||||
|
||||
test-modules = $(addprefix $(objpfx),$(addsuffix .so,$(strip $(modules-names))))
|
||||
generated += $(addsuffix .so,$(strip $(modules-names)))
|
||||
Index: glibc-2.12-2-gc4ccff1/elf/dl-close.c
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/elf/dl-close.c
|
||||
+++ glibc-2.12-2-gc4ccff1/elf/dl-close.c
|
||||
@@ -32,6 +32,7 @@
|
||||
#include <sys/mman.h>
|
||||
#include <sysdep-cancel.h>
|
||||
#include <tls.h>
|
||||
+#include <stap-probe.h>
|
||||
|
||||
|
||||
/* Type of the constructor functions. */
|
||||
@@ -469,6 +470,7 @@ _dl_close_worker (struct link_map *map)
|
||||
struct r_debug *r = _dl_debug_initialize (0, nsid);
|
||||
r->r_state = RT_DELETE;
|
||||
_dl_debug_state ();
|
||||
+ LIBC_PROBE (rtld_unmap_start, 2, nsid, r);
|
||||
|
||||
if (unload_global)
|
||||
{
|
||||
@@ -722,6 +724,7 @@ _dl_close_worker (struct link_map *map)
|
||||
/* Notify the debugger those objects are finalized and gone. */
|
||||
r->r_state = RT_CONSISTENT;
|
||||
_dl_debug_state ();
|
||||
+ LIBC_PROBE (rtld_unmap_complete, 2, nsid, r);
|
||||
|
||||
/* Recheck if we need to retry, release the lock. */
|
||||
out:
|
||||
Index: glibc-2.12-2-gc4ccff1/elf/dl-load.c
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/elf/dl-load.c
|
||||
+++ glibc-2.12-2-gc4ccff1/elf/dl-load.c
|
||||
@@ -36,6 +36,7 @@
|
||||
#include <stackinfo.h>
|
||||
#include <caller.h>
|
||||
#include <sysdep.h>
|
||||
+#include <stap-probe.h>
|
||||
|
||||
#include <dl-dst.h>
|
||||
|
||||
@@ -806,7 +807,7 @@ _dl_init_paths (const char *llp)
|
||||
static void
|
||||
__attribute__ ((noreturn, noinline))
|
||||
lose (int code, int fd, const char *name, char *realname, struct link_map *l,
|
||||
- const char *msg, struct r_debug *r)
|
||||
+ const char *msg, struct r_debug *r, Lmid_t nsid)
|
||||
{
|
||||
/* The file might already be closed. */
|
||||
if (fd != -1)
|
||||
@@ -818,6 +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);
|
||||
}
|
||||
|
||||
_dl_signal_error (code, name, NULL, msg);
|
||||
@@ -856,7 +858,7 @@ _dl_map_object_from_fd (const char *name
|
||||
errval = errno;
|
||||
call_lose:
|
||||
lose (errval, fd, name, realname, l, errstring,
|
||||
- make_consistent ? r : NULL);
|
||||
+ make_consistent ? r : NULL, nsid);
|
||||
}
|
||||
|
||||
/* Look again to see if the real name matched another already loaded. */
|
||||
@@ -963,6 +965,7 @@ _dl_map_object_from_fd (const char *name
|
||||
linking has not been used before. */
|
||||
r->r_state = RT_ADD;
|
||||
_dl_debug_state ();
|
||||
+ LIBC_PROBE (rtld_map_start, 2, nsid, r);
|
||||
make_consistent = true;
|
||||
}
|
||||
else
|
||||
@@ -1656,7 +1659,7 @@ open_verify (const char *name, struct fi
|
||||
name = strdupa (realname);
|
||||
free (realname);
|
||||
}
|
||||
- lose (errval, fd, name, NULL, NULL, errstring, NULL);
|
||||
+ lose (errval, fd, name, NULL, NULL, errstring, NULL, 0);
|
||||
}
|
||||
|
||||
/* See whether the ELF header is what we expect. */
|
||||
Index: glibc-2.12-2-gc4ccff1/elf/dl-open.c
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/elf/dl-open.c
|
||||
+++ glibc-2.12-2-gc4ccff1/elf/dl-open.c
|
||||
@@ -33,6 +33,7 @@
|
||||
#include <caller.h>
|
||||
#include <sysdep-cancel.h>
|
||||
#include <tls.h>
|
||||
+#include <stap-probe.h>
|
||||
|
||||
#include <dl-dst.h>
|
||||
|
||||
@@ -297,6 +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);
|
||||
|
||||
/* Only do lazy relocation if `LD_BIND_NOW' is not set. */
|
||||
int reloc_mode = mode & __RTLD_AUDIT;
|
||||
@@ -309,10 +311,18 @@ dl_open_worker (void *a)
|
||||
struct link_map *l = new;
|
||||
while (l->l_next)
|
||||
l = l->l_next;
|
||||
+ int relocation_in_progress = 0;
|
||||
while (1)
|
||||
{
|
||||
if (! l->l_real->l_relocated)
|
||||
{
|
||||
+ if (! relocation_in_progress)
|
||||
+ {
|
||||
+ /* Notify the debugger that relocations are about to happen. */
|
||||
+ LIBC_PROBE (rtld_reloc_start, 2, args->nsid, r);
|
||||
+ relocation_in_progress = 1;
|
||||
+ }
|
||||
+
|
||||
#ifdef SHARED
|
||||
if (__builtin_expect (GLRO(dl_profile) != NULL, 0))
|
||||
{
|
||||
@@ -460,6 +470,10 @@ cannot load any more object with static
|
||||
_dl_fatal_printf (N_("\
|
||||
TLS generation counter wrapped! Please report this."));
|
||||
|
||||
+ /* Notify the debugger all new objects have been relocated. */
|
||||
+ if (relocation_in_progress)
|
||||
+ LIBC_PROBE (rtld_reloc_complete, 2, args->nsid, r);
|
||||
+
|
||||
/* Run the initializer functions of new objects. */
|
||||
_dl_init (new, args->argc, args->argv, args->env);
|
||||
|
||||
Index: glibc-2.12-2-gc4ccff1/elf/rtld-Rules
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/elf/rtld-Rules
|
||||
+++ glibc-2.12-2-gc4ccff1/elf/rtld-Rules
|
||||
@@ -122,6 +122,6 @@ ifdef rtld-depfiles
|
||||
endif
|
||||
|
||||
# This here is the whole point of all the shenanigans.
|
||||
-rtld-CPPFLAGS := -DNOT_IN_libc=1 -DIS_IN_rtld=1
|
||||
+rtld-CPPFLAGS := -DNOT_IN_libc=1 -DIS_IN_rtld=1 -DIN_LIB=rtld
|
||||
|
||||
endif
|
||||
Index: glibc-2.12-2-gc4ccff1/elf/rtld.c
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/elf/rtld.c
|
||||
+++ glibc-2.12-2-gc4ccff1/elf/rtld.c
|
||||
@@ -40,6 +40,7 @@
|
||||
#include <dl-osinfo.h>
|
||||
#include <dl-procinfo.h>
|
||||
#include <tls.h>
|
||||
+#include <stap-probe.h>
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
@@ -1656,6 +1657,7 @@ ERROR: ld.so: object '%s' cannot be load
|
||||
/* We start adding objects. */
|
||||
r->r_state = RT_ADD;
|
||||
_dl_debug_state ();
|
||||
+ LIBC_PROBE (rtld_init_start, 2, LM_ID_BASE, r);
|
||||
|
||||
/* Auditing checkpoint: we are ready to signal that the initial map
|
||||
is being constructed. */
|
||||
@@ -2353,6 +2355,7 @@ ERROR: ld.so: object '%s' cannot be load
|
||||
r = _dl_debug_initialize (0, LM_ID_BASE);
|
||||
r->r_state = RT_CONSISTENT;
|
||||
_dl_debug_state ();
|
||||
+ LIBC_PROBE (rtld_init_complete, 2, LM_ID_BASE, r);
|
||||
|
||||
#ifndef MAP_COPY
|
||||
/* We must munmap() the cache file. */
|
||||
Index: glibc-2.12-2-gc4ccff1/extra-lib.mk
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/extra-lib.mk
|
||||
+++ glibc-2.12-2-gc4ccff1/extra-lib.mk
|
||||
@@ -101,4 +101,4 @@ ifneq (,$(cpp-srcs-left))
|
||||
include $(patsubst %,$(..)cppflags-iterator.mk,$(cpp-srcs-left))
|
||||
endif
|
||||
|
||||
-CPPFLAGS-$(lib) := -DNOT_IN_libc=1 -DIS_IN_$(lib)=1
|
||||
+CPPFLAGS-$(lib) := -DNOT_IN_libc=1 -DIS_IN_$(lib)=1 -DIN_LIB=$(lib)
|
||||
Index: glibc-2.12-2-gc4ccff1/include/stap-probe.h
|
||||
===================================================================
|
||||
--- /dev/null
|
||||
+++ glibc-2.12-2-gc4ccff1/include/stap-probe.h
|
||||
@@ -0,0 +1,140 @@
|
||||
+/* Macros for defining Systemtap <sys/sdt.h> static probe points.
|
||||
+ Copyright (C) 2011 Free Software Foundation, Inc.
|
||||
+ This file is part of the GNU C Library.
|
||||
+
|
||||
+ The GNU C Library is free software; you can redistribute it and/or
|
||||
+ modify it under the terms of the GNU Lesser General Public
|
||||
+ License as published by the Free Software Foundation; either
|
||||
+ version 2.1 of the License, or (at your option) any later version.
|
||||
+
|
||||
+ The GNU C Library is distributed in the hope that it will be useful,
|
||||
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
+ Lesser General Public License for more details.
|
||||
+
|
||||
+ You should have received a copy of the GNU Lesser General Public
|
||||
+ License along with the GNU C Library; if not, write to the Free
|
||||
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
+ 02111-1307 USA. */
|
||||
+
|
||||
+#ifndef _STAP_PROBE_H
|
||||
+#define _STAP_PROBE_H 1
|
||||
+
|
||||
+#ifdef USE_STAP_PROBE
|
||||
+
|
||||
+# include <sys/sdt.h>
|
||||
+
|
||||
+/* Our code uses one macro LIBC_PROBE (name, n, arg1, ..., argn).
|
||||
+
|
||||
+ Without USE_STAP_PROBE, that does nothing but evaluates all
|
||||
+ its arguments (to prevent bit rot, unlike e.g. assert).
|
||||
+
|
||||
+ Systemtap's header defines the macros STAP_PROBE (provider, name) and
|
||||
+ STAP_PROBEn (provider, name, arg1, ..., argn). For "provider" we paste
|
||||
+ in the IN_LIB name (libc, libpthread, etc.) automagically. */
|
||||
+
|
||||
+# ifndef NOT_IN_libc
|
||||
+# define IN_LIB libc
|
||||
+# elif !defined IN_LIB
|
||||
+/* This is intentionally defined with extra unquoted commas in it so
|
||||
+ that macro substitution will bomb out when it is used. We don't
|
||||
+ just use #error here, so that this header can be included by
|
||||
+ other headers that use LIBC_PROBE inside their own macros. We
|
||||
+ only want such headers to fail to compile if those macros are
|
||||
+ actually used in a context where IN_LIB has not been defined. */
|
||||
+# define IN_LIB ,,,missing -DIN_LIB=... -- not extra-lib.mk?,,,
|
||||
+# endif
|
||||
+
|
||||
+# define LIBC_PROBE(name, n, ...) \
|
||||
+ LIBC_PROBE_1 (IN_LIB, name, n, ## __VA_ARGS__)
|
||||
+
|
||||
+# define LIBC_PROBE_1(lib, name, n, ...) \
|
||||
+ STAP_PROBE##n (lib, name, ## __VA_ARGS__)
|
||||
+
|
||||
+# define STAP_PROBE0 STAP_PROBE
|
||||
+
|
||||
+# define LIBC_PROBE_ASM(name, template) \
|
||||
+ STAP_PROBE_ASM (IN_LIB, name, template)
|
||||
+
|
||||
+# define LIBC_PROBE_ASM_OPERANDS STAP_PROBE_ASM_OPERANDS
|
||||
+
|
||||
+#else /* Not USE_STAP_PROBE. */
|
||||
+
|
||||
+# ifndef __ASSEMBLER__
|
||||
+# define LIBC_PROBE(name, n, ...) DUMMY_PROBE##n (__VA_ARGS__)
|
||||
+# else
|
||||
+# define LIBC_PROBE(name, n, ...) /* Nothing. */
|
||||
+# endif
|
||||
+
|
||||
+# define LIBC_PROBE_ASM(name, template) /* Nothing. */
|
||||
+# define LIBC_PROBE_ASM_OPERANDS(n, ...) /* Nothing. */
|
||||
+
|
||||
+/* This silliness lets us evaluate all the arguments for each arity
|
||||
+ of probe. My kingdom for a real macro system. */
|
||||
+
|
||||
+# define DUMMY_PROBE0() do {} while (0)
|
||||
+# define DUMMY_PROBE1(a1) do {} while ((void) (a1), 0)
|
||||
+# define DUMMY_PROBE2(a1, a2) do {} while ((void) (a1), \
|
||||
+ (void) (a2), 0)
|
||||
+# define DUMMY_PROBE3(a1, a2, a3) do {} while ((void) (a1), \
|
||||
+ (void) (a2), \
|
||||
+ (void) (a3), 0)
|
||||
+# define DUMMY_PROBE4(a1, a2, a3, a4) do {} while ((void) (a1), \
|
||||
+ (void) (a2), \
|
||||
+ (void) (a3), \
|
||||
+ (void) (a4), 0)
|
||||
+# define DUMMY_PROBE5(a1, a2, a3, a4, a5) \
|
||||
+ do {} while ((void) (a1), \
|
||||
+ (void) (a2), \
|
||||
+ (void) (a3), \
|
||||
+ (void) (a4), \
|
||||
+ (void) (a5), 0)
|
||||
+# define DUMMY_PROBE6(a1, a2, a3, a4, a5, a6) \
|
||||
+ do {} while ((void) (a1), \
|
||||
+ (void) (a2), \
|
||||
+ (void) (a3), \
|
||||
+ (void) (a4), \
|
||||
+ (void) (a5), \
|
||||
+ (void) (a6), 0)
|
||||
+# define DUMMY_PROBE7(a1, a2, a3, a4, a5, a6, a7) \
|
||||
+ do {} while ((void) (a1), \
|
||||
+ (void) (a2), \
|
||||
+ (void) (a3), \
|
||||
+ (void) (a4), \
|
||||
+ (void) (a5), \
|
||||
+ (void) (a6), \
|
||||
+ (void) (a7), 0)
|
||||
+# define DUMMY_PROBE8(a1, a2, a3, a4, a5, a6, a7, a8) \
|
||||
+ do {} while ((void) (a1), \
|
||||
+ (void) (a2), \
|
||||
+ (void) (a3), \
|
||||
+ (void) (a4), \
|
||||
+ (void) (a5), \
|
||||
+ (void) (a6), \
|
||||
+ (void) (a7), \
|
||||
+ (void) (a8), 0)
|
||||
+# define DUMMY_PROBE9(a1, a2, a3, a4, a5, a6, a7, a8, a9) \
|
||||
+ do {} while ((void) (a1), \
|
||||
+ (void) (a2), \
|
||||
+ (void) (a3), \
|
||||
+ (void) (a4), \
|
||||
+ (void) (a5), \
|
||||
+ (void) (a6), \
|
||||
+ (void) (a7), \
|
||||
+ (void) (a8), \
|
||||
+ (void) (a9), 0)
|
||||
+# define DUMMY_PROBE10(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) \
|
||||
+ do {} while ((void) (a1), \
|
||||
+ (void) (a2), \
|
||||
+ (void) (a3), \
|
||||
+ (void) (a4), \
|
||||
+ (void) (a5), \
|
||||
+ (void) (a6), \
|
||||
+ (void) (a7), \
|
||||
+ (void) (a8), \
|
||||
+ (void) (a9), \
|
||||
+ (void) (a10), 0)
|
||||
+
|
||||
+#endif /* USE_STAP_PROBE. */
|
||||
+
|
||||
+#endif /* stap-probe.h */
|
||||
Index: glibc-2.12-2-gc4ccff1/scripts/check-local-headers.sh
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/scripts/check-local-headers.sh
|
||||
+++ glibc-2.12-2-gc4ccff1/scripts/check-local-headers.sh
|
||||
@@ -31,6 +31,8 @@ fgrep -v "$includedir/asm" |
|
||||
fgrep -v "$includedir/linux" |
|
||||
fgrep -v "$includedir/selinux" |
|
||||
fgrep -v "$includedir/sys/capability.h" |
|
||||
+fgrep -v "$includedir/sys/sdt.h" |
|
||||
+fgrep -v "$includedir/sys/sdt-config.h" |
|
||||
fgrep -v "$includedir/gd" |
|
||||
fgrep -v "$includedir/nss3"; then
|
||||
# If we found a match something is wrong.
|
||||
136
src/patches/glibc/glibc-rh711987.patch
Normal file
136
src/patches/glibc/glibc-rh711987.patch
Normal file
@@ -0,0 +1,136 @@
|
||||
2010-08-11 Ulrich Drepper <drepper@redhat.com>
|
||||
|
||||
* sysdeps/unix/sysv/linux/bits/statfs.h (struct statfs): Add f_flags
|
||||
field.
|
||||
(struct statfs64): Likewise.
|
||||
(_STATFS_F_FLAGS): Define.
|
||||
* sysdeps/unix/sysv/linux/s390/bits/statfs.h: Likewise.
|
||||
* sysdeps/unix/sysv/linux/internal_statvfs.c (__statvfs_getflags):
|
||||
Don't define if __ASSUME_STATFS_F_FLAGS is defined.
|
||||
(ST_VALID): Define locally.
|
||||
(INTERNAL_STATVFS): If f_flags has ST_VALID set don't call
|
||||
__statvfs_getflags, use the provided value.
|
||||
* sysdeps/unix/sysv/linux/kernel-features.h: Define
|
||||
__ASSUME_STATFS_F_FLAGS.
|
||||
|
||||
Index: glibc-2.12-2-gc4ccff1/sysdeps/unix/sysv/linux/bits/statfs.h
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/sysdeps/unix/sysv/linux/bits/statfs.h
|
||||
+++ glibc-2.12-2-gc4ccff1/sysdeps/unix/sysv/linux/bits/statfs.h
|
||||
@@ -42,7 +42,8 @@ struct statfs
|
||||
__fsid_t f_fsid;
|
||||
__SWORD_TYPE f_namelen;
|
||||
__SWORD_TYPE f_frsize;
|
||||
- __SWORD_TYPE f_spare[5];
|
||||
+ __SWORD_TYPE f_flags;
|
||||
+ __SWORD_TYPE f_spare[4];
|
||||
};
|
||||
|
||||
#ifdef __USE_LARGEFILE64
|
||||
@@ -58,10 +59,12 @@ struct statfs64
|
||||
__fsid_t f_fsid;
|
||||
__SWORD_TYPE f_namelen;
|
||||
__SWORD_TYPE f_frsize;
|
||||
- __SWORD_TYPE f_spare[5];
|
||||
+ __SWORD_TYPE f_flags;
|
||||
+ __SWORD_TYPE f_spare[4];
|
||||
};
|
||||
#endif
|
||||
|
||||
/* Tell code we have these members. */
|
||||
#define _STATFS_F_NAMELEN
|
||||
#define _STATFS_F_FRSIZE
|
||||
+#define _STATFS_F_FLAGS
|
||||
Index: glibc-2.12-2-gc4ccff1/sysdeps/unix/sysv/linux/internal_statvfs.c
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/sysdeps/unix/sysv/linux/internal_statvfs.c
|
||||
+++ glibc-2.12-2-gc4ccff1/sysdeps/unix/sysv/linux/internal_statvfs.c
|
||||
@@ -29,6 +29,11 @@
|
||||
#include <sys/statfs.h>
|
||||
#include <sys/statvfs.h>
|
||||
#include "linux_fsinfo.h"
|
||||
+#include "kernel-features.h"
|
||||
+
|
||||
+
|
||||
+/* Special internal-only bit value. */
|
||||
+#define ST_VALID 0x0020
|
||||
|
||||
|
||||
#ifndef STATFS
|
||||
@@ -37,6 +42,7 @@
|
||||
# define INTERNAL_STATVFS __internal_statvfs
|
||||
|
||||
|
||||
+# ifndef __ASSUME_STATFS_F_FLAGS
|
||||
int
|
||||
__statvfs_getflags (const char *name, int fstype, struct stat64 *st)
|
||||
{
|
||||
@@ -200,6 +206,7 @@ __statvfs_getflags (const char *name, in
|
||||
|
||||
return result;
|
||||
}
|
||||
+# endif
|
||||
#else
|
||||
extern int __statvfs_getflags (const char *name, int fstype,
|
||||
struct stat64 *st);
|
||||
@@ -240,9 +247,14 @@ INTERNAL_STATVFS (const char *name, stru
|
||||
/* XXX I have no idea how to compute f_favail. Any idea??? */
|
||||
buf->f_favail = buf->f_ffree;
|
||||
|
||||
- /* Determining the flags is tricky. We have to read /proc/mounts or
|
||||
- the /etc/mtab file and search for the entry which matches the given
|
||||
- file. The way we can test for matching filesystem is using the
|
||||
- device number. */
|
||||
- buf->f_flag = __statvfs_getflags (name, fsbuf->f_type, st);
|
||||
+#ifndef __ASSUME_STATFS_F_FLAGS
|
||||
+ if ((fsbuf->f_flags & ST_VALID) == 0)
|
||||
+ /* Determining the flags is tricky. We have to read /proc/mounts or
|
||||
+ the /etc/mtab file and search for the entry which matches the given
|
||||
+ file. The way we can test for matching filesystem is using the
|
||||
+ device number. */
|
||||
+ buf->f_flag = __statvfs_getflags (name, fsbuf->f_type, st);
|
||||
+ else
|
||||
+#endif
|
||||
+ buf->f_flag = fsbuf->f_flags ^ ST_VALID;
|
||||
}
|
||||
Index: glibc-2.12-2-gc4ccff1/sysdeps/unix/sysv/linux/kernel-features.h
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/sysdeps/unix/sysv/linux/kernel-features.h
|
||||
+++ glibc-2.12-2-gc4ccff1/sysdeps/unix/sysv/linux/kernel-features.h
|
||||
@@ -552,3 +552,8 @@
|
||||
#if __LINUX_KERNEL_VERSION >= 0x020621
|
||||
# define __ASSUME_RECVMMSG 1
|
||||
#endif
|
||||
+
|
||||
+/* statfs fills in f_flags since 2.6.36. */
|
||||
+#if __LINUX_KERNEL_VERSION >= 0x020624
|
||||
+# define __ASSUME_STATFS_F_FLAGS 1
|
||||
+#endif
|
||||
Index: glibc-2.12-2-gc4ccff1/sysdeps/unix/sysv/linux/s390/bits/statfs.h
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/sysdeps/unix/sysv/linux/s390/bits/statfs.h
|
||||
+++ glibc-2.12-2-gc4ccff1/sysdeps/unix/sysv/linux/s390/bits/statfs.h
|
||||
@@ -42,7 +42,8 @@ struct statfs
|
||||
__fsid_t f_fsid;
|
||||
int f_namelen;
|
||||
int f_frsize;
|
||||
- int f_spare[5];
|
||||
+ int f_flags;
|
||||
+ int f_spare[4];
|
||||
};
|
||||
|
||||
#ifdef __USE_LARGEFILE64
|
||||
@@ -58,10 +59,12 @@ struct statfs64
|
||||
__fsid_t f_fsid;
|
||||
int f_namelen;
|
||||
int f_frsize;
|
||||
- int f_spare[5];
|
||||
+ int f_flags;
|
||||
+ int f_spare[4];
|
||||
};
|
||||
#endif
|
||||
|
||||
/* Tell code we have this member. */
|
||||
#define _STATFS_F_NAMELEN
|
||||
#define _STATFS_F_FRSIZE
|
||||
+#define _STATFS_F_FLAGS
|
||||
69
src/patches/glibc/glibc-rh712248.patch
Normal file
69
src/patches/glibc/glibc-rh712248.patch
Normal file
@@ -0,0 +1,69 @@
|
||||
2011-07-07 Ulrich Drepper <drepper@gmail.com>
|
||||
|
||||
[BZ #12868]
|
||||
* sysdeps/unix/sysv/linux/linux_fsinfo.h: Define Lustre constants.
|
||||
* sysdeps/unix/sysv/linux/internal_statvfs.c (__statvfs_getflags):
|
||||
Handle Lustre.
|
||||
* sysdeps/unix/sysv/linux/pathconf.c (__statfs_link_max): Likewise.
|
||||
(__statfs_filesize_max): Likewise.
|
||||
Patch mostly by Andreas Dilger <adilger@whamcloud.com>.
|
||||
|
||||
Index: glibc-2.12-2-gc4ccff1/sysdeps/unix/sysv/linux/internal_statvfs.c
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/sysdeps/unix/sysv/linux/internal_statvfs.c
|
||||
+++ glibc-2.12-2-gc4ccff1/sysdeps/unix/sysv/linux/internal_statvfs.c
|
||||
@@ -109,6 +109,9 @@ __statvfs_getflags (const char *name, in
|
||||
case LOGFS_MAGIC_U32:
|
||||
fsname = "logfs";
|
||||
break;
|
||||
+ case LUSTRE_SUPER_MAGIC:
|
||||
+ fsname = "lustre";
|
||||
+ break;
|
||||
}
|
||||
|
||||
FILE *mtab = __setmntent ("/proc/mounts", "r");
|
||||
Index: glibc-2.12-2-gc4ccff1/sysdeps/unix/sysv/linux/linux_fsinfo.h
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/sysdeps/unix/sysv/linux/linux_fsinfo.h
|
||||
+++ glibc-2.12-2-gc4ccff1/sysdeps/unix/sysv/linux/linux_fsinfo.h
|
||||
@@ -77,6 +77,9 @@
|
||||
/* Constant that identifies the `logfs<66> filesystem. */
|
||||
#define LOGFS_MAGIC_U32 0xc97e8168u
|
||||
|
||||
+/* Constant that identifies the `lustre' filesystem. */
|
||||
+#define LUSTRE_SUPER_MAGIC 0x0BD00BD0
|
||||
+
|
||||
/* Constants that identify the `minix2' filesystem. */
|
||||
#define MINIX2_SUPER_MAGIC 0x2468
|
||||
#define MINIX2_SUPER_MAGIC2 0x2478
|
||||
@@ -144,6 +147,8 @@
|
||||
/* Maximum link counts. */
|
||||
#define COH_LINK_MAX 10000
|
||||
#define EXT2_LINK_MAX 32000
|
||||
+#define EXT4_LINK_MAX 65000
|
||||
+#define LUSTRE_LINK_MAX EXT4_LINK_MAX
|
||||
#define MINIX2_LINK_MAX 65530
|
||||
#define MINIX_LINK_MAX 250
|
||||
#define REISERFS_LINK_MAX 64535
|
||||
Index: glibc-2.12-2-gc4ccff1/sysdeps/unix/sysv/linux/pathconf.c
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/sysdeps/unix/sysv/linux/pathconf.c
|
||||
+++ glibc-2.12-2-gc4ccff1/sysdeps/unix/sysv/linux/pathconf.c
|
||||
@@ -104,6 +104,9 @@ __statfs_link_max (int result, const str
|
||||
case XFS_SUPER_MAGIC:
|
||||
return XFS_LINK_MAX;
|
||||
|
||||
+ case LUSTRE_SUPER_MAGIC:
|
||||
+ return LUSTRE_LINK_MAX;
|
||||
+
|
||||
default:
|
||||
return LINUX_LINK_MAX;
|
||||
}
|
||||
@@ -136,6 +139,7 @@ __statfs_filesize_max (int result, const
|
||||
case UDF_SUPER_MAGIC:
|
||||
case JFS_SUPER_MAGIC:
|
||||
case VXFS_SUPER_MAGIC:
|
||||
+ case LUSTRE_SUPER_MAGIC:
|
||||
return 64;
|
||||
|
||||
case MSDOS_SUPER_MAGIC:
|
||||
36
src/patches/glibc/glibc-rh713134.patch
Normal file
36
src/patches/glibc/glibc-rh713134.patch
Normal file
@@ -0,0 +1,36 @@
|
||||
2011-03-18 Andreas Schwab <schwab@redhat.com>
|
||||
|
||||
* elf/ldd.bash.in: Never run file directly.
|
||||
|
||||
Index: glibc-2.12-2-gc4ccff1/elf/ldd.bash.in
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/elf/ldd.bash.in
|
||||
+++ glibc-2.12-2-gc4ccff1/elf/ldd.bash.in
|
||||
@@ -167,18 +167,6 @@ warning: you do not have execution permi
|
||||
fi
|
||||
done
|
||||
case $ret in
|
||||
- 0)
|
||||
- # If the program exits with exit code 5, it means the process has been
|
||||
- # invoked with __libc_enable_secure. Fall back to running it through
|
||||
- # the dynamic linker.
|
||||
- try_trace "$file"
|
||||
- rc=$?
|
||||
- if [ $rc = 5 ]; then
|
||||
- try_trace "$RTLD" "$file"
|
||||
- rc=$?
|
||||
- fi
|
||||
- [ $rc = 0 ] || result=1
|
||||
- ;;
|
||||
1)
|
||||
# This can be a non-ELF binary or no binary at all.
|
||||
nonelf "$file" || {
|
||||
@@ -186,7 +174,7 @@ warning: you do not have execution permi
|
||||
result=1
|
||||
}
|
||||
;;
|
||||
- 2)
|
||||
+ 0|2)
|
||||
try_trace "$RTLD" "$file" || result=1
|
||||
;;
|
||||
*)
|
||||
126
src/patches/glibc/glibc-rh714823.patch
Normal file
126
src/patches/glibc/glibc-rh714823.patch
Normal file
@@ -0,0 +1,126 @@
|
||||
2011-06-28 Andreas Schwab <schwab@redhat.com>
|
||||
|
||||
* sysdeps/posix/getaddrinfo.c (gaih_inet): Don't use gethostbyaddr
|
||||
to determine canonical name.
|
||||
|
||||
2011-06-22 Andreas Schwab <schwab@redhat.com>
|
||||
|
||||
* sysdeps/posix/getaddrinfo.c (gaih_inet): Fix last change.
|
||||
|
||||
2011-06-21 Ulrich Drepper <drepper@gmail.com>
|
||||
|
||||
[BZ #12885]
|
||||
* sysdeps/posix/getaddrinfo.c (gaih_inet): When looking up only IPv6
|
||||
addresses using gethostbyname4_r ignore IPv4 addresses.
|
||||
|
||||
Index: glibc-2.12-2-gc4ccff1/sysdeps/posix/getaddrinfo.c
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/sysdeps/posix/getaddrinfo.c
|
||||
+++ glibc-2.12-2-gc4ccff1/sysdeps/posix/getaddrinfo.c
|
||||
@@ -512,10 +512,11 @@ gaih_inet (const char *name, const struc
|
||||
|
||||
/* If we do not have to look for IPv4 and IPv6 together, use
|
||||
the simple, old functions. */
|
||||
- if (req->ai_family == AF_INET
|
||||
- || (req->ai_family == AF_INET6
|
||||
- && ((req->ai_flags & AI_V4MAPPED) == 0
|
||||
- || (req->ai_flags & AI_ALL) == 0)))
|
||||
+ if ((req->ai_family == AF_INET
|
||||
+ || (req->ai_family == AF_INET6
|
||||
+ && ((req->ai_flags & AI_V4MAPPED) == 0
|
||||
+ || (req->ai_flags & AI_ALL) == 0)))
|
||||
+ && (req->ai_flags & AI_CANONNAME) == 0)
|
||||
{
|
||||
int family = req->ai_family;
|
||||
size_t tmpbuflen = 512;
|
||||
@@ -731,16 +732,44 @@ gaih_inet (const char *name, const struc
|
||||
tmpbuflen, 2 * tmpbuflen);
|
||||
}
|
||||
|
||||
- no_inet6_data = no_data;
|
||||
-
|
||||
if (status == NSS_STATUS_SUCCESS)
|
||||
{
|
||||
+ assert (!no_data);
|
||||
+ no_data = 1;
|
||||
+
|
||||
if ((req->ai_flags & AI_CANONNAME) != 0 && canon == NULL)
|
||||
canon = (*pat)->name;
|
||||
|
||||
while (*pat != NULL)
|
||||
- pat = &((*pat)->next);
|
||||
+ {
|
||||
+ if ((*pat)->family == AF_INET
|
||||
+ && req->ai_family == AF_INET6
|
||||
+ && (req->ai_flags & AI_V4MAPPED) != 0)
|
||||
+ {
|
||||
+ uint32_t *pataddr = (*pat)->addr;
|
||||
+ (*pat)->family = AF_INET6;
|
||||
+ pataddr[3] = pataddr[0];
|
||||
+ pataddr[2] = htonl (0xffff);
|
||||
+ pataddr[1] = 0;
|
||||
+ pataddr[0] = 0;
|
||||
+ pat = &((*pat)->next);
|
||||
+ no_data = 0;
|
||||
+ }
|
||||
+ else if (req->ai_family == AF_UNSPEC
|
||||
+ || (*pat)->family == req->ai_family)
|
||||
+ {
|
||||
+ pat = &((*pat)->next);
|
||||
+
|
||||
+ no_data = 0;
|
||||
+ if (req->ai_family == AF_INET6)
|
||||
+ got_ipv6 = true;
|
||||
+ }
|
||||
+ else
|
||||
+ *pat = ((*pat)->next);
|
||||
+ }
|
||||
}
|
||||
+
|
||||
+ no_inet6_data = no_data;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -905,39 +934,9 @@ gaih_inet (const char *name, const struc
|
||||
{
|
||||
if (canon == NULL)
|
||||
{
|
||||
- struct hostent *h = NULL;
|
||||
- int herrno;
|
||||
- struct hostent th;
|
||||
- size_t tmpbuflen = 512;
|
||||
- char *tmpbuf = NULL;
|
||||
-
|
||||
- do
|
||||
- {
|
||||
- tmpbuf = extend_alloca (tmpbuf, tmpbuflen, tmpbuflen * 2);
|
||||
- rc = __gethostbyaddr_r (at2->addr,
|
||||
- ((at2->family == AF_INET6)
|
||||
- ? sizeof (struct in6_addr)
|
||||
- : sizeof (struct in_addr)),
|
||||
- at2->family, &th, tmpbuf,
|
||||
- tmpbuflen, &h, &herrno);
|
||||
- }
|
||||
- while (rc == ERANGE && herrno == NETDB_INTERNAL);
|
||||
-
|
||||
- if (rc != 0 && herrno == NETDB_INTERNAL)
|
||||
- {
|
||||
- __set_h_errno (herrno);
|
||||
- return -EAI_SYSTEM;
|
||||
- }
|
||||
-
|
||||
- if (h != NULL)
|
||||
- canon = h->h_name;
|
||||
- else
|
||||
- {
|
||||
- assert (orig_name != NULL);
|
||||
- /* If the canonical name cannot be determined, use
|
||||
- the passed in string. */
|
||||
- canon = orig_name;
|
||||
- }
|
||||
+ /* If the canonical name cannot be determined, use
|
||||
+ the passed in string. */
|
||||
+ canon = orig_name;
|
||||
}
|
||||
|
||||
#ifdef HAVE_LIBIDN
|
||||
109
src/patches/glibc/glibc-rh718057.patch
Normal file
109
src/patches/glibc/glibc-rh718057.patch
Normal file
@@ -0,0 +1,109 @@
|
||||
2011-07-01 Andreas Schwab <schwab@redhat.com>
|
||||
|
||||
* nis/nss_compat/compat-pwd.c (getpwent_next_nss_netgr): Query NIS
|
||||
domain only when needed.
|
||||
|
||||
Index: glibc-2.12-2-gc4ccff1/nis/nss_compat/compat-pwd.c
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/nis/nss_compat/compat-pwd.c
|
||||
+++ glibc-2.12-2-gc4ccff1/nis/nss_compat/compat-pwd.c
|
||||
@@ -360,7 +360,7 @@ getpwent_next_nss_netgr (const char *nam
|
||||
char *group, char *buffer, size_t buflen,
|
||||
int *errnop)
|
||||
{
|
||||
- char *curdomain, *host, *user, *domain, *p2;
|
||||
+ char *curdomain = NULL, *host, *user, *domain, *p2;
|
||||
int status;
|
||||
size_t p2len;
|
||||
|
||||
@@ -369,15 +369,7 @@ getpwent_next_nss_netgr (const char *nam
|
||||
if (!nss_getpwnam_r)
|
||||
return NSS_STATUS_UNAVAIL;
|
||||
|
||||
- if (yp_get_default_domain (&curdomain) != YPERR_SUCCESS)
|
||||
- {
|
||||
- ent->netgroup = false;
|
||||
- ent->first = false;
|
||||
- give_pwd_free (&ent->pwd);
|
||||
- return NSS_STATUS_UNAVAIL;
|
||||
- }
|
||||
-
|
||||
- if (ent->first == true)
|
||||
+ if (ent->first)
|
||||
{
|
||||
memset (&ent->netgrdata, 0, sizeof (struct __netgrent));
|
||||
__internal_setnetgrent (group, &ent->netgrdata);
|
||||
@@ -403,8 +395,19 @@ getpwent_next_nss_netgr (const char *nam
|
||||
if (user == NULL || user[0] == '-')
|
||||
continue;
|
||||
|
||||
- if (domain != NULL && strcmp (curdomain, domain) != 0)
|
||||
- continue;
|
||||
+ if (domain != NULL)
|
||||
+ {
|
||||
+ if (curdomain == NULL
|
||||
+ && yp_get_default_domain (&curdomain) != YPERR_SUCCESS)
|
||||
+ {
|
||||
+ __internal_endnetgrent (&ent->netgrdata);
|
||||
+ ent->netgroup = false;
|
||||
+ give_pwd_free (&ent->pwd);
|
||||
+ return NSS_STATUS_UNAVAIL;
|
||||
+ }
|
||||
+ if (strcmp (curdomain, domain) != 0)
|
||||
+ continue;
|
||||
+ }
|
||||
|
||||
/* If name != NULL, we are called from getpwnam. */
|
||||
if (name != NULL)
|
||||
Index: glibc-2.12-2-gc4ccff1/nis/nss_compat/compat-spwd.c
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/nis/nss_compat/compat-spwd.c
|
||||
+++ glibc-2.12-2-gc4ccff1/nis/nss_compat/compat-spwd.c
|
||||
@@ -317,7 +317,7 @@ getspent_next_nss_netgr (const char *nam
|
||||
char *group, char *buffer, size_t buflen,
|
||||
int *errnop)
|
||||
{
|
||||
- char *curdomain, *host, *user, *domain, *p2;
|
||||
+ char *curdomain = NULL, *host, *user, *domain, *p2;
|
||||
size_t p2len;
|
||||
|
||||
if (!nss_getspnam_r)
|
||||
@@ -327,15 +327,7 @@ getspent_next_nss_netgr (const char *nam
|
||||
if (ent->setent_status != NSS_STATUS_SUCCESS)
|
||||
return ent->setent_status;
|
||||
|
||||
- if (yp_get_default_domain (&curdomain) != YPERR_SUCCESS)
|
||||
- {
|
||||
- ent->netgroup = false;
|
||||
- ent->first = false;
|
||||
- give_spwd_free (&ent->pwd);
|
||||
- return NSS_STATUS_UNAVAIL;
|
||||
- }
|
||||
-
|
||||
- if (ent->first == true)
|
||||
+ if (ent->first)
|
||||
{
|
||||
memset (&ent->netgrdata, 0, sizeof (struct __netgrent));
|
||||
__internal_setnetgrent (group, &ent->netgrdata);
|
||||
@@ -362,8 +354,19 @@ getspent_next_nss_netgr (const char *nam
|
||||
if (user == NULL || user[0] == '-')
|
||||
continue;
|
||||
|
||||
- if (domain != NULL && strcmp (curdomain, domain) != 0)
|
||||
- continue;
|
||||
+ if (domain != NULL)
|
||||
+ {
|
||||
+ if (curdomain == NULL
|
||||
+ && yp_get_default_domain (&curdomain) != YPERR_SUCCESS)
|
||||
+ {
|
||||
+ __internal_endnetgrent (&ent->netgrdata);
|
||||
+ ent->netgroup = false;
|
||||
+ give_spwd_free (&ent->pwd);
|
||||
+ return NSS_STATUS_UNAVAIL;
|
||||
+ }
|
||||
+ if (strcmp (curdomain, domain) != 0)
|
||||
+ continue;
|
||||
+ }
|
||||
|
||||
/* If name != NULL, we are called from getpwnam */
|
||||
if (name != NULL)
|
||||
173
src/patches/glibc/glibc-rh726517.patch
Normal file
173
src/patches/glibc/glibc-rh726517.patch
Normal file
@@ -0,0 +1,173 @@
|
||||
Index: glibc-2.12-2-gc4ccff1/malloc/arena.c
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/malloc/arena.c
|
||||
+++ glibc-2.12-2-gc4ccff1/malloc/arena.c
|
||||
@@ -870,7 +870,7 @@ heap_trim(heap, pad) heap_info *heap; si
|
||||
heap = prev_heap;
|
||||
if(!prev_inuse(p)) { /* consolidate backward */
|
||||
p = prev_chunk(p);
|
||||
- unlink(p, bck, fwd);
|
||||
+ unlink(ar_ptr, p, bck, fwd);
|
||||
}
|
||||
assert(((unsigned long)((char*)p + new_size) & (pagesz-1)) == 0);
|
||||
assert( ((char*)p + new_size) == ((char*)heap + heap->size) );
|
||||
Index: glibc-2.12-2-gc4ccff1/malloc/hooks.c
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/malloc/hooks.c
|
||||
+++ glibc-2.12-2-gc4ccff1/malloc/hooks.c
|
||||
@@ -219,7 +219,9 @@ top_check()
|
||||
(char*)t + chunksize(t) == mp_.sbrk_base + main_arena.system_mem)))
|
||||
return 0;
|
||||
|
||||
+ mutex_unlock(&main_arena);
|
||||
malloc_printerr (check_action, "malloc: top chunk is corrupt", t);
|
||||
+ mutex_lock(&main_arena);
|
||||
|
||||
/* Try to set up a new top chunk. */
|
||||
brk = MORECORE(0);
|
||||
Index: glibc-2.12-2-gc4ccff1/malloc/malloc.c
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/malloc/malloc.c
|
||||
+++ glibc-2.12-2-gc4ccff1/malloc/malloc.c
|
||||
@@ -2109,12 +2109,14 @@ typedef struct malloc_chunk* mbinptr;
|
||||
#define last(b) ((b)->bk)
|
||||
|
||||
/* Take a chunk off a bin list */
|
||||
-#define unlink(P, BK, FD) { \
|
||||
+#define unlink(AV, P, BK, FD) { \
|
||||
FD = P->fd; \
|
||||
BK = P->bk; \
|
||||
- if (__builtin_expect (FD->bk != P || BK->fd != P, 0)) \
|
||||
+ if (__builtin_expect (FD->bk != P || BK->fd != P, 0)) { \
|
||||
+ mutex_unlock(&(AV)->mutex); \
|
||||
malloc_printerr (check_action, "corrupted double-linked list", P); \
|
||||
- else { \
|
||||
+ mutex_lock(&(AV)->mutex); \
|
||||
+ } else { \
|
||||
FD->bk = BK; \
|
||||
BK->fd = FD; \
|
||||
if (!in_smallbin_range (P->size) \
|
||||
@@ -3257,7 +3259,9 @@ static Void_t* sYSMALLOc(nb, av) INTERNA
|
||||
|
||||
else if (contiguous(av) && old_size && brk < old_end) {
|
||||
/* Oops! Someone else killed our space.. Can't touch anything. */
|
||||
+ mutex_unlock(&av->mutex);
|
||||
malloc_printerr (3, "break adjusted to free malloc space", brk);
|
||||
+ mutex_lock(&av->mutex);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -4305,7 +4309,9 @@ _int_malloc(mstate av, size_t bytes)
|
||||
{
|
||||
errstr = "malloc(): memory corruption (fast)";
|
||||
errout:
|
||||
+ mutex_unlock(&av->mutex);
|
||||
malloc_printerr (check_action, errstr, chunk2mem (victim));
|
||||
+ mutex_lock(&av->mutex);
|
||||
return NULL;
|
||||
}
|
||||
#ifndef ATOMIC_FASTBINS
|
||||
@@ -4393,8 +4399,12 @@ _int_malloc(mstate av, size_t bytes)
|
||||
bck = victim->bk;
|
||||
if (__builtin_expect (victim->size <= 2 * SIZE_SZ, 0)
|
||||
|| __builtin_expect (victim->size > av->system_mem, 0))
|
||||
- malloc_printerr (check_action, "malloc(): memory corruption",
|
||||
- chunk2mem (victim));
|
||||
+ {
|
||||
+ void *p = chunk2mem(victim);
|
||||
+ mutex_unlock(&av->mutex);
|
||||
+ malloc_printerr (check_action, "malloc(): memory corruption", p);
|
||||
+ mutex_lock(&av->mutex);
|
||||
+ }
|
||||
size = chunksize(victim);
|
||||
|
||||
/*
|
||||
@@ -4535,7 +4545,7 @@ _int_malloc(mstate av, size_t bytes)
|
||||
victim = victim->fd;
|
||||
|
||||
remainder_size = size - nb;
|
||||
- unlink(victim, bck, fwd);
|
||||
+ unlink(av, victim, bck, fwd);
|
||||
|
||||
/* Exhaust */
|
||||
if (remainder_size < MINSIZE) {
|
||||
@@ -4633,7 +4643,7 @@ _int_malloc(mstate av, size_t bytes)
|
||||
remainder_size = size - nb;
|
||||
|
||||
/* unlink */
|
||||
- unlink(victim, bck, fwd);
|
||||
+ unlink(av, victim, bck, fwd);
|
||||
|
||||
/* Exhaust */
|
||||
if (remainder_size < MINSIZE) {
|
||||
@@ -4789,10 +4799,14 @@ _int_free(mstate av, mchunkptr p)
|
||||
errstr = "free(): invalid pointer";
|
||||
errout:
|
||||
#ifdef ATOMIC_FASTBINS
|
||||
- if (! have_lock && locked)
|
||||
+ if (have_lock || locked)
|
||||
(void)mutex_unlock(&av->mutex);
|
||||
#endif
|
||||
malloc_printerr (check_action, errstr, chunk2mem(p));
|
||||
+#ifdef ATOMIC_FASTBINS
|
||||
+ if (have_lock)
|
||||
+ mutex_lock(&av->mutex);
|
||||
+#endif
|
||||
return;
|
||||
}
|
||||
/* We know that each chunk is at least MINSIZE bytes in size. */
|
||||
@@ -4961,7 +4975,7 @@ _int_free(mstate av, mchunkptr p)
|
||||
prevsize = p->prev_size;
|
||||
size += prevsize;
|
||||
p = chunk_at_offset(p, -((long) prevsize));
|
||||
- unlink(p, bck, fwd);
|
||||
+ unlink(av, p, bck, fwd);
|
||||
}
|
||||
|
||||
if (nextchunk != av->top) {
|
||||
@@ -4970,7 +4984,7 @@ _int_free(mstate av, mchunkptr p)
|
||||
|
||||
/* consolidate forward */
|
||||
if (!nextinuse) {
|
||||
- unlink(nextchunk, bck, fwd);
|
||||
+ unlink(av, nextchunk, bck, fwd);
|
||||
size += nextsize;
|
||||
} else
|
||||
clear_inuse_bit_at_offset(nextchunk, 0);
|
||||
@@ -5158,7 +5172,7 @@ static void malloc_consolidate(av) mstat
|
||||
prevsize = p->prev_size;
|
||||
size += prevsize;
|
||||
p = chunk_at_offset(p, -((long) prevsize));
|
||||
- unlink(p, bck, fwd);
|
||||
+ unlink(av, p, bck, fwd);
|
||||
}
|
||||
|
||||
if (nextchunk != av->top) {
|
||||
@@ -5166,7 +5180,7 @@ static void malloc_consolidate(av) mstat
|
||||
|
||||
if (!nextinuse) {
|
||||
size += nextsize;
|
||||
- unlink(nextchunk, bck, fwd);
|
||||
+ unlink(av, nextchunk, bck, fwd);
|
||||
} else
|
||||
clear_inuse_bit_at_offset(nextchunk, 0);
|
||||
|
||||
@@ -5235,7 +5249,9 @@ _int_realloc(mstate av, mchunkptr oldp,
|
||||
{
|
||||
errstr = "realloc(): invalid old size";
|
||||
errout:
|
||||
+ mutex_unlock(&av->mutex);
|
||||
malloc_printerr (check_action, errstr, chunk2mem(oldp));
|
||||
+ mutex_lock(&av->mutex);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -5282,7 +5298,7 @@ _int_realloc(mstate av, mchunkptr oldp,
|
||||
(unsigned long)(newsize = oldsize + nextsize) >=
|
||||
(unsigned long)(nb)) {
|
||||
newp = oldp;
|
||||
- unlink(next, bck, fwd);
|
||||
+ unlink(av, next, bck, fwd);
|
||||
}
|
||||
|
||||
/* allocate, copy, free */
|
||||
34
src/patches/glibc/glibc-rh730379.patch
Normal file
34
src/patches/glibc/glibc-rh730379.patch
Normal file
@@ -0,0 +1,34 @@
|
||||
2011-08-17 Ulrich Drepper <drepper@gmail.com>
|
||||
|
||||
* Makeconfig (override CFLAGS): Add library-specific CFLAGS.
|
||||
* resolv/Makefile: Define CFLAGS-libresolv.
|
||||
|
||||
Index: glibc-2.12-2-gc4ccff1/Makeconfig
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/Makeconfig
|
||||
+++ glibc-2.12-2-gc4ccff1/Makeconfig
|
||||
@@ -700,7 +700,9 @@ CPPFLAGS = $($(subdir)-CPPFLAGS) $(+incl
|
||||
override CFLAGS = -std=gnu99 $(gnu89-inline-CFLAGS) \
|
||||
$(filter-out %frame-pointer,$(+cflags)) $(+gccwarn-c) \
|
||||
$(sysdep-CFLAGS) $(CFLAGS-$(suffix $@)) $(CFLAGS-$(<F)) \
|
||||
- $(CFLAGS-$(@F))
|
||||
+ $(CFLAGS-$(@F)) \
|
||||
+ $(foreach lib,$(libof-$(basename $(@F))) \
|
||||
+ $(libof-$(<F)) $(libof-$(@F)),$(CFLAGS-$(lib)))
|
||||
override CXXFLAGS = $(c++-sysincludes) \
|
||||
$(filter-out %frame-pointer,$(+cflags)) $(sysdep-CFLAGS) \
|
||||
$(CFLAGS-$(suffix $@)) $(CFLAGS-$(<F)) $(CFLAGS-$(@F))
|
||||
Index: glibc-2.12-2-gc4ccff1/resolv/Makefile
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/resolv/Makefile
|
||||
+++ glibc-2.12-2-gc4ccff1/resolv/Makefile
|
||||
@@ -76,6 +76,9 @@ CPPFLAGS += -Dgethostbyname=res_gethostb
|
||||
-Dgetnetbyname=res_getnetbyname \
|
||||
-Dgetnetbyaddr=res_getnetbyaddr
|
||||
|
||||
+ifeq (yes,$(have-ssp))
|
||||
+CFLAGS-libresolv += -fstack-protector
|
||||
+endif
|
||||
CFLAGS-res_hconf.c = -fexceptions
|
||||
CFLAGS-res_send.c += -fno-strict-aliasing
|
||||
|
||||
51
src/patches/glibc/glibc-rh731042.patch
Normal file
51
src/patches/glibc/glibc-rh731042.patch
Normal file
@@ -0,0 +1,51 @@
|
||||
2011-08-08 Andreas Schwab <schwab@redhat.com>
|
||||
|
||||
* sysdeps/unix/sysv/linux/x86_64/cancellation.S: Maintain aligned
|
||||
stack.
|
||||
* sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S: Likewise.
|
||||
* sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S: Likewise.
|
||||
|
||||
Index: glibc-2.12-2-gc4ccff1/nptl/sysdeps/unix/sysv/linux/x86_64/cancellation.S
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/nptl/sysdeps/unix/sysv/linux/x86_64/cancellation.S
|
||||
+++ glibc-2.12-2-gc4ccff1/nptl/sysdeps/unix/sysv/linux/x86_64/cancellation.S
|
||||
@@ -71,7 +71,9 @@ ENTRY(__pthread_enable_asynccancel)
|
||||
|
||||
1: ret
|
||||
|
||||
-3: movq $TCB_PTHREAD_CANCELED, %fs:RESULT
|
||||
+3: subq $8, %rsp
|
||||
+ cfi_adjust_cfa_offset(8)
|
||||
+ movq $TCB_PTHREAD_CANCELED, %fs:RESULT
|
||||
lock
|
||||
orl $TCB_EXITING_BITMASK, %fs:CANCELHANDLING
|
||||
movq %fs:CLEANUP_JMP_BUF, %rdi
|
||||
Index: glibc-2.12-2-gc4ccff1/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S
|
||||
+++ glibc-2.12-2-gc4ccff1/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S
|
||||
@@ -63,9 +63,9 @@ __pthread_cond_timedwait:
|
||||
cfi_adjust_cfa_offset(8)
|
||||
cfi_rel_offset(%r15, 0)
|
||||
#ifdef __ASSUME_FUTEX_CLOCK_REALTIME
|
||||
-# define FRAME_SIZE 32
|
||||
+# define FRAME_SIZE (32+8)
|
||||
#else
|
||||
-# define FRAME_SIZE 48
|
||||
+# define FRAME_SIZE (48+8)
|
||||
#endif
|
||||
subq $FRAME_SIZE, %rsp
|
||||
cfi_adjust_cfa_offset(FRAME_SIZE)
|
||||
Index: glibc-2.12-2-gc4ccff1/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S
|
||||
+++ glibc-2.12-2-gc4ccff1/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S
|
||||
@@ -45,7 +45,7 @@ __pthread_cond_wait:
|
||||
cfi_lsda(DW_EH_PE_udata4, .LexceptSTART)
|
||||
#endif
|
||||
|
||||
-#define FRAME_SIZE 32
|
||||
+#define FRAME_SIZE (32+8)
|
||||
leaq -FRAME_SIZE(%rsp), %rsp
|
||||
cfi_adjust_cfa_offset(FRAME_SIZE)
|
||||
|
||||
116
src/patches/glibc/glibc-rh736346.patch
Normal file
116
src/patches/glibc/glibc-rh736346.patch
Normal file
@@ -0,0 +1,116 @@
|
||||
2011-01-14 Ulrich Drepper <drepper@gmail.com>
|
||||
|
||||
[BZ #10563]
|
||||
* sysdeps/unix/sysv/linux/i386/setgroups.c: Use INLINE_SETXID_SYSCALL
|
||||
to make the syscall.
|
||||
* sysdeps/unix/sysv/linux/setgroups.c: New file.
|
||||
|
||||
2011-01-14 Ulrich Drepper <drepper@gmail.com>
|
||||
|
||||
[BZ #10563]
|
||||
* sysdeps/pthread/setxid.h (__SETXID_1): Add cast to assignment.
|
||||
(__SETXID_2): Likewise.
|
||||
(__SETXID_3): Likewise.
|
||||
|
||||
Index: glibc-2.12-2-gc4ccff1/nptl/sysdeps/pthread/setxid.h
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/nptl/sysdeps/pthread/setxid.h
|
||||
+++ glibc-2.12-2-gc4ccff1/nptl/sysdeps/pthread/setxid.h
|
||||
@@ -20,11 +20,11 @@
|
||||
#include <sysdep.h>
|
||||
|
||||
#define __SETXID_1(cmd, arg1) \
|
||||
- cmd.id[0] = arg1
|
||||
+ cmd.id[0] = (long int) arg1
|
||||
#define __SETXID_2(cmd, arg1, arg2) \
|
||||
- __SETXID_1 (cmd, arg1); cmd.id[1] = arg2
|
||||
+ __SETXID_1 (cmd, arg1); cmd.id[1] = (long int) arg2
|
||||
#define __SETXID_3(cmd, arg1, arg2, arg3) \
|
||||
- __SETXID_2 (cmd, arg1, arg2); cmd.id[2] = arg3
|
||||
+ __SETXID_2 (cmd, arg1, arg2); cmd.id[2] = (long int) arg3
|
||||
|
||||
#ifdef SINGLE_THREAD
|
||||
# define INLINE_SETXID_SYSCALL(name, nr, args...) \
|
||||
Index: glibc-2.12-2-gc4ccff1/sysdeps/unix/sysv/linux/i386/setgroups.c
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/sysdeps/unix/sysv/linux/i386/setgroups.c
|
||||
+++ glibc-2.12-2-gc4ccff1/sysdeps/unix/sysv/linux/i386/setgroups.c
|
||||
@@ -25,6 +25,7 @@
|
||||
#include <sys/syscall.h>
|
||||
#include <bp-checks.h>
|
||||
|
||||
+#include <setxid.h>
|
||||
#include <linux/posix_types.h>
|
||||
#include <kernel-features.h>
|
||||
|
||||
@@ -44,7 +45,7 @@ int
|
||||
setgroups (size_t n, const gid_t *groups)
|
||||
{
|
||||
#if __ASSUME_32BITUIDS > 0
|
||||
- return INLINE_SYSCALL (setgroups32, 2, n, CHECK_N (groups, n));
|
||||
+ return INLINE_SETXID_SYSCALL (setgroups32, 2, n, CHECK_N (groups, n));
|
||||
#else
|
||||
if (n > (size_t) __sysconf (_SC_NGROUPS_MAX))
|
||||
{
|
||||
@@ -62,7 +63,8 @@ setgroups (size_t n, const gid_t *groups
|
||||
int result;
|
||||
int saved_errno = errno;
|
||||
|
||||
- result = INLINE_SYSCALL (setgroups32, 2, n, CHECK_N (groups, n));
|
||||
+ result = INLINE_SETXID_SYSCALL (setgroups32, 2, n,
|
||||
+ CHECK_N (groups, n));
|
||||
if (result == 0 || errno != ENOSYS)
|
||||
return result;
|
||||
|
||||
@@ -80,7 +82,8 @@ setgroups (size_t n, const gid_t *groups
|
||||
}
|
||||
}
|
||||
|
||||
- return INLINE_SYSCALL (setgroups, 2, n, CHECK_N (kernel_groups, n));
|
||||
+ return INLINE_SETXID_SYSCALL (setgroups, 2, n,
|
||||
+ CHECK_N (kernel_groups, n));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
Index: glibc-2.12-2-gc4ccff1/sysdeps/unix/sysv/linux/setgroups.c
|
||||
===================================================================
|
||||
--- /dev/null
|
||||
+++ glibc-2.12-2-gc4ccff1/sysdeps/unix/sysv/linux/setgroups.c
|
||||
@@ -0,0 +1,37 @@
|
||||
+/* Copyright (C) 1997,1998,2000,2002,2004,2006,2011
|
||||
+ Free Software Foundation, Inc.
|
||||
+ This file is part of the GNU C Library.
|
||||
+
|
||||
+ The GNU C Library is free software; you can redistribute it and/or
|
||||
+ modify it under the terms of the GNU Lesser General Public
|
||||
+ License as published by the Free Software Foundation; either
|
||||
+ version 2.1 of the License, or (at your option) any later version.
|
||||
+
|
||||
+ The GNU C Library is distributed in the hope that it will be useful,
|
||||
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
+ Lesser General Public License for more details.
|
||||
+
|
||||
+ You should have received a copy of the GNU Lesser General Public
|
||||
+ License along with the GNU C Library; if not, write to the Free
|
||||
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
+ 02111-1307 USA. */
|
||||
+
|
||||
+#include <errno.h>
|
||||
+#include <grp.h>
|
||||
+#include <setxid.h>
|
||||
+#include <sysdep.h>
|
||||
+
|
||||
+
|
||||
+/* Set the group set for the current user to GROUPS (N of them). For
|
||||
+ Linux we must convert the array of groups into the format that the
|
||||
+ kernel expects. */
|
||||
+int
|
||||
+setgroups (size_t n, const gid_t *groups)
|
||||
+{
|
||||
+#ifdef __NR_setgroups32
|
||||
+# error "wrong setgroups.c file used"
|
||||
+#endif
|
||||
+ return INLINE_SETXID_SYSCALL (setgroups, 2, n, groups);
|
||||
+}
|
||||
+libc_hidden_def (setgroups)
|
||||
122
src/patches/glibc/glibc-rh737778.patch
Normal file
122
src/patches/glibc/glibc-rh737778.patch
Normal file
@@ -0,0 +1,122 @@
|
||||
2011-08-14 Roland McGrath <roland@hack.frob.com>
|
||||
|
||||
* locale/Makefile (locale-CPPFLAGS): Renamed CPPFLAGS-locale-programs.
|
||||
(locale-CPPFLAGS): New variable; put LOCALEDIR, LOCALE_ALIAS_PATH and
|
||||
-Iprograms here.
|
||||
(cppflags-iterator.mk sequence): Use locale-programs in place of nonlib.
|
||||
(localedef-modules): Add localedef.
|
||||
(locale-modules): Add locale.
|
||||
|
||||
2011-08-13 Ulrich Drepper <drepper@gmail.com>
|
||||
|
||||
* intl/l10nflist.c (_nl_normalize_codeset): Make it compile outside
|
||||
of libc. Make tolower call locale-independent. Optimize a bit by
|
||||
using isdigit instead of isalnum.
|
||||
* locale/Makefile (locale-CPPFLAGS): Add -DNOT_IN_libc.
|
||||
|
||||
2011-08-11 Ulrich Drepper <drepper@gmail.com>
|
||||
|
||||
* intl/l10nflist.c (_nl_make_l10nflist): Use locale-independent
|
||||
classification.
|
||||
|
||||
Index: glibc-2.12-2-gc4ccff1/intl/l10nflist.c
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/intl/l10nflist.c
|
||||
+++ glibc-2.12-2-gc4ccff1/intl/l10nflist.c
|
||||
@@ -332,13 +332,18 @@ _nl_normalize_codeset (codeset, name_len
|
||||
char *retval;
|
||||
char *wp;
|
||||
size_t cnt;
|
||||
+#ifdef NOT_IN_libc
|
||||
+ locale_t locale = newlocale (0, "C", NULL);
|
||||
+#else
|
||||
+# define locale _nl_C_locobj_ptr
|
||||
+#endif
|
||||
|
||||
for (cnt = 0; cnt < name_len; ++cnt)
|
||||
- if (isalnum ((unsigned char) codeset[cnt]))
|
||||
+ if (__isalnum_l ((unsigned char) codeset[cnt], locale))
|
||||
{
|
||||
++len;
|
||||
|
||||
- if (isalpha ((unsigned char) codeset[cnt]))
|
||||
+ if (! __isdigit_l ((unsigned char) codeset[cnt], locale))
|
||||
only_digit = 0;
|
||||
}
|
||||
|
||||
@@ -346,15 +351,14 @@ _nl_normalize_codeset (codeset, name_len
|
||||
|
||||
if (retval != NULL)
|
||||
{
|
||||
+ wp = retval;
|
||||
if (only_digit)
|
||||
- wp = stpcpy (retval, "iso");
|
||||
- else
|
||||
- wp = retval;
|
||||
+ wp = stpcpy (wp, "iso");
|
||||
|
||||
for (cnt = 0; cnt < name_len; ++cnt)
|
||||
- if (isalpha ((unsigned char) codeset[cnt]))
|
||||
- *wp++ = tolower ((unsigned char) codeset[cnt]);
|
||||
- else if (isdigit ((unsigned char) codeset[cnt]))
|
||||
+ if (__isalpha_l ((unsigned char) codeset[cnt], locale))
|
||||
+ *wp++ = __tolower_l ((unsigned char) codeset[cnt], locale);
|
||||
+ else if (__isdigit_l ((unsigned char) codeset[cnt], locale))
|
||||
*wp++ = codeset[cnt];
|
||||
|
||||
*wp = '\0';
|
||||
Index: glibc-2.12-2-gc4ccff1/locale/Makefile
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/locale/Makefile
|
||||
+++ glibc-2.12-2-gc4ccff1/locale/Makefile
|
||||
@@ -59,10 +59,11 @@ vpath %.c programs ../crypt
|
||||
vpath %.h programs
|
||||
vpath %.gperf programs
|
||||
|
||||
-localedef-modules := $(categories:%=ld-%) charmap linereader locfile \
|
||||
+localedef-modules := localedef $(categories:%=ld-%) \
|
||||
+ charmap linereader locfile \
|
||||
repertoire locarchive
|
||||
localedef-aux := md5
|
||||
-locale-modules := locale-spec
|
||||
+locale-modules := locale locale-spec
|
||||
lib-modules := charmap-dir simple-hash xmalloc xstrdup
|
||||
|
||||
|
||||
@@ -90,22 +91,27 @@ endif
|
||||
|
||||
localepath = "$(localedir):$(i18ndir)"
|
||||
|
||||
-locale-CPPFLAGS := -DLOCALE_PATH='$(localepath)' \
|
||||
- -DLOCALEDIR='"$(localedir)"' \
|
||||
- -DLOCALE_ALIAS_PATH='"$(msgcatdir)"' \
|
||||
- -DCHARMAP_PATH='"$(i18ndir)/charmaps"' \
|
||||
- -DREPERTOIREMAP_PATH='"$(i18ndir)/repertoiremaps"' \
|
||||
- -DLOCSRCDIR='"$(i18ndir)/locales"' -DHAVE_CONFIG_H \
|
||||
- -Iprograms
|
||||
+# -Iprograms doesn't really belong here, but this gets it at the head
|
||||
+# of the list instead of the tail, where CPPFLAGS-$(lib) gets added.
|
||||
+# We need it before the standard -I's to see programs/config.h first.
|
||||
+locale-CPPFLAGS = -DLOCALEDIR='"$(localedir)"' \
|
||||
+ -DLOCALE_ALIAS_PATH='"$(msgcatdir)"' \
|
||||
+ -Iprograms
|
||||
+
|
||||
+CPPFLAGS-locale-programs = -DLOCALE_PATH='$(localepath)' \
|
||||
+ -DCHARMAP_PATH='"$(i18ndir)/charmaps"' \
|
||||
+ -DREPERTOIREMAP_PATH='"$(i18ndir)/repertoiremaps"' \
|
||||
+ -DLOCSRCDIR='"$(i18ndir)/locales"' \
|
||||
+ -DHAVE_CONFIG_H -DNOT_IN_libc
|
||||
|
||||
CFLAGS-charmap.c = -Wno-write-strings -Wno-char-subscripts
|
||||
CFLAGS-locfile.c = -Wno-write-strings -Wno-char-subscripts
|
||||
CFLAGS-charmap-dir.c = -Wno-write-strings
|
||||
|
||||
-# This makes sure -DNOT_IN_libc is passed for all these modules.
|
||||
+# This makes sure -DNOT_IN_libc et al are passed for all these modules.
|
||||
cpp-srcs-left := $(addsuffix .c,$(localedef-modules) $(localedef-aux) \
|
||||
$(locale-modules) $(lib-modules))
|
||||
-lib := nonlib
|
||||
+lib := locale-programs
|
||||
include $(patsubst %,$(..)cppflags-iterator.mk,$(cpp-srcs-left))
|
||||
|
||||
# Depend on libc.so so a DT_NEEDED is generated in the shared objects.
|
||||
149
src/patches/glibc/glibc-rh738665.patch
Normal file
149
src/patches/glibc/glibc-rh738665.patch
Normal file
@@ -0,0 +1,149 @@
|
||||
2011-09-15 Andreas Schwab <schwab@redhat.com>
|
||||
|
||||
* sysdeps/pthread/list.h: Define only list_t if __need_list_t is
|
||||
defined.
|
||||
(list_add): Add atomic_write_barrier.
|
||||
* descr.h: Define __need_list_t before including <list.h>.
|
||||
* nptl-init.c: Include <list.h>
|
||||
* allocatestack.c: Likewise.
|
||||
|
||||
2011-09-15 Andreas Schwab <schwab@redhat.com>
|
||||
|
||||
* thread_dbP.h: Include <list.h>
|
||||
|
||||
Index: glibc-2.12-2-gc4ccff1/nptl/allocatestack.c
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/nptl/allocatestack.c
|
||||
+++ glibc-2.12-2-gc4ccff1/nptl/allocatestack.c
|
||||
@@ -27,6 +27,7 @@
|
||||
#include <sys/param.h>
|
||||
#include <dl-sysdep.h>
|
||||
#include <tls.h>
|
||||
+#include <list.h>
|
||||
#include <lowlevellock.h>
|
||||
#include <kernel-features.h>
|
||||
|
||||
Index: glibc-2.12-2-gc4ccff1/nptl/descr.h
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/nptl/descr.h
|
||||
+++ glibc-2.12-2-gc4ccff1/nptl/descr.h
|
||||
@@ -26,6 +26,7 @@
|
||||
#include <stdbool.h>
|
||||
#include <sys/types.h>
|
||||
#include <hp-timing.h>
|
||||
+#define __need_list_t
|
||||
#include <list.h>
|
||||
#include <lowlevellock.h>
|
||||
#include <pthreaddef.h>
|
||||
Index: glibc-2.12-2-gc4ccff1/nptl/nptl-init.c
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/nptl/nptl-init.c
|
||||
+++ glibc-2.12-2-gc4ccff1/nptl/nptl-init.c
|
||||
@@ -29,6 +29,7 @@
|
||||
#include <atomic.h>
|
||||
#include <ldsodefs.h>
|
||||
#include <tls.h>
|
||||
+#include <list.h>
|
||||
#include <fork.h>
|
||||
#include <version.h>
|
||||
#include <shlib-compat.h>
|
||||
Index: glibc-2.12-2-gc4ccff1/nptl/sysdeps/pthread/list.h
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/nptl/sysdeps/pthread/list.h
|
||||
+++ glibc-2.12-2-gc4ccff1/nptl/sysdeps/pthread/list.h
|
||||
@@ -18,27 +18,39 @@
|
||||
02111-1307 USA. */
|
||||
|
||||
#ifndef _LIST_H
|
||||
-#define _LIST_H 1
|
||||
+
|
||||
+#ifndef __need_list_t
|
||||
+# define _LIST_H 1
|
||||
+#endif
|
||||
|
||||
/* The definitions of this file are adopted from those which can be
|
||||
found in the Linux kernel headers to enable people familiar with
|
||||
the latter find their way in these sources as well. */
|
||||
|
||||
|
||||
+#if defined __need_list_t || defined _LIST_H
|
||||
+# ifndef __list_t_defined
|
||||
+# define __list_t_defined
|
||||
/* Basic type for the double-link list. */
|
||||
typedef struct list_head
|
||||
{
|
||||
struct list_head *next;
|
||||
struct list_head *prev;
|
||||
} list_t;
|
||||
+# endif
|
||||
+# undef __need_list_t
|
||||
+#endif
|
||||
+
|
||||
+#ifdef _LIST_H
|
||||
|
||||
+# include <atomic.h>
|
||||
|
||||
/* Define a variable with the head and tail of the list. */
|
||||
-#define LIST_HEAD(name) \
|
||||
+# define LIST_HEAD(name) \
|
||||
list_t name = { &(name), &(name) }
|
||||
|
||||
/* Initialize a new list head. */
|
||||
-#define INIT_LIST_HEAD(ptr) \
|
||||
+# define INIT_LIST_HEAD(ptr) \
|
||||
(ptr)->next = (ptr)->prev = (ptr)
|
||||
|
||||
|
||||
@@ -49,6 +61,7 @@ list_add (list_t *newp, list_t *head)
|
||||
newp->next = head->next;
|
||||
newp->prev = head;
|
||||
head->next->prev = newp;
|
||||
+ atomic_write_barrier ();
|
||||
head->next = newp;
|
||||
}
|
||||
|
||||
@@ -78,26 +91,28 @@ list_splice (list_t *add, list_t *head)
|
||||
|
||||
|
||||
/* Get typed element from list at a given position. */
|
||||
-#define list_entry(ptr, type, member) \
|
||||
+# define list_entry(ptr, type, member) \
|
||||
((type *) ((char *) (ptr) - (unsigned long) (&((type *) 0)->member)))
|
||||
|
||||
|
||||
|
||||
/* Iterate forward over the elements of the list. */
|
||||
-#define list_for_each(pos, head) \
|
||||
+# define list_for_each(pos, head) \
|
||||
for (pos = (head)->next; pos != (head); pos = pos->next)
|
||||
|
||||
|
||||
/* Iterate forward over the elements of the list. */
|
||||
-#define list_for_each_prev(pos, head) \
|
||||
+# define list_for_each_prev(pos, head) \
|
||||
for (pos = (head)->prev; pos != (head); pos = pos->prev)
|
||||
|
||||
|
||||
/* Iterate backwards over the elements list. The list elements can be
|
||||
removed from the list while doing this. */
|
||||
-#define list_for_each_prev_safe(pos, p, head) \
|
||||
+# define list_for_each_prev_safe(pos, p, head) \
|
||||
for (pos = (head)->prev, p = pos->prev; \
|
||||
pos != (head); \
|
||||
pos = p, p = pos->prev)
|
||||
|
||||
+#endif /* _LIST_H */
|
||||
+
|
||||
#endif /* list.h */
|
||||
Index: glibc-2.12-2-gc4ccff1/nptl_db/thread_dbP.h
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/nptl_db/thread_dbP.h
|
||||
+++ glibc-2.12-2-gc4ccff1/nptl_db/thread_dbP.h
|
||||
@@ -29,6 +29,7 @@
|
||||
#include "proc_service.h"
|
||||
#include "thread_db.h"
|
||||
#include "../nptl/pthreadP.h" /* This is for *_BITMASK only. */
|
||||
+#include <list.h>
|
||||
|
||||
/* Indeces for the symbol names. */
|
||||
enum
|
||||
17
src/patches/glibc/glibc-rh738763.patch
Normal file
17
src/patches/glibc/glibc-rh738763.patch
Normal file
@@ -0,0 +1,17 @@
|
||||
2011-09-15 Ulrich Drepper <drepper@gmail.com>
|
||||
|
||||
* sysdeps/unix/sysv/linux/bits/in.h (IP_MULTICAST_ALL): Define.
|
||||
Patch mostly by Neil Horman <nhorman@tuxdriver.com>.
|
||||
|
||||
Index: glibc-2.12-2-gc4ccff1/sysdeps/unix/sysv/linux/bits/in.h
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/sysdeps/unix/sysv/linux/bits/in.h
|
||||
+++ glibc-2.12-2-gc4ccff1/sysdeps/unix/sysv/linux/bits/in.h
|
||||
@@ -70,6 +70,7 @@
|
||||
#define IP_XFRM_POLICY 17
|
||||
#define IP_PASSSEC 18
|
||||
#define IP_TRANSPARENT 19
|
||||
+#define IP_MULTICAST_ALL 49 /* bool */
|
||||
|
||||
/* TProxy original addresses */
|
||||
#define IP_ORIGDSTADDR 20
|
||||
18
src/patches/glibc/glibc-rh739184.patch
Normal file
18
src/patches/glibc/glibc-rh739184.patch
Normal file
@@ -0,0 +1,18 @@
|
||||
2010-06-10 Andreas Schwab <schwab@redhat.com>
|
||||
|
||||
* sysdeps/unix/sysv/linux/getpagesize.c: Don't assume AT_PAGESIZE
|
||||
is always available.
|
||||
|
||||
Index: glibc-2.12-2-gc4ccff1/sysdeps/unix/sysv/linux/getpagesize.c
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/sysdeps/unix/sysv/linux/getpagesize.c
|
||||
+++ glibc-2.12-2-gc4ccff1/sysdeps/unix/sysv/linux/getpagesize.c
|
||||
@@ -28,7 +28,7 @@
|
||||
int
|
||||
__getpagesize ()
|
||||
{
|
||||
-#ifdef __ASSUME_AT_PAGESIZE
|
||||
+#if 0 && defined __ASSUME_AT_PAGESIZE
|
||||
assert (GLRO(dl_pagesize) != 0);
|
||||
return GLRO(dl_pagesize);
|
||||
#else
|
||||
44
src/patches/glibc/glibc-rh739971.patch
Normal file
44
src/patches/glibc/glibc-rh739971.patch
Normal file
@@ -0,0 +1,44 @@
|
||||
commit 32c76b63be605d12314e0c6ac2bd702c883d1423
|
||||
Author: Andreas Schwab <schwab@redhat.com>
|
||||
Date: Mon Sep 26 17:49:14 2011 +0200
|
||||
|
||||
Correctly reparse group line after enlarging the buffer
|
||||
|
||||
diff --git a/nss/nss_files/files-initgroups.c b/nss/nss_files/files-initgroups.c
|
||||
index 113abf2..c343b35 100644
|
||||
--- a/nss/nss_files/files-initgroups.c
|
||||
+++ b/nss/nss_files/files-initgroups.c
|
||||
@@ -52,8 +52,10 @@ _nss_files_initgroups_dyn (const char *user, gid_t group, long int *start,
|
||||
gid_t *groups = *groupsp;
|
||||
|
||||
/* We have to iterate over the entire file. */
|
||||
- while (!feof_unlocked (stream))
|
||||
+ while (1)
|
||||
{
|
||||
+ fpos_t pos;
|
||||
+ fgetpos (stream, &pos);
|
||||
ssize_t n = getline (&line, &linelen, stream);
|
||||
if (n < 0)
|
||||
{
|
||||
@@ -64,9 +66,8 @@ _nss_files_initgroups_dyn (const char *user, gid_t group, long int *start,
|
||||
}
|
||||
|
||||
struct group grp;
|
||||
- int res;
|
||||
- while ((res = _nss_files_parse_grent (line, &grp, buffer, buflen,
|
||||
- errnop)) == -1)
|
||||
+ int res = _nss_files_parse_grent (line, &grp, buffer, buflen, errnop);
|
||||
+ if (res == -1)
|
||||
{
|
||||
size_t newbuflen = 2 * buflen;
|
||||
if (buffer_use_malloc || ! __libc_use_alloca (buflen + newbuflen))
|
||||
@@ -85,6 +86,9 @@ _nss_files_initgroups_dyn (const char *user, gid_t group, long int *start,
|
||||
}
|
||||
else
|
||||
buffer = extend_alloca (buffer, buflen, newbuflen);
|
||||
+ /* Reread current line, the parser has clobbered it. */
|
||||
+ fsetpos (stream, &pos);
|
||||
+ continue;
|
||||
}
|
||||
|
||||
if (res > 0 && grp.gr_gid != group)
|
||||
35
src/patches/glibc/glibc-rh740506-2.patch
Normal file
35
src/patches/glibc/glibc-rh740506-2.patch
Normal file
@@ -0,0 +1,35 @@
|
||||
* malloc/arena.c (arena_get2): Avoid unnecessarily
|
||||
retrieving #cpus from /proc.
|
||||
* malloc/malloc.c (mALLOPt): Clamp arena_test based on
|
||||
the value of arena_max.
|
||||
|
||||
diff --git a/malloc/arena.c b/malloc/arena.c
|
||||
index cb8548b..00f1da5 100644
|
||||
--- a/malloc/arena.c
|
||||
+++ b/malloc/arena.c
|
||||
@@ -828,7 +828,7 @@ arena_get2(mstate a_tsd, size_t size)
|
||||
{
|
||||
if (mp_.arena_max != 0)
|
||||
narenas_limit = mp_.arena_max;
|
||||
- else
|
||||
+ else if (narenas > mp_.arena_test)
|
||||
{
|
||||
int n = __get_nprocs ();
|
||||
|
||||
diff --git a/malloc/malloc.c b/malloc/malloc.c
|
||||
index 8608083..f8d32da 100644
|
||||
--- a/malloc/malloc.c
|
||||
+++ b/malloc/malloc.c
|
||||
@@ -6134,6 +6134,12 @@ int mALLOPt(param_number, value) int par
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
+#ifdef PER_THREAD
|
||||
+ /* Clamp ARENA_TEST from ARENA_MAX to avoid creating too many
|
||||
+ arenas. */
|
||||
+ if (mp_.arena_max > 0 && mp_.arena_max <= mp_.arena_test)
|
||||
+ mp_.arena_test = mp_.arena_max - 1;
|
||||
+#endif
|
||||
(void)mutex_unlock(&av->mutex);
|
||||
return res;
|
||||
}
|
||||
132
src/patches/glibc/glibc-rh740506.patch
Normal file
132
src/patches/glibc/glibc-rh740506.patch
Normal file
@@ -0,0 +1,132 @@
|
||||
2011-11-14 Andreas Schwab <schwab@redhat.com>
|
||||
|
||||
* malloc/arena.c (arena_get2): Don't call reused_arena when
|
||||
_int_new_arena failed.
|
||||
|
||||
2011-11-10 Andreas Schwab <schwab@redhat.com>
|
||||
|
||||
* malloc/arena.c (_int_new_arena): Don't increment narenas.
|
||||
(reused_arena): Don't check arena limit.
|
||||
(arena_get2): Atomically check arena limit.
|
||||
|
||||
diff --git a/malloc/arena.c b/malloc/arena.c
|
||||
index 9114fd2..042cac8 100644
|
||||
--- a/malloc/arena.c
|
||||
+++ b/malloc/arena.c
|
||||
@@ -747,8 +747,6 @@ _int_new_arena(size_t size)
|
||||
main_arena.next = a;
|
||||
|
||||
#ifdef PER_THREAD
|
||||
- ++narenas;
|
||||
-
|
||||
(void)mutex_unlock(&list_lock);
|
||||
#endif
|
||||
|
||||
@@ -786,30 +784,6 @@ get_free_list (void)
|
||||
static mstate
|
||||
reused_arena (void)
|
||||
{
|
||||
- if (narenas <= mp_.arena_test)
|
||||
- return NULL;
|
||||
-
|
||||
- static int narenas_limit;
|
||||
- if (narenas_limit == 0)
|
||||
- {
|
||||
- if (mp_.arena_max != 0)
|
||||
- narenas_limit = mp_.arena_max;
|
||||
- else
|
||||
- {
|
||||
- int n = __get_nprocs ();
|
||||
-
|
||||
- if (n >= 1)
|
||||
- narenas_limit = NARENAS_FROM_NCORES (n);
|
||||
- else
|
||||
- /* We have no information about the system. Assume two
|
||||
- cores. */
|
||||
- narenas_limit = NARENAS_FROM_NCORES (2);
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- if (narenas < narenas_limit)
|
||||
- return NULL;
|
||||
-
|
||||
mstate result;
|
||||
static mstate next_to_use;
|
||||
if (next_to_use == NULL)
|
||||
@@ -844,10 +818,41 @@ arena_get2(mstate a_tsd, size_t size)
|
||||
mstate a;
|
||||
|
||||
#ifdef PER_THREAD
|
||||
- if ((a = get_free_list ()) == NULL
|
||||
- && (a = reused_arena ()) == NULL)
|
||||
- /* Nothing immediately available, so generate a new arena. */
|
||||
- a = _int_new_arena(size);
|
||||
+ static size_t narenas_limit;
|
||||
+
|
||||
+ a = get_free_list ();
|
||||
+ if (a == NULL)
|
||||
+ {
|
||||
+ /* Nothing immediately available, so generate a new arena. */
|
||||
+ if (narenas_limit == 0)
|
||||
+ {
|
||||
+ if (mp_.arena_max != 0)
|
||||
+ narenas_limit = mp_.arena_max;
|
||||
+ else
|
||||
+ {
|
||||
+ int n = __get_nprocs ();
|
||||
+
|
||||
+ if (n >= 1)
|
||||
+ narenas_limit = NARENAS_FROM_NCORES (n);
|
||||
+ else
|
||||
+ /* We have no information about the system. Assume two
|
||||
+ cores. */
|
||||
+ narenas_limit = NARENAS_FROM_NCORES (2);
|
||||
+ }
|
||||
+ }
|
||||
+ repeat:;
|
||||
+ size_t n = narenas;
|
||||
+ if (__builtin_expect (n <= mp_.arena_test || n < narenas_limit, 0))
|
||||
+ {
|
||||
+ if (catomic_compare_and_exchange_bool_acq(&narenas, n + 1, n))
|
||||
+ goto repeat;
|
||||
+ a = _int_new_arena (size);
|
||||
+ if (__builtin_expect (a != NULL, 1))
|
||||
+ return a;
|
||||
+ catomic_decrement(&narenas);
|
||||
+ }
|
||||
+ a = reused_arena ();
|
||||
+ }
|
||||
#else
|
||||
if(!a_tsd)
|
||||
a = a_tsd = &main_arena;
|
||||
|
||||
commit a5fb313cb7b7e692fd4684916aaa98e03ec7e8b6
|
||||
Author: Andreas Schwab <schwab@redhat.com>
|
||||
Date: Mon Nov 14 11:41:52 2011 +0100
|
||||
|
||||
Don't call reused_arena when _int_new_arena failed
|
||||
|
||||
diff --git a/malloc/arena.c b/malloc/arena.c
|
||||
index 042cac8..cb8548b 100644
|
||||
--- a/malloc/arena.c
|
||||
+++ b/malloc/arena.c
|
||||
@@ -844,14 +844,14 @@ arena_get2(mstate a_tsd, size_t size)
|
||||
size_t n = narenas;
|
||||
if (__builtin_expect (n <= mp_.arena_test || n < narenas_limit, 0))
|
||||
{
|
||||
- if (catomic_compare_and_exchange_bool_acq(&narenas, n + 1, n))
|
||||
+ if (catomic_compare_and_exchange_bool_acq (&narenas, n + 1, n))
|
||||
goto repeat;
|
||||
a = _int_new_arena (size);
|
||||
- if (__builtin_expect (a != NULL, 1))
|
||||
- return a;
|
||||
- catomic_decrement(&narenas);
|
||||
+ if (__builtin_expect (a == NULL, 0))
|
||||
+ catomic_decrement (&narenas);
|
||||
}
|
||||
- a = reused_arena ();
|
||||
+ else
|
||||
+ a = reused_arena ();
|
||||
}
|
||||
#else
|
||||
if(!a_tsd)
|
||||
32
src/patches/glibc/glibc-rh749188.patch
Normal file
32
src/patches/glibc/glibc-rh749188.patch
Normal file
@@ -0,0 +1,32 @@
|
||||
commit 0e8131bb32cf026c87baeacb7abf2a9bdbbc4953
|
||||
Author: Andreas Schwab <schwab@redhat.com>
|
||||
Date: Sun May 8 21:48:03 2011 -0400
|
||||
|
||||
Remove .UTF-8 suffix from locale names when it is the only supported codeset
|
||||
|
||||
diff --git a/localedata/SUPPORTED b/localedata/SUPPORTED
|
||||
index d665961..e952c17 100644
|
||||
--- a/localedata/SUPPORTED
|
||||
+++ b/localedata/SUPPORTED
|
||||
@@ -46,8 +46,8 @@ ar_TN.UTF-8/UTF-8 \
|
||||
ar_TN/ISO-8859-6 \
|
||||
ar_YE.UTF-8/UTF-8 \
|
||||
ar_YE/ISO-8859-6 \
|
||||
-az_AZ.UTF-8/UTF-8 \
|
||||
-as_IN.UTF-8/UTF-8 \
|
||||
+az_AZ/UTF-8 \
|
||||
+as_IN/UTF-8 \
|
||||
ast_ES.UTF-8/UTF-8 \
|
||||
ast_ES/ISO-8859-15 \
|
||||
be_BY.UTF-8/UTF-8 \
|
||||
@@ -385,8 +385,8 @@ tr_CY/ISO-8859-9 \
|
||||
tr_TR.UTF-8/UTF-8 \
|
||||
tr_TR/ISO-8859-9 \
|
||||
ts_ZA/UTF-8 \
|
||||
-tt_RU.UTF-8/UTF-8 \
|
||||
-tt_RU.UTF-8@iqtelif/UTF-8 \
|
||||
+tt_RU/UTF-8 \
|
||||
+tt_RU@iqtelif/UTF-8 \
|
||||
ug_CN/UTF-8 \
|
||||
uk_UA.UTF-8/UTF-8 \
|
||||
uk_UA/KOI8-U \
|
||||
122
src/patches/glibc/glibc-rh750531.patch
Normal file
122
src/patches/glibc/glibc-rh750531.patch
Normal file
@@ -0,0 +1,122 @@
|
||||
commit 69da074d7adfab7b57004a0dea9403a928e310a5
|
||||
Author: Ulrich Drepper <drepper@gmail.com>
|
||||
Date: Wed Nov 10 02:38:35 2010 -0500
|
||||
|
||||
Fix warnings in __bswap_16.
|
||||
|
||||
diff --git a/sysdeps/i386/bits/byteswap.h b/sysdeps/i386/bits/byteswap.h
|
||||
index 1f3fc5e..c246ae8 100644
|
||||
--- a/sysdeps/i386/bits/byteswap.h
|
||||
+++ b/sysdeps/i386/bits/byteswap.h
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Macros to swap the order of bytes in integer values.
|
||||
- Copyright (C) 1997, 1998, 2000, 2002, 2003, 2006, 2007, 2008
|
||||
+ Copyright (C) 1997, 1998, 2000, 2002, 2003, 2006, 2007, 2008, 2010
|
||||
Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
@@ -27,26 +27,27 @@
|
||||
|
||||
/* Swap bytes in 16 bit value. */
|
||||
#define __bswap_constant_16(x) \
|
||||
- ((((x) >> 8) & 0xff) | (((x) & 0xff) << 8))
|
||||
+ ((unsigned short int) ((((x) >> 8) & 0xff) | (((x) & 0xff) << 8)))
|
||||
|
||||
#ifdef __GNUC__
|
||||
# if __GNUC__ >= 2
|
||||
# define __bswap_16(x) \
|
||||
(__extension__ \
|
||||
- ({ register unsigned short int __v, __x = (x); \
|
||||
+ ({ register unsigned short int __v, __x = (unsigned short int) (x); \
|
||||
if (__builtin_constant_p (__x)) \
|
||||
__v = __bswap_constant_16 (__x); \
|
||||
else \
|
||||
__asm__ ("rorw $8, %w0" \
|
||||
: "=r" (__v) \
|
||||
- : "0" (__x) \
|
||||
- : "cc"); \
|
||||
+ : "0" (__x) \
|
||||
+ : "cc"); \
|
||||
__v; }))
|
||||
# else
|
||||
/* This is better than nothing. */
|
||||
# define __bswap_16(x) \
|
||||
(__extension__ \
|
||||
- ({ register unsigned short int __x = (x); __bswap_constant_16 (__x); }))
|
||||
+ ({ register unsigned short int __x = (unsigned short int) (x); \
|
||||
+ __bswap_constant_16 (__x); }))
|
||||
# endif
|
||||
#else
|
||||
static __inline unsigned short int
|
||||
@@ -122,7 +123,7 @@ __bswap_32 (unsigned int __bsx)
|
||||
(__extension__ \
|
||||
({ union { __extension__ unsigned long long int __ll; \
|
||||
unsigned long int __l[2]; } __w, __r; \
|
||||
- if (__builtin_constant_p (x)) \
|
||||
+ if (__builtin_constant_p (x)) \
|
||||
__r.__ll = __bswap_constant_64 (x); \
|
||||
else \
|
||||
{ \
|
||||
diff --git a/sysdeps/x86_64/bits/byteswap.h b/sysdeps/x86_64/bits/byteswap.h
|
||||
index 08b38e8..e350fb8 100644
|
||||
--- a/sysdeps/x86_64/bits/byteswap.h
|
||||
+++ b/sysdeps/x86_64/bits/byteswap.h
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Macros to swap the order of bytes in integer values.
|
||||
- Copyright (C) 1997, 1998, 2000, 2002, 2003, 2007, 2008
|
||||
+ Copyright (C) 1997, 1998, 2000, 2002, 2003, 2007, 2008, 2010
|
||||
Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
@@ -29,12 +29,12 @@
|
||||
|
||||
/* Swap bytes in 16 bit value. */
|
||||
#define __bswap_constant_16(x) \
|
||||
- ((((x) >> 8) & 0xff) | (((x) & 0xff) << 8))
|
||||
+ ((unsigned short int) ((((x) >> 8) & 0xff) | (((x) & 0xff) << 8)))
|
||||
|
||||
#if defined __GNUC__ && __GNUC__ >= 2
|
||||
# define __bswap_16(x) \
|
||||
(__extension__ \
|
||||
- ({ register unsigned short int __v, __x = (x); \
|
||||
+ ({ register unsigned short int __v, __x = (unsigned short int) (x); \
|
||||
if (__builtin_constant_p (__x)) \
|
||||
__v = __bswap_constant_16 (__x); \
|
||||
else \
|
||||
@@ -47,7 +47,8 @@
|
||||
/* This is better than nothing. */
|
||||
# define __bswap_16(x) \
|
||||
(__extension__ \
|
||||
- ({ register unsigned short int __x = (x); __bswap_constant_16 (__x); }))
|
||||
+ ({ register unsigned short int __x = (unsigned short int) (x); \
|
||||
+ __bswap_constant_16 (__x); }))
|
||||
#endif
|
||||
|
||||
|
||||
@@ -120,16 +121,16 @@
|
||||
# define __bswap_64(x) \
|
||||
(__extension__ \
|
||||
({ union { __extension__ unsigned long long int __ll; \
|
||||
- unsigned int __l[2]; } __w, __r; \
|
||||
- if (__builtin_constant_p (x)) \
|
||||
- __r.__ll = __bswap_constant_64 (x); \
|
||||
- else \
|
||||
- { \
|
||||
- __w.__ll = (x); \
|
||||
- __r.__l[0] = __bswap_32 (__w.__l[1]); \
|
||||
- __r.__l[1] = __bswap_32 (__w.__l[0]); \
|
||||
- } \
|
||||
- __r.__ll; }))
|
||||
+ unsigned int __l[2]; } __w, __r; \
|
||||
+ if (__builtin_constant_p (x)) \
|
||||
+ __r.__ll = __bswap_constant_64 (x); \
|
||||
+ else \
|
||||
+ { \
|
||||
+ __w.__ll = (x); \
|
||||
+ __r.__l[0] = __bswap_32 (__w.__l[1]); \
|
||||
+ __r.__l[1] = __bswap_32 (__w.__l[0]); \
|
||||
+ } \
|
||||
+ __r.__ll; }))
|
||||
# endif
|
||||
#endif
|
||||
|
||||
28
src/patches/glibc/glibc-rh751750.patch
Normal file
28
src/patches/glibc/glibc-rh751750.patch
Normal file
@@ -0,0 +1,28 @@
|
||||
commit 7583a88d1c7170caad26966bcea8bfc2c92093ba
|
||||
Author: Andreas Schwab <schwab@redhat.com>
|
||||
Date: Mon Nov 7 15:07:31 2011 +0100
|
||||
|
||||
Fix locking in _IO_flush_all_lockp
|
||||
|
||||
diff --git a/libio/genops.c b/libio/genops.c
|
||||
index 5d21c42..bb40c34 100644
|
||||
--- a/libio/genops.c
|
||||
+++ b/libio/genops.c
|
||||
@@ -826,7 +826,7 @@ _IO_flush_all_lockp (int do_lock)
|
||||
int last_stamp;
|
||||
|
||||
#ifdef _IO_MTSAFE_IO
|
||||
- _IO_cleanup_region_start_noarg (flush_cleanup);
|
||||
+ __libc_cleanup_region_start (do_lock, flush_cleanup, 0);
|
||||
if (do_lock)
|
||||
_IO_lock_lock (list_all_lock);
|
||||
#endif
|
||||
@@ -866,7 +866,7 @@ _IO_flush_all_lockp (int do_lock)
|
||||
#ifdef _IO_MTSAFE_IO
|
||||
if (do_lock)
|
||||
_IO_lock_unlock (list_all_lock);
|
||||
- _IO_cleanup_region_end (0);
|
||||
+ __libc_cleanup_region_end (0);
|
||||
#endif
|
||||
|
||||
return result;
|
||||
260
src/patches/glibc/glibc-rh752122.patch
Normal file
260
src/patches/glibc/glibc-rh752122.patch
Normal file
@@ -0,0 +1,260 @@
|
||||
2011-07-24 H.J. Lu <hongjiu.lu@intel.com>
|
||||
|
||||
* sysdeps/x86_64/dl-trampoline.S (_dl_runtime_profile): Simplify
|
||||
AVX check.
|
||||
|
||||
2011-08-20 Ulrich Drepper <drepper@gmail.com>
|
||||
|
||||
* sysdeps/x86_64/dl-trampoline.h: If MORE_CODE is defined, restore
|
||||
the CFI state in the end.
|
||||
* sysdeps/x86_64/dl-trampoline.S: Define MORE_CODE before first
|
||||
inclusion of dl-trampoline.h.
|
||||
Based on a patch by Jiri Olsa <jolsa@redhat.com>.
|
||||
|
||||
2011-07-23 Ulrich Drepper <drepper@gmail.com>
|
||||
|
||||
* sysdeps/x86_64/dl-trampoline.S (_dl_runtime_profile): Fix one more
|
||||
typo.
|
||||
(_dl_x86_64_save_sse): Likewise.
|
||||
|
||||
2011-07-22 Ulrich Drepper <drepper@gmail.com>
|
||||
|
||||
* sysdeps/x86_64/dl-trampoline.S (_dl_runtime_profile): Fix test for
|
||||
OSXSAVE.
|
||||
(_dl_x86_64_save_sse): Likewise.
|
||||
|
||||
2011-07-21 Andreas Schwab <schwab@redhat.com>
|
||||
|
||||
* sysdeps/x86_64/dl-trampoline.S (_dl_runtime_profile): Fix last
|
||||
change.
|
||||
(_dl_x86_64_save_sse): Use correct AVX check.
|
||||
|
||||
2011-07-20 Ulrich Drepper <drepper@gmail.com>
|
||||
|
||||
[BZ #13007]
|
||||
* sysdeps/x86_64/dl-trampoline.S (_dl_runtime_profile): More complete
|
||||
check for AVX enablement so that we don't crash with old kernels and
|
||||
new hardware.
|
||||
* elf/tst-audit4.c: Add same checks here.
|
||||
* elf/tst-audit6.c: Likewise.
|
||||
|
||||
Index: glibc-2.12-2-gc4ccff1/elf/tst-audit4.c
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/elf/tst-audit4.c
|
||||
+++ glibc-2.12-2-gc4ccff1/elf/tst-audit4.c
|
||||
@@ -6,16 +6,30 @@
|
||||
#include <cpuid.h>
|
||||
#include <immintrin.h>
|
||||
|
||||
+
|
||||
+static int
|
||||
+avx_enabled (void)
|
||||
+{
|
||||
+ unsigned int eax, ebx, ecx, edx;
|
||||
+
|
||||
+ if (__get_cpuid (1, &eax, &ebx, &ecx, &edx) == 0
|
||||
+ || (ecx & (bit_AVX | bit_OSXSAVE)) != (bit_AVX | bit_OSXSAVE))
|
||||
+ return 0;
|
||||
+
|
||||
+ /* Check the OS has AVX and SSE saving enabled. */
|
||||
+ asm ("xgetbv" : "=a" (eax), "=d" (edx) : "c" (0));
|
||||
+
|
||||
+ return (eax & 6) == 6;
|
||||
+}
|
||||
+
|
||||
+
|
||||
extern __m256i audit_test (__m256i, __m256i, __m256i, __m256i,
|
||||
__m256i, __m256i, __m256i, __m256i);
|
||||
int
|
||||
main (void)
|
||||
{
|
||||
- unsigned int eax, ebx, ecx, edx;
|
||||
-
|
||||
/* Run AVX test only if AVX is supported. */
|
||||
- if (__get_cpuid (1, &eax, &ebx, &ecx, &edx)
|
||||
- && (ecx & bit_AVX))
|
||||
+ if (avx_enabled ())
|
||||
{
|
||||
__m256i ymm = _mm256_setzero_si256 ();
|
||||
__m256i ret = audit_test (ymm, ymm, ymm, ymm, ymm, ymm, ymm, ymm);
|
||||
Index: glibc-2.12-2-gc4ccff1/elf/tst-audit6.c
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/elf/tst-audit6.c
|
||||
+++ glibc-2.12-2-gc4ccff1/elf/tst-audit6.c
|
||||
@@ -8,14 +8,28 @@
|
||||
extern __m128i audit_test (__m128i, __m128i, __m128i, __m128i,
|
||||
__m128i, __m128i, __m128i, __m128i);
|
||||
|
||||
-int
|
||||
-main (void)
|
||||
+
|
||||
+static int
|
||||
+avx_enabled (void)
|
||||
{
|
||||
unsigned int eax, ebx, ecx, edx;
|
||||
|
||||
+ if (__get_cpuid (1, &eax, &ebx, &ecx, &edx) == 0
|
||||
+ || (ecx & (bit_AVX | bit_OSXSAVE)) != (bit_AVX | bit_OSXSAVE))
|
||||
+ return 0;
|
||||
+
|
||||
+ /* Check the OS has AVX and SSE saving enabled. */
|
||||
+ asm ("xgetbv" : "=a" (eax), "=d" (edx) : "c" (0));
|
||||
+
|
||||
+ return (eax & 6) == 6;
|
||||
+}
|
||||
+
|
||||
+
|
||||
+int
|
||||
+main (void)
|
||||
+{
|
||||
/* Run AVX test only if AVX is supported. */
|
||||
- if (__get_cpuid (1, &eax, &ebx, &ecx, &edx)
|
||||
- && (ecx & bit_AVX))
|
||||
+ if (avx_enabled ())
|
||||
{
|
||||
__m128i xmm = _mm_setzero_si128 ();
|
||||
__m128i ret = audit_test (xmm, xmm, xmm, xmm, xmm, xmm, xmm, xmm);
|
||||
Index: glibc-2.12-2-gc4ccff1/sysdeps/x86_64/dl-trampoline.S
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/sysdeps/x86_64/dl-trampoline.S
|
||||
+++ glibc-2.12-2-gc4ccff1/sysdeps/x86_64/dl-trampoline.S
|
||||
@@ -139,24 +139,31 @@ L(have_avx):
|
||||
movl $1, %eax
|
||||
cpuid
|
||||
movq %r11,%rbx # Restore rbx
|
||||
- movl $1, %eax
|
||||
- testl $(1 << 28), %ecx
|
||||
+ xorl %eax, %eax
|
||||
+ // AVX and XSAVE supported?
|
||||
+ andl $((1 << 28) | (1 << 27)), %ecx
|
||||
+ cmpl $((1 << 28) | (1 << 27)), %ecx
|
||||
jne 2f
|
||||
- negl %eax
|
||||
-2: movl %eax, L(have_avx)(%rip)
|
||||
+ xorl %ecx, %ecx
|
||||
+ // Get XFEATURE_ENABLED_MASK
|
||||
+ xgetbv
|
||||
+ andl $0x6, %eax
|
||||
+2: subl $0x5, %eax
|
||||
+ movl %eax, L(have_avx)(%rip)
|
||||
cmpl $0, %eax
|
||||
|
||||
1: js L(no_avx)
|
||||
|
||||
# define RESTORE_AVX
|
||||
+# define MORE_CODE
|
||||
# include "dl-trampoline.h"
|
||||
|
||||
.align 16
|
||||
L(no_avx):
|
||||
# endif
|
||||
|
||||
-# undef RESTORE_AVX
|
||||
-# include "dl-trampoline.h"
|
||||
+# undef RESTORE_AVX
|
||||
+# include "dl-trampoline.h"
|
||||
|
||||
cfi_endproc
|
||||
.size _dl_runtime_profile, .-_dl_runtime_profile
|
||||
@@ -176,11 +183,20 @@ _dl_x86_64_save_sse:
|
||||
movl $1, %eax
|
||||
cpuid
|
||||
movq %r11,%rbx # Restore rbx
|
||||
- movl $1, %eax
|
||||
- testl $(1 << 28), %ecx
|
||||
+ xorl %eax, %eax
|
||||
+ // AVX and XSAVE supported?
|
||||
+ andl $((1 << 28) | (1 << 27)), %ecx
|
||||
+ cmpl $((1 << 28) | (1 << 27)), %ecx
|
||||
jne 2f
|
||||
- negl %eax
|
||||
-2: movl %eax, L(have_avx)(%rip)
|
||||
+ xorl %ecx, %ecx
|
||||
+ // Get XFEATURE_ENABLED_MASK
|
||||
+ xgetbv
|
||||
+ andl $0x6, %eax
|
||||
+ cmpl $0x6, %eax
|
||||
+ // Nonzero if SSE and AVX state saving is enabled.
|
||||
+ sete %al
|
||||
+2: leal -1(%eax,%eax), %eax
|
||||
+ movl %eax, L(have_avx)(%rip)
|
||||
cmpl $0, %eax
|
||||
|
||||
1: js L(no_avx5)
|
||||
Index: glibc-2.12-2-gc4ccff1/sysdeps/x86_64/dl-trampoline.h
|
||||
===================================================================
|
||||
--- glibc-2.12-2-gc4ccff1.orig/sysdeps/x86_64/dl-trampoline.h
|
||||
+++ glibc-2.12-2-gc4ccff1/sysdeps/x86_64/dl-trampoline.h
|
||||
@@ -195,14 +195,14 @@
|
||||
_dl_call_pltexit. The La_x86_64_regs is being pointed by rsp now,
|
||||
so we just need to allocate the sizeof(La_x86_64_retval) space on
|
||||
the stack, since the alignment has already been taken care of. */
|
||||
-# ifdef RESTORE_AVX
|
||||
+#ifdef RESTORE_AVX
|
||||
/* sizeof(La_x86_64_retval). Need extra space for 2 SSE
|
||||
registers to detect if xmm0/xmm1 registers are changed
|
||||
by audit module. */
|
||||
subq $(LRV_SIZE + XMM_SIZE*2), %rsp
|
||||
-# else
|
||||
+#else
|
||||
subq $LRV_SIZE, %rsp # sizeof(La_x86_64_retval)
|
||||
-# endif
|
||||
+#endif
|
||||
movq %rsp, %rcx # La_x86_64_retval argument to %rcx.
|
||||
|
||||
/* Fill in the La_x86_64_retval structure. */
|
||||
@@ -212,7 +212,7 @@
|
||||
movaps %xmm0, LRV_XMM0_OFFSET(%rcx)
|
||||
movaps %xmm1, LRV_XMM1_OFFSET(%rcx)
|
||||
|
||||
-# ifdef RESTORE_AVX
|
||||
+#ifdef RESTORE_AVX
|
||||
/* This is to support AVX audit modules. */
|
||||
vmovdqu %ymm0, LRV_VECTOR0_OFFSET(%rcx)
|
||||
vmovdqu %ymm1, LRV_VECTOR1_OFFSET(%rcx)
|
||||
@@ -221,14 +221,14 @@
|
||||
by audit module. */
|
||||
vmovdqa %xmm0, (LRV_SIZE)(%rcx)
|
||||
vmovdqa %xmm1, (LRV_SIZE + XMM_SIZE)(%rcx)
|
||||
-# endif
|
||||
+#endif
|
||||
|
||||
fstpt LRV_ST0_OFFSET(%rcx)
|
||||
fstpt LRV_ST1_OFFSET(%rcx)
|
||||
|
||||
movq 24(%rbx), %rdx # La_x86_64_regs argument to %rdx.
|
||||
movq 40(%rbx), %rsi # Copy args pushed by PLT in register.
|
||||
- movq 32(%rbx), %rdi # %rdi: link_map, %rsi: reloc_index
|
||||
+ movq 32(%rbx), %rdi # %rdi: link_map, %rsi: reloc_index
|
||||
call _dl_call_pltexit
|
||||
|
||||
/* Restore return registers. */
|
||||
@@ -238,7 +238,7 @@
|
||||
movaps LRV_XMM0_OFFSET(%rsp), %xmm0
|
||||
movaps LRV_XMM1_OFFSET(%rsp), %xmm1
|
||||
|
||||
-# ifdef RESTORE_AVX
|
||||
+#ifdef RESTORE_AVX
|
||||
/* Check if xmm0/xmm1 registers are changed by audit module. */
|
||||
vpcmpeqq (LRV_SIZE)(%rsp), %xmm0, %xmm2
|
||||
vpmovmskb %xmm2, %esi
|
||||
@@ -253,7 +253,7 @@
|
||||
vmovdqu LRV_VECTOR1_OFFSET(%rsp), %ymm1
|
||||
|
||||
1:
|
||||
-# endif
|
||||
+#endif
|
||||
|
||||
fldt LRV_ST1_OFFSET(%rsp)
|
||||
fldt LRV_ST0_OFFSET(%rsp)
|
||||
@@ -267,3 +267,10 @@
|
||||
# (eats the reloc index and link_map)
|
||||
cfi_adjust_cfa_offset(-48)
|
||||
retq
|
||||
+
|
||||
+#ifdef MORE_CODE
|
||||
+ cfi_adjust_cfa_offset(48)
|
||||
+ cfi_rel_offset(%rbx, 0)
|
||||
+ cfi_def_cfa_register(%rbx)
|
||||
+# undef MORE_CODE
|
||||
+#endif
|
||||
225
src/patches/glibc/glibc-rh757888.patch
Normal file
225
src/patches/glibc/glibc-rh757888.patch
Normal file
@@ -0,0 +1,225 @@
|
||||
commit f3a6cc0a560a17f32a3e90d2f20501a53cab6058
|
||||
Author: Andreas Schwab <schwab@redhat.com>
|
||||
Date: Tue Nov 29 10:52:22 2011 +0100
|
||||
|
||||
Fix access after end of search string in regex matcher
|
||||
|
||||
diff --git a/locale/weight.h b/locale/weight.h
|
||||
index dc70a00..967e176 100644
|
||||
--- a/locale/weight.h
|
||||
+++ b/locale/weight.h
|
||||
@@ -1,4 +1,4 @@
|
||||
-/* Copyright (C) 1996,1997,1998,1999,2000,2003,2004 Free Software Foundation, Inc.
|
||||
+/* Copyright (C) 1996,1997,1998,1999,2000,2003,2004,2011 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Written by Ulrich Drepper, <drepper@cygnus.com>.
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
/* Find index of weight. */
|
||||
auto inline int32_t
|
||||
__attribute ((always_inline))
|
||||
-findidx (const unsigned char **cpp)
|
||||
+findidx (const unsigned char **cpp, size_t len)
|
||||
{
|
||||
int_fast32_t i = table[*(*cpp)++];
|
||||
const unsigned char *cp;
|
||||
@@ -34,6 +34,7 @@ findidx (const unsigned char **cpp)
|
||||
Search for the correct one. */
|
||||
cp = &extra[-i];
|
||||
usrc = *cpp;
|
||||
+ --len;
|
||||
while (1)
|
||||
{
|
||||
size_t nhere;
|
||||
@@ -56,7 +57,7 @@ findidx (const unsigned char **cpp)
|
||||
already. */
|
||||
size_t cnt;
|
||||
|
||||
- for (cnt = 0; cnt < nhere; ++cnt)
|
||||
+ for (cnt = 0; cnt < nhere && cnt < len; ++cnt)
|
||||
if (cp[cnt] != usrc[cnt])
|
||||
break;
|
||||
|
||||
@@ -79,13 +80,13 @@ findidx (const unsigned char **cpp)
|
||||
size_t cnt;
|
||||
size_t offset = 0;
|
||||
|
||||
- for (cnt = 0; cnt < nhere; ++cnt)
|
||||
+ for (cnt = 0; cnt < nhere && cnt < len; ++cnt)
|
||||
if (cp[cnt] != usrc[cnt])
|
||||
break;
|
||||
|
||||
if (cnt != nhere)
|
||||
{
|
||||
- if (cp[cnt] > usrc[cnt])
|
||||
+ if (cnt == len || cp[cnt] > usrc[cnt])
|
||||
{
|
||||
/* Cannot be in this range. */
|
||||
cp += 2 * nhere;
|
||||
diff --git a/locale/weightwc.h b/locale/weightwc.h
|
||||
index 9ea1126..7862091 100644
|
||||
--- a/locale/weightwc.h
|
||||
+++ b/locale/weightwc.h
|
||||
@@ -1,4 +1,4 @@
|
||||
-/* Copyright (C) 1996-2001,2003,2004,2005,2007 Free Software Foundation, Inc.
|
||||
+/* Copyright (C) 1996-2001,2003,2004,2005,2007,2011 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Written by Ulrich Drepper, <drepper@cygnus.com>.
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
/* Find index of weight. */
|
||||
auto inline int32_t
|
||||
__attribute ((always_inline))
|
||||
-findidx (const wint_t **cpp)
|
||||
+findidx (const wint_t **cpp, size_t len)
|
||||
{
|
||||
wint_t ch = *(*cpp)++;
|
||||
int32_t i = __collidx_table_lookup ((const char *) table, ch);
|
||||
@@ -32,6 +32,7 @@ findidx (const wint_t **cpp)
|
||||
/* Oh well, more than one sequence starting with this byte.
|
||||
Search for the correct one. */
|
||||
const int32_t *cp = (const int32_t *) &extra[-i];
|
||||
+ --len;
|
||||
while (1)
|
||||
{
|
||||
size_t nhere;
|
||||
@@ -54,7 +55,7 @@ findidx (const wint_t **cpp)
|
||||
already. */
|
||||
size_t cnt;
|
||||
|
||||
- for (cnt = 0; cnt < nhere; ++cnt)
|
||||
+ for (cnt = 0; cnt < nhere && cnt < len; ++cnt)
|
||||
if (cp[cnt] != usrc[cnt])
|
||||
break;
|
||||
|
||||
@@ -75,7 +76,7 @@ findidx (const wint_t **cpp)
|
||||
size_t cnt;
|
||||
size_t offset;
|
||||
|
||||
- for (cnt = 0; cnt < nhere - 1; ++cnt)
|
||||
+ for (cnt = 0; cnt < nhere - 1 && cnt < len; ++cnt)
|
||||
if (cp[cnt] != usrc[cnt])
|
||||
break;
|
||||
|
||||
diff --git a/posix/fnmatch_loop.c b/posix/fnmatch_loop.c
|
||||
index 18a6667..72bd3ee 100644
|
||||
--- a/posix/fnmatch_loop.c
|
||||
+++ b/posix/fnmatch_loop.c
|
||||
@@ -412,7 +412,7 @@ FCT (pattern, string, string_end, no_leading_period, flags, ends, alloca_used)
|
||||
_NL_CURRENT (LC_COLLATE, _NL_COLLATE_INDIRECTMB);
|
||||
# endif
|
||||
|
||||
- idx = findidx (&cp);
|
||||
+ idx = findidx (&cp, 1);
|
||||
if (idx != 0)
|
||||
{
|
||||
/* We found a table entry. Now see whether the
|
||||
@@ -422,7 +422,7 @@ FCT (pattern, string, string_end, no_leading_period, flags, ends, alloca_used)
|
||||
int32_t idx2;
|
||||
const UCHAR *np = (const UCHAR *) n;
|
||||
|
||||
- idx2 = findidx (&np);
|
||||
+ idx2 = findidx (&np, string_end - n);
|
||||
if (idx2 != 0
|
||||
&& (idx >> 24) == (idx2 >> 24)
|
||||
&& len == weights[idx2 & 0xffffff])
|
||||
diff --git a/posix/regcomp.c b/posix/regcomp.c
|
||||
index b238c08..34ee845 100644
|
||||
--- a/posix/regcomp.c
|
||||
+++ b/posix/regcomp.c
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Extended regular expression matching and search library.
|
||||
- Copyright (C) 2002-2007,2009,2010 Free Software Foundation, Inc.
|
||||
+ Copyright (C) 2002-2007,2009,2010,2011 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Isamu Hasegawa <isamu@yamato.ibm.com>.
|
||||
|
||||
@@ -3409,19 +3409,18 @@ build_equiv_class (bitset_t sbcset, const unsigned char *name)
|
||||
_NL_COLLATE_EXTRAMB);
|
||||
indirect = (const int32_t *) _NL_CURRENT (LC_COLLATE,
|
||||
_NL_COLLATE_INDIRECTMB);
|
||||
- idx1 = findidx (&cp);
|
||||
- if (BE (idx1 == 0 || cp < name + strlen ((const char *) name), 0))
|
||||
+ idx1 = findidx (&cp, -1);
|
||||
+ if (BE (idx1 == 0 || *cp != '\0', 0))
|
||||
/* This isn't a valid character. */
|
||||
return REG_ECOLLATE;
|
||||
|
||||
/* Build single byte matcing table for this equivalence class. */
|
||||
- char_buf[1] = (unsigned char) '\0';
|
||||
len = weights[idx1 & 0xffffff];
|
||||
for (ch = 0; ch < SBC_MAX; ++ch)
|
||||
{
|
||||
char_buf[0] = ch;
|
||||
cp = char_buf;
|
||||
- idx2 = findidx (&cp);
|
||||
+ idx2 = findidx (&cp, 1);
|
||||
/*
|
||||
idx2 = table[ch];
|
||||
*/
|
||||
|
||||
--- a/posix/regex_internal.h 2011-11-30 12:47:02.706567482 -0700
|
||||
+++ a/posix/regex_internal.h 2011-11-30 12:47:32.969558337 -0700
|
||||
@@ -756,7 +756,7 @@
|
||||
indirect = (const int32_t *) _NL_CURRENT (LC_COLLATE,
|
||||
_NL_COLLATE_INDIRECTMB);
|
||||
p = pstr->mbs + idx;
|
||||
- tmp = findidx (&p);
|
||||
+ tmp = findidx (&p, pstr->len - idx);
|
||||
return p - pstr->mbs - idx;
|
||||
}
|
||||
else
|
||||
diff --git a/posix/regexec.c b/posix/regexec.c
|
||||
index 9e0c565..3ea810b 100644
|
||||
--- a/posix/regexec.c
|
||||
+++ b/posix/regexec.c
|
||||
@@ -3924,7 +3924,7 @@ check_node_accept_bytes (const re_dfa_t *dfa, int node_idx,
|
||||
_NL_CURRENT (LC_COLLATE, _NL_COLLATE_EXTRAMB);
|
||||
indirect = (const int32_t *)
|
||||
_NL_CURRENT (LC_COLLATE, _NL_COLLATE_INDIRECTMB);
|
||||
- int32_t idx = findidx (&cp);
|
||||
+ int32_t idx = findidx (&cp, elem_len);
|
||||
if (idx > 0)
|
||||
for (i = 0; i < cset->nequiv_classes; ++i)
|
||||
{
|
||||
diff --git a/string/strcoll_l.c b/string/strcoll_l.c
|
||||
index d8d1139..fb77d08 100644
|
||||
--- a/string/strcoll_l.c
|
||||
+++ b/string/strcoll_l.c
|
||||
@@ -1,4 +1,4 @@
|
||||
-/* Copyright (C) 1995-1997,2002,2004,2007,2010 Free Software Foundation, Inc.
|
||||
+/* Copyright (C) 1995-1997,2002,2004,2007,2010,2011 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Written by Ulrich Drepper <drepper@gnu.org>, 1995.
|
||||
|
||||
@@ -205,7 +205,7 @@ STRCOLL (s1, s2, l)
|
||||
|
||||
while (*us1 != L('\0'))
|
||||
{
|
||||
- int32_t tmp = findidx (&us1);
|
||||
+ int32_t tmp = findidx (&us1, -1);
|
||||
rule1arr[idx1max] = tmp >> 24;
|
||||
idx1arr[idx1max] = tmp & 0xffffff;
|
||||
idx1cnt = idx1max++;
|
||||
@@ -267,7 +267,7 @@ STRCOLL (s1, s2, l)
|
||||
|
||||
while (*us2 != L('\0'))
|
||||
{
|
||||
- int32_t tmp = findidx (&us2);
|
||||
+ int32_t tmp = findidx (&us2, -1);
|
||||
rule2arr[idx2max] = tmp >> 24;
|
||||
idx2arr[idx2max] = tmp & 0xffffff;
|
||||
idx2cnt = idx2max++;
|
||||
diff --git a/string/strxfrm_l.c b/string/strxfrm_l.c
|
||||
index 220253c..b06556d 100644
|
||||
--- a/string/strxfrm_l.c
|
||||
+++ b/string/strxfrm_l.c
|
||||
@@ -176,7 +176,7 @@ STRXFRM (STRING_TYPE *dest, const STRING_TYPE *src, size_t n, __locale_t l)
|
||||
idxmax = 0;
|
||||
do
|
||||
{
|
||||
- int32_t tmp = findidx (&usrc);
|
||||
+ int32_t tmp = findidx (&usrc, -1);
|
||||
rulearr[idxmax] = tmp >> 24;
|
||||
idxarr[idxmax] = tmp & 0xffffff;
|
||||
|
||||
14
src/patches/glibc/glibc-rh766513.patch
Normal file
14
src/patches/glibc/glibc-rh766513.patch
Normal file
@@ -0,0 +1,14 @@
|
||||
diff -rup a/po/ja.po b/po/ja.po
|
||||
--- a/po/ja.po 2010-05-04 05:27:23.000000000 -0600
|
||||
+++ b/po/ja.po 2012-02-07 12:21:03.023806370 -0700
|
||||
@@ -3549,8 +3549,8 @@ msgstr "%s: <20><><EFBFBD><EFBFBD><EFBFBD>ʥ<EFBFBD><CAA5>ץ<EFBFBD><D7A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ǥ<EFBFBD> -- %c\n
|
||||
|
||||
#: posix/getopt.c:945 posix/getopt.c:948
|
||||
#, c-format
|
||||
-msgid "%s: invalid option -- %c\n"
|
||||
-msgstr "%s: <20><><EFBFBD>ץ<EFBFBD><D7A5><EFBFBD><EFBFBD>㤤<F3A4ACB0>ޤ<EFBFBD> -- %c\n"
|
||||
+msgid "%s: invalid option -- '%c'\n"
|
||||
+msgstr "%s: <20><><EFBFBD>ץ<EFBFBD><D7A5><EFBFBD><EFBFBD>㤤<F3A4ACB0>ޤ<EFBFBD> -- '%c'\n"
|
||||
|
||||
#: posix/getopt.c:1003 posix/getopt.c:1022 posix/getopt.c:1234
|
||||
#: posix/getopt.c:1255
|
||||
21
src/patches/glibc/glibc-rh767146.patch
Normal file
21
src/patches/glibc/glibc-rh767146.patch
Normal file
@@ -0,0 +1,21 @@
|
||||
diff -rup a/elf/dl-load.c b/elf/dl-load.c
|
||||
--- a/elf/dl-load.c 2012-02-03 10:59:58.917870716 -0700
|
||||
+++ b/elf/dl-load.c 2012-02-03 11:01:01.796580644 -0700
|
||||
@@ -1130,6 +1130,16 @@ _dl_map_object_from_fd (const char *name
|
||||
= N_("ELF load command address/offset not properly aligned");
|
||||
goto call_lose;
|
||||
}
|
||||
+ if (__builtin_expect ((ph->p_offset + ph->p_filesz > st.st_size), 0))
|
||||
+ {
|
||||
+ /* If the segment requires zeroing of part of its last
|
||||
+ page, we'll crash when accessing the unmapped page.
|
||||
+ There's still a possibility of a race, if the shared
|
||||
+ object is truncated between the fxstat above and the
|
||||
+ memset below. */
|
||||
+ errstring = N_("ELF load command past end of file");
|
||||
+ goto call_lose;
|
||||
+ }
|
||||
|
||||
c = &loadcmds[nloadcmds++];
|
||||
c->mapstart = ph->p_vaddr & ~(GLRO(dl_pagesize) - 1);
|
||||
Only in b/elf: dl-load.c.orig
|
||||
79
src/patches/glibc/glibc-rh767693-2.patch
Normal file
79
src/patches/glibc/glibc-rh767693-2.patch
Normal file
@@ -0,0 +1,79 @@
|
||||
Index: glibc-2.5-20061008T1257/sunrpc/svc_tcp.c
|
||||
===================================================================
|
||||
--- glibc-2.5-20061008T1257.orig/sunrpc/svc_tcp.c
|
||||
+++ glibc-2.5-20061008T1257/sunrpc/svc_tcp.c
|
||||
@@ -50,6 +50,7 @@ static char sccsid[] = "@(#)svc_tcp.c 1.
|
||||
#include <sys/poll.h>
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
+#include <time.h>
|
||||
|
||||
#ifdef USE_IN_LIBIO
|
||||
# include <wchar.h>
|
||||
@@ -249,6 +250,11 @@ again:
|
||||
{
|
||||
if (errno == EINTR)
|
||||
goto again;
|
||||
+ if (errno == EMFILE)
|
||||
+ {
|
||||
+ struct timespec ts = { .tv_sec = 0, .tv_nsec = 50000000 };
|
||||
+ __nanosleep(&ts , NULL);
|
||||
+ }
|
||||
return FALSE;
|
||||
}
|
||||
/*
|
||||
Index: glibc-2.5-20061008T1257/sunrpc/svc_udp.c
|
||||
===================================================================
|
||||
--- glibc-2.5-20061008T1257.orig/sunrpc/svc_udp.c
|
||||
+++ glibc-2.5-20061008T1257/sunrpc/svc_udp.c
|
||||
@@ -46,6 +46,7 @@ static char sccsid[] = "@(#)svc_udp.c 1.
|
||||
#include <sys/socket.h>
|
||||
#include <errno.h>
|
||||
#include <libintl.h>
|
||||
+#include <time.h>
|
||||
|
||||
#ifdef IP_PKTINFO
|
||||
#include <sys/uio.h>
|
||||
@@ -277,8 +278,16 @@ again:
|
||||
(int) su->su_iosz, 0,
|
||||
(struct sockaddr *) &(xprt->xp_raddr), &len);
|
||||
xprt->xp_addrlen = len;
|
||||
- if (rlen == -1 && errno == EINTR)
|
||||
- goto again;
|
||||
+ if (rlen == -1)
|
||||
+ {
|
||||
+ if (errno == EINTR)
|
||||
+ goto again;
|
||||
+ if (errno == EMFILE)
|
||||
+ {
|
||||
+ struct timespec ts = { .tv_sec = 0, .tv_nsec = 50000000 };
|
||||
+ __nanosleep(&ts , NULL);
|
||||
+ }
|
||||
+ }
|
||||
if (rlen < 16) /* < 4 32-bit ints? */
|
||||
return FALSE;
|
||||
xdrs->x_op = XDR_DECODE;
|
||||
Index: glibc-2.5-20061008T1257/sunrpc/svc_unix.c
|
||||
===================================================================
|
||||
--- glibc-2.5-20061008T1257.orig/sunrpc/svc_unix.c
|
||||
+++ glibc-2.5-20061008T1257/sunrpc/svc_unix.c
|
||||
@@ -48,6 +48,7 @@
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <libintl.h>
|
||||
+#include <time.h>
|
||||
|
||||
#ifdef USE_IN_LIBIO
|
||||
# include <wchar.h>
|
||||
@@ -247,6 +248,11 @@ again:
|
||||
{
|
||||
if (errno == EINTR)
|
||||
goto again;
|
||||
+ if (errno == EMFILE)
|
||||
+ {
|
||||
+ struct timespec ts = { .tv_sec = 0, .tv_nsec = 50000000 };
|
||||
+ __nanosleep(&ts , NULL);
|
||||
+ }
|
||||
return FALSE;
|
||||
}
|
||||
/*
|
||||
89
src/patches/glibc/glibc-rh767693.patch
Normal file
89
src/patches/glibc/glibc-rh767693.patch
Normal file
@@ -0,0 +1,89 @@
|
||||
commit 97ac2654b2d831acaa18a2b018b0736245903fd2
|
||||
Author: Ulrich Drepper <drepper@gmail.com>
|
||||
Date: Sat Dec 17 20:18:42 2011 -0500
|
||||
|
||||
Check values from TZ file header
|
||||
|
||||
|
||||
[BZ #13506]
|
||||
* time/tzfile.c (__tzfile_read): Check values from file header.
|
||||
|
||||
diff -ru a/time/tzfile.c b/time/tzfile.c
|
||||
--- a/time/tzfile.c 2010-05-04 11:27:23.000000000 +0000
|
||||
+++ b/time/tzfile.c 2011-12-19 06:39:49.875358578 +0000
|
||||
@@ -19,6 +19,7 @@
|
||||
|
||||
#include <assert.h>
|
||||
#include <limits.h>
|
||||
+#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdio_ext.h>
|
||||
#include <stdlib.h>
|
||||
@@ -234,23 +235,58 @@
|
||||
goto read_again;
|
||||
}
|
||||
|
||||
+ if (__builtin_expect (num_transitions
|
||||
+ > ((SIZE_MAX - (__alignof__ (struct ttinfo) - 1))
|
||||
+ / (sizeof (time_t) + 1)), 0))
|
||||
+ goto lose;
|
||||
total_size = num_transitions * (sizeof (time_t) + 1);
|
||||
total_size = ((total_size + __alignof__ (struct ttinfo) - 1)
|
||||
& ~(__alignof__ (struct ttinfo) - 1));
|
||||
types_idx = total_size;
|
||||
- total_size += num_types * sizeof (struct ttinfo) + chars;
|
||||
+ if (__builtin_expect (num_types
|
||||
+ > (SIZE_MAX - total_size) / sizeof (struct ttinfo), 0))
|
||||
+ goto lose;
|
||||
+ total_size += num_types * sizeof (struct ttinfo);
|
||||
+ if (__builtin_expect (chars > SIZE_MAX - total_size, 0))
|
||||
+ goto lose;
|
||||
+ total_size += chars;
|
||||
+ if (__builtin_expect (__alignof__ (struct leap) - 1
|
||||
+ > SIZE_MAX - total_size, 0))
|
||||
+ goto lose;
|
||||
total_size = ((total_size + __alignof__ (struct leap) - 1)
|
||||
& ~(__alignof__ (struct leap) - 1));
|
||||
leaps_idx = total_size;
|
||||
+ if (__builtin_expect (num_leaps
|
||||
+ > (SIZE_MAX - total_size) / sizeof (struct leap), 0))
|
||||
+ goto lose;
|
||||
total_size += num_leaps * sizeof (struct leap);
|
||||
- tzspec_len = (sizeof (time_t) == 8 && trans_width == 8
|
||||
- ? st.st_size - (ftello (f)
|
||||
- + num_transitions * (8 + 1)
|
||||
- + num_types * 6
|
||||
- + chars
|
||||
- + num_leaps * 12
|
||||
- + num_isstd
|
||||
- + num_isgmt) - 1 : 0);
|
||||
+ tzspec_len = 0;
|
||||
+ if (sizeof (time_t) == 8 && trans_width == 8)
|
||||
+ {
|
||||
+ off_t rem = st.st_size - ftello (f);
|
||||
+ if (__builtin_expect (rem < 0
|
||||
+ || (size_t) rem < (num_transitions * (8 + 1)
|
||||
+ + num_types * 6
|
||||
+ + chars), 0))
|
||||
+ goto lose;
|
||||
+ tzspec_len = (size_t) rem - (num_transitions * (8 + 1)
|
||||
+ + num_types * 6
|
||||
+ + chars);
|
||||
+ if (__builtin_expect (num_leaps > SIZE_MAX / 12
|
||||
+ || tzspec_len < num_leaps * 12, 0))
|
||||
+ goto lose;
|
||||
+ tzspec_len -= num_leaps * 12;
|
||||
+ if (__builtin_expect (tzspec_len < num_isstd, 0))
|
||||
+ goto lose;
|
||||
+ tzspec_len -= num_isstd;
|
||||
+ if (__builtin_expect (tzspec_len == 0 || tzspec_len - 1 < num_isgmt, 0))
|
||||
+ goto lose;
|
||||
+ tzspec_len -= num_isgmt + 1;
|
||||
+ if (__builtin_expect (SIZE_MAX - total_size < tzspec_len, 0))
|
||||
+ goto lose;
|
||||
+ }
|
||||
+ if (__builtin_expect (SIZE_MAX - total_size - tzspec_len < extra, 0))
|
||||
+ goto lose;
|
||||
|
||||
/* Allocate enough memory including the extra block requested by the
|
||||
caller. */
|
||||
14
src/patches/glibc/glibc-rh767746.patch
Normal file
14
src/patches/glibc/glibc-rh767746.patch
Normal file
@@ -0,0 +1,14 @@
|
||||
--- a/nptl/pthread_create.c 2011-12-13 11:41:37.000000000 -0700
|
||||
+++ b/nptl/pthread_create.c 2011-12-14 10:03:13.000000000 -0700
|
||||
@@ -440,8 +440,9 @@
|
||||
int err = ALLOCATE_STACK (iattr, &pd);
|
||||
if (__builtin_expect (err != 0, 0))
|
||||
/* Something went wrong. Maybe a parameter of the attributes is
|
||||
- invalid or we could not allocate memory. */
|
||||
- return err;
|
||||
+ invalid or we could not allocate memory. Note we have to
|
||||
+ translate error codes. */
|
||||
+ return err == ENOMEM ? EAGAIN : err;
|
||||
|
||||
|
||||
/* Initialize the TCB. All initializations with zero should be
|
||||
155
src/patches/glibc/glibc-rh771342.patch
Normal file
155
src/patches/glibc/glibc-rh771342.patch
Normal file
@@ -0,0 +1,155 @@
|
||||
2011-06-30 Ulrich Drepper <drepper@gmail.com>
|
||||
|
||||
* nptl-init.c (__nptl_set_robust): New function.
|
||||
(pthread_functions): Add reference.
|
||||
* npthreadP.h: Declare __nptl_set_robust.
|
||||
* sysdeps/pthread/pthread-functions.h (pthread_functions): Add
|
||||
ptr_set_robust member.
|
||||
* sysdeps/unix/sysv/linux/fork.c: Call set_robust_list syscall in
|
||||
child if threads are used.
|
||||
|
||||
diff -Nrup a/nptl/nptl-init.c b/nptl/nptl-init.c
|
||||
--- a/nptl/nptl-init.c 2011-12-20 00:29:54.645538691 -0700
|
||||
+++ b/nptl/nptl-init.c 2012-01-03 10:18:38.977513783 -0700
|
||||
@@ -69,6 +69,13 @@ extern void __libc_setup_tls (size_t tcb
|
||||
#endif
|
||||
|
||||
#ifdef SHARED
|
||||
+static
|
||||
+#else
|
||||
+extern
|
||||
+#endif
|
||||
+void __nptl_set_robust (struct pthread *);
|
||||
+
|
||||
+#ifdef SHARED
|
||||
static void nptl_freeres (void);
|
||||
|
||||
|
||||
@@ -131,13 +138,25 @@ static const struct pthread_functions pt
|
||||
.ptr__nptl_deallocate_tsd = __nptl_deallocate_tsd,
|
||||
.ptr__nptl_setxid = __nptl_setxid,
|
||||
/* For now only the stack cache needs to be freed. */
|
||||
- .ptr_freeres = nptl_freeres
|
||||
+ .ptr_freeres = nptl_freeres,
|
||||
+ .ptr_set_robust = __nptl_set_robust
|
||||
};
|
||||
# define ptr_pthread_functions &pthread_functions
|
||||
#else
|
||||
# define ptr_pthread_functions NULL
|
||||
#endif
|
||||
|
||||
+#ifdef SHARED
|
||||
+static
|
||||
+#endif
|
||||
+void
|
||||
+__nptl_set_robust (struct pthread *self)
|
||||
+{
|
||||
+ INTERNAL_SYSCALL_DECL (err);
|
||||
+ INTERNAL_SYSCALL (set_robust_list, err, 2, &self->robust_head,
|
||||
+ sizeof (struct robust_list_head));
|
||||
+}
|
||||
+
|
||||
|
||||
#ifdef SHARED
|
||||
/* This function is called indirectly from the freeres code in libc. */
|
||||
diff -Nrup a/nptl/pthreadP.h b/nptl/pthreadP.h
|
||||
--- a/nptl/pthreadP.h 2010-05-04 05:27:23.000000000 -0600
|
||||
+++ b/nptl/pthreadP.h 2012-01-03 10:12:35.599269269 -0700
|
||||
@@ -555,17 +555,20 @@ extern void __pthread_cleanup_pop_restor
|
||||
|
||||
/* Old cleanup interfaces, still used in libc.so. */
|
||||
extern void _pthread_cleanup_push (struct _pthread_cleanup_buffer *buffer,
|
||||
- void (*routine) (void *), void *arg);
|
||||
+ void (*routine) (void *), void *arg);
|
||||
extern void _pthread_cleanup_pop (struct _pthread_cleanup_buffer *buffer,
|
||||
- int execute);
|
||||
+ int execute);
|
||||
extern void _pthread_cleanup_push_defer (struct _pthread_cleanup_buffer *buffer,
|
||||
- void (*routine) (void *), void *arg);
|
||||
+ void (*routine) (void *), void *arg);
|
||||
extern void _pthread_cleanup_pop_restore (struct _pthread_cleanup_buffer *buffer,
|
||||
- int execute);
|
||||
+ int execute);
|
||||
|
||||
extern void __nptl_deallocate_tsd (void) attribute_hidden;
|
||||
|
||||
extern int __nptl_setxid (struct xid_command *cmdp) attribute_hidden;
|
||||
+#ifndef SHARED
|
||||
+extern void __nptl_set_robust (struct pthread *self);
|
||||
+#endif
|
||||
|
||||
extern void __free_stacks (size_t limit) attribute_hidden;
|
||||
|
||||
diff -Nrup a/nptl/sysdeps/pthread/pthread-functions.h b/nptl/sysdeps/pthread/pthread-functions.h
|
||||
--- a/nptl/sysdeps/pthread/pthread-functions.h 2010-05-04 05:27:23.000000000 -0600
|
||||
+++ b/nptl/sysdeps/pthread/pthread-functions.h 2012-01-03 10:12:35.639269301 -0700
|
||||
@@ -97,6 +97,7 @@ struct pthread_functions
|
||||
void (*ptr__nptl_deallocate_tsd) (void);
|
||||
int (*ptr__nptl_setxid) (struct xid_command *);
|
||||
void (*ptr_freeres) (void);
|
||||
+ void (*ptr_set_robust) (struct pthread *);
|
||||
};
|
||||
|
||||
/* Variable in libc.so. */
|
||||
diff -Nrup a/nptl/sysdeps/unix/sysv/linux/fork.c b/nptl/sysdeps/unix/sysv/linux/fork.c
|
||||
--- a/nptl/sysdeps/unix/sysv/linux/fork.c 2010-05-04 05:27:23.000000000 -0600
|
||||
+++ b/nptl/sysdeps/unix/sysv/linux/fork.c 2012-01-03 10:12:35.649269309 -0700
|
||||
@@ -29,6 +29,7 @@
|
||||
#include <ldsodefs.h>
|
||||
#include <bits/stdio-lock.h>
|
||||
#include <atomic.h>
|
||||
+#include <pthreadP.h>
|
||||
|
||||
|
||||
unsigned long int *__fork_generation_pointer;
|
||||
@@ -86,8 +87,8 @@ __libc_fork (void)
|
||||
just go away. The unloading code works in the order of the
|
||||
list.
|
||||
|
||||
- While executing the registered handlers we are building a
|
||||
- list of all the entries so that we can go backward later on. */
|
||||
+ While executing the registered handlers we are building a
|
||||
+ list of all the entries so that we can go backward later on. */
|
||||
while (1)
|
||||
{
|
||||
/* Execute the handler if there is one. */
|
||||
@@ -154,6 +155,24 @@ __libc_fork (void)
|
||||
GL(dl_cpuclock_offset) = now;
|
||||
#endif
|
||||
|
||||
+#ifdef __NR_set_robust_list
|
||||
+ /* Initialize the robust mutex list which has been reset during
|
||||
+ the fork. We do not check for errors since if it fails here
|
||||
+ it failed at process start as well and noone could have used
|
||||
+ robust mutexes. We also do not have to set
|
||||
+ self->robust_head.futex_offset since we inherit the correct
|
||||
+ value from the parent. */
|
||||
+# ifdef SHARED
|
||||
+ if (__libc_pthread_functions.ptr_set_robust != NULL)
|
||||
+ PTHFCT_CALL (ptr_set_robust, (self));
|
||||
+# else
|
||||
+ extern __typeof (__nptl_set_robust) __nptl_set_robust
|
||||
+ __attribute__((weak));
|
||||
+ if (__builtin_expect (__nptl_set_robust != NULL, 0))
|
||||
+ __nptl_set_robust (self);
|
||||
+# endif
|
||||
+#endif
|
||||
+
|
||||
/* Reset the file list. These are recursive mutexes. */
|
||||
fresetlockfiles ();
|
||||
|
||||
@@ -170,10 +189,10 @@ __libc_fork (void)
|
||||
allp->handler->child_handler ();
|
||||
|
||||
/* Note that we do not have to wake any possible waiter.
|
||||
- This is the only thread in the new process. The count
|
||||
- may have been bumped up by other threads doing a fork.
|
||||
- We reset it to 1, to avoid waiting for non-existing
|
||||
- thread(s) to release the count. */
|
||||
+ This is the only thread in the new process. The count
|
||||
+ may have been bumped up by other threads doing a fork.
|
||||
+ We reset it to 1, to avoid waiting for non-existing
|
||||
+ thread(s) to release the count. */
|
||||
allp->handler->refcntr = 1;
|
||||
|
||||
/* XXX We could at this point look through the object pool
|
||||
329
src/patches/glibc/glibc-rh782585.patch
Normal file
329
src/patches/glibc/glibc-rh782585.patch
Normal file
@@ -0,0 +1,329 @@
|
||||
diff -rup a/elf/dl-close.c b/elf/dl-close.c
|
||||
--- a/elf/dl-close.c 2012-01-19 12:59:42.759484350 -0700
|
||||
+++ b/elf/dl-close.c 2012-01-19 14:10:20.439263806 -0700
|
||||
@@ -223,7 +223,7 @@ _dl_close_worker (struct link_map *map)
|
||||
}
|
||||
|
||||
/* Sort the entries. */
|
||||
- _dl_sort_fini (ns->_ns_loaded, maps, nloaded, used, nsid);
|
||||
+ _dl_sort_fini (maps, nloaded, used, nsid);
|
||||
|
||||
/* Call all termination functions at once. */
|
||||
#ifdef SHARED
|
||||
diff -rup a/elf/dl-deps.c b/elf/dl-deps.c
|
||||
--- a/elf/dl-deps.c 2012-01-19 12:59:42.716484301 -0700
|
||||
+++ b/elf/dl-deps.c 2012-01-19 13:52:35.223720556 -0700
|
||||
@@ -614,51 +614,67 @@ Filters not supported with LD_TRACE_PREL
|
||||
map->l_searchlist.r_list[i]->l_reserved = 0;
|
||||
}
|
||||
|
||||
- /* Now determine the order in which the initialization has to happen. */
|
||||
+ /* Sort the initializer list to take dependencies into account. The binary
|
||||
+ itself will always be initialize last. */
|
||||
memcpy (l_initfini, map->l_searchlist.r_list,
|
||||
nlist * sizeof (struct link_map *));
|
||||
- /* We can skip looking for the binary itself which is at the front
|
||||
- of the search list. Look through the list backward so that circular
|
||||
- dependencies are not changing the order. */
|
||||
- for (i = 1; i < nlist; ++i)
|
||||
+ if (__builtin_expect (nlist > 1, 1))
|
||||
{
|
||||
- struct link_map *l = map->l_searchlist.r_list[i];
|
||||
- unsigned int j;
|
||||
- unsigned int k;
|
||||
-
|
||||
- /* Find the place in the initfini list where the map is currently
|
||||
- located. */
|
||||
- for (j = 1; l_initfini[j] != l; ++j)
|
||||
- ;
|
||||
-
|
||||
- /* Find all object for which the current one is a dependency and
|
||||
- move the found object (if necessary) in front. */
|
||||
- for (k = j + 1; k < nlist; ++k)
|
||||
+ /* We can skip looking for the binary itself which is at the front
|
||||
+ of the search list. */
|
||||
+ i = 1;
|
||||
+ unsigned int seen[nlist];
|
||||
+ memset (seen, 0, nlist * sizeof (seen[0]));
|
||||
+ while (1)
|
||||
{
|
||||
- struct link_map **runp;
|
||||
-
|
||||
- runp = l_initfini[k]->l_initfini;
|
||||
- if (runp != NULL)
|
||||
+ /* Keep track of which object we looked at this round. */
|
||||
+ ++seen[i];
|
||||
+ struct link_map *thisp = l_initfini[i];
|
||||
+
|
||||
+ /* Find the last object in the list for which the current one is
|
||||
+ a dependency and move the current object behind the object
|
||||
+ with the dependency. */
|
||||
+ unsigned int k = nlist - 1;
|
||||
+ while (k > i)
|
||||
{
|
||||
- while (*runp != NULL)
|
||||
- if (__builtin_expect (*runp++ == l, 0))
|
||||
- {
|
||||
- struct link_map *here = l_initfini[k];
|
||||
-
|
||||
- /* Move it now. */
|
||||
- memmove (&l_initfini[j] + 1, &l_initfini[j],
|
||||
- (k - j) * sizeof (struct link_map *));
|
||||
- l_initfini[j] = here;
|
||||
-
|
||||
- /* Don't insert further matches before the last
|
||||
- entry moved to the front. */
|
||||
- ++j;
|
||||
+ struct link_map **runp = l_initfini[k]->l_initfini;
|
||||
+ if (runp != NULL)
|
||||
+ /* Look through the dependencies of the object. */
|
||||
+ while (*runp != NULL)
|
||||
+ if (__builtin_expect (*runp++ == thisp, 0))
|
||||
+ {
|
||||
+ /* Move the current object to the back past the last
|
||||
+ object with it as the dependency. */
|
||||
+ memmove (&l_initfini[i], &l_initfini[i + 1],
|
||||
+ (k - i) * sizeof (l_initfini[0]));
|
||||
+ l_initfini[k] = thisp;
|
||||
+
|
||||
+ if (seen[i + 1] > nlist - i - 2)
|
||||
+ {
|
||||
+ ++i;
|
||||
+ goto next_clear;
|
||||
+ }
|
||||
+
|
||||
+ unsigned int this_seen = seen[i];
|
||||
+ memmove (&seen[i], &seen[i + 1],
|
||||
+ (k - i) * sizeof (seen[0]));
|
||||
+ seen[k] = this_seen;
|
||||
+
|
||||
+ goto next;
|
||||
+ }
|
||||
|
||||
- break;
|
||||
- }
|
||||
+ --k;
|
||||
}
|
||||
+
|
||||
+ if (++i == nlist)
|
||||
+ break;
|
||||
+ next_clear:
|
||||
+ memset (&seen[i], 0, (nlist - i) * sizeof (seen[0]));
|
||||
+
|
||||
+ next:;
|
||||
}
|
||||
}
|
||||
+
|
||||
/* Terminate the list of dependencies. */
|
||||
l_initfini[nlist] = NULL;
|
||||
atomic_write_barrier ();
|
||||
diff -rup a/elf/dl-fini.c b/elf/dl-fini.c
|
||||
--- a/elf/dl-fini.c 2010-05-04 05:27:23.000000000 -0600
|
||||
+++ b/elf/dl-fini.c 2012-01-19 13:56:38.653842046 -0700
|
||||
@@ -1,5 +1,6 @@
|
||||
/* Call the termination functions of loaded shared objects.
|
||||
- Copyright (C) 1995,96,1998-2002,2004-2005,2009 Free Software Foundation, Inc.
|
||||
+ Copyright (C) 1995,96,1998-2002,2004-2005,2009,2011
|
||||
+ 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
|
||||
@@ -29,89 +30,100 @@ typedef void (*fini_t) (void);
|
||||
|
||||
void
|
||||
internal_function
|
||||
-_dl_sort_fini (struct link_map *l, struct link_map **maps, size_t nmaps,
|
||||
- char *used, Lmid_t ns)
|
||||
+_dl_sort_fini (struct link_map **maps, size_t nmaps, char *used, Lmid_t ns)
|
||||
{
|
||||
- if (ns == LM_ID_BASE)
|
||||
- /* The main executable always comes first. */
|
||||
- l = l->l_next;
|
||||
-
|
||||
- for (; l != NULL; l = l->l_next)
|
||||
- /* Do not handle ld.so in secondary namespaces and object which
|
||||
- are not removed. */
|
||||
- if (l == l->l_real && l->l_idx != -1)
|
||||
- {
|
||||
- /* Find the place in the 'maps' array. */
|
||||
- unsigned int j;
|
||||
- for (j = ns == LM_ID_BASE ? 1 : 0; maps[j] != l; ++j)
|
||||
- assert (j < nmaps);
|
||||
-
|
||||
- /* Find all object for which the current one is a dependency
|
||||
- and move the found object (if necessary) in front. */
|
||||
- for (unsigned int k = j + 1; k < nmaps; ++k)
|
||||
- {
|
||||
- struct link_map **runp = maps[k]->l_initfini;
|
||||
- if (runp != NULL)
|
||||
- {
|
||||
- while (*runp != NULL)
|
||||
- if (*runp == l)
|
||||
- {
|
||||
- struct link_map *here = maps[k];
|
||||
+ /* A list of one element need not be sorted. */
|
||||
+ if (nmaps == 1)
|
||||
+ return;
|
||||
+
|
||||
+ /* We can skip looking for the binary itself which is at the front
|
||||
+ of the search list for the main namespace. */
|
||||
+ unsigned int i = ns == LM_ID_BASE;
|
||||
+ unsigned int seen[nmaps];
|
||||
+ memset (seen, 0, nmaps * sizeof (seen[0]));
|
||||
+ while (1)
|
||||
+ {
|
||||
+ /* Keep track of which object we looked at this round. */
|
||||
+ ++seen[i];
|
||||
+ struct link_map *thisp = maps[i];
|
||||
+
|
||||
+ /* Do not handle ld.so in secondary namespaces and object which
|
||||
+ are not removed. */
|
||||
+ if (thisp != thisp->l_real || thisp->l_idx == -1)
|
||||
+ goto skip;
|
||||
+
|
||||
+ /* Find the last object in the list for which the current one is
|
||||
+ a dependency and move the current object behind the object
|
||||
+ with the dependency. */
|
||||
+ unsigned int k = nmaps - 1;
|
||||
+ while (k > i)
|
||||
+ {
|
||||
+ struct link_map **runp = maps[k]->l_initfini;
|
||||
+ if (runp != NULL)
|
||||
+ /* Look through the dependencies of the object. */
|
||||
+ while (*runp != NULL)
|
||||
+ if (__builtin_expect (*runp++ == thisp, 0))
|
||||
+ {
|
||||
+ move:
|
||||
+ /* Move the current object to the back past the last
|
||||
+ object with it as the dependency. */
|
||||
+ memmove (&maps[i], &maps[i + 1],
|
||||
+ (k - i) * sizeof (maps[0]));
|
||||
+ maps[k] = thisp;
|
||||
|
||||
- /* Move it now. */
|
||||
- memmove (&maps[j] + 1,
|
||||
- &maps[j], (k - j) * sizeof (struct link_map *));
|
||||
- maps[j] = here;
|
||||
+ if (used != NULL)
|
||||
+ {
|
||||
+ char here_used = used[i];
|
||||
+ memmove (&used[i], &used[i + 1],
|
||||
+ (k - i) * sizeof (used[0]));
|
||||
+ used[k] = here_used;
|
||||
+ }
|
||||
|
||||
- if (used != NULL)
|
||||
- {
|
||||
- char here_used = used[k];
|
||||
+ if (seen[i + 1] > nmaps - i - 2)
|
||||
+ {
|
||||
+ ++i;
|
||||
+ goto next_clear;
|
||||
+ }
|
||||
|
||||
- memmove (&used[j] + 1,
|
||||
- &used[j], (k - j) * sizeof (char));
|
||||
- used[j] = here_used;
|
||||
- }
|
||||
+ unsigned int this_seen = seen[i];
|
||||
+ memmove (&seen[i], &seen[i + 1], (k - i) * sizeof (seen[0]));
|
||||
+ seen[k] = this_seen;
|
||||
|
||||
- ++j;
|
||||
+ goto next;
|
||||
+ }
|
||||
|
||||
- break;
|
||||
- }
|
||||
- else
|
||||
- ++runp;
|
||||
- }
|
||||
-
|
||||
- if (__builtin_expect (maps[k]->l_reldeps != NULL, 0))
|
||||
- {
|
||||
- unsigned int m = maps[k]->l_reldeps->act;
|
||||
- struct link_map **relmaps = &maps[k]->l_reldeps->list[0];
|
||||
+ if (__builtin_expect (maps[k]->l_reldeps != NULL, 0))
|
||||
+ {
|
||||
+ unsigned int m = maps[k]->l_reldeps->act;
|
||||
+ struct link_map **relmaps = &maps[k]->l_reldeps->list[0];
|
||||
|
||||
- while (m-- > 0)
|
||||
+ /* Look through the relocation dependencies of the object. */
|
||||
+ while (m-- > 0)
|
||||
+ if (__builtin_expect (relmaps[m] == thisp, 0))
|
||||
{
|
||||
- if (relmaps[m] == l)
|
||||
- {
|
||||
- struct link_map *here = maps[k];
|
||||
-
|
||||
- /* Move it now. */
|
||||
- memmove (&maps[j] + 1,
|
||||
- &maps[j],
|
||||
- (k - j) * sizeof (struct link_map *));
|
||||
- maps[j] = here;
|
||||
-
|
||||
- if (used != NULL)
|
||||
- {
|
||||
- char here_used = used[k];
|
||||
-
|
||||
- memmove (&used[j] + 1,
|
||||
- &used[j], (k - j) * sizeof (char));
|
||||
- used[j] = here_used;
|
||||
- }
|
||||
-
|
||||
- break;
|
||||
- }
|
||||
+ /* If a cycle exists with a link time dependency,
|
||||
+ preserve the latter. */
|
||||
+ struct link_map **runp = thisp->l_initfini;
|
||||
+ if (runp != NULL)
|
||||
+ while (*runp != NULL)
|
||||
+ if (__builtin_expect (*runp++ == maps[k], 0))
|
||||
+ goto ignore;
|
||||
+ goto move;
|
||||
}
|
||||
- }
|
||||
- }
|
||||
- }
|
||||
+ ignore:;
|
||||
+ }
|
||||
+
|
||||
+ --k;
|
||||
+ }
|
||||
+
|
||||
+ skip:
|
||||
+ if (++i == nmaps)
|
||||
+ break;
|
||||
+ next_clear:
|
||||
+ memset (&seen[i], 0, (nmaps - i) * sizeof (seen[0]));
|
||||
+
|
||||
+ next:;
|
||||
+ }
|
||||
}
|
||||
|
||||
|
||||
@@ -196,9 +208,8 @@ _dl_fini (void)
|
||||
assert (ns == LM_ID_BASE || i == nloaded || i == nloaded - 1);
|
||||
nmaps = i;
|
||||
|
||||
- if (nmaps != 0)
|
||||
- /* Now we have to do the sorting. */
|
||||
- _dl_sort_fini (GL(dl_ns)[ns]._ns_loaded, maps, nmaps, NULL, ns);
|
||||
+ /* Now we have to do the sorting. */
|
||||
+ _dl_sort_fini (maps, nmaps, NULL, ns);
|
||||
|
||||
/* We do not rely on the linked list of loaded object anymore from
|
||||
this point on. We have our own list here (maps). The various
|
||||
diff -rup a/sysdeps/generic/ldsodefs.h b/sysdeps/generic/ldsodefs.h
|
||||
--- a/sysdeps/generic/ldsodefs.h 2012-01-19 12:59:42.446483997 -0700
|
||||
+++ b/sysdeps/generic/ldsodefs.h 2012-01-19 14:16:36.242453532 -0700
|
||||
@@ -947,7 +947,7 @@ extern void _dl_init (struct link_map *m
|
||||
extern void _dl_fini (void) internal_function;
|
||||
|
||||
/* Sort array MAPS according to dependencies of the contained objects. */
|
||||
-extern void _dl_sort_fini (struct link_map *l, struct link_map **maps,
|
||||
+extern void _dl_sort_fini (struct link_map **maps,
|
||||
size_t nmaps, char *used, Lmid_t ns)
|
||||
internal_function;
|
||||
|
||||
166
src/patches/glibc/glibc-rh784402.patch
Normal file
166
src/patches/glibc/glibc-rh784402.patch
Normal file
@@ -0,0 +1,166 @@
|
||||
commit 3e1aa84e7f9f38815f5db9cd7654b1a9497cf6e4
|
||||
Author: Ulrich Drepper <drepper@gmail.com>
|
||||
Date: Fri Jan 20 22:39:54 2012 -0500
|
||||
|
||||
Do not cache negative results in nscd if these are transient
|
||||
|
||||
diff -rup a/nscd/aicache.c b/nscd/aicache.c
|
||||
--- a/nscd/aicache.c 2012-01-24 20:32:58.906826425 -0700
|
||||
+++ b/nscd/aicache.c 2012-01-24 20:42:17.663968882 -0700
|
||||
@@ -511,9 +511,17 @@ next_nip:
|
||||
if (fd != -1)
|
||||
TEMP_FAILURE_RETRY (send (fd, ¬found, total, MSG_NOSIGNAL));
|
||||
|
||||
- dataset = mempool_alloc (db, sizeof (struct dataset) + req->key_len, 1);
|
||||
- /* If we cannot permanently store the result, so be it. */
|
||||
- if (dataset != NULL)
|
||||
+ /* If we have a transient error or cannot permanently store the
|
||||
+ result, so be it. */
|
||||
+ if (rc4 == EAGAIN || __builtin_expect (db->negtimeout == 0, 0))
|
||||
+ {
|
||||
+ /* Mark the old entry as obsolete. */
|
||||
+ if (dh != NULL)
|
||||
+ dh->usable = false;
|
||||
+ dataset = NULL;
|
||||
+ }
|
||||
+ else if ((dataset = mempool_alloc (db, (sizeof (struct dataset)
|
||||
+ + req->key_len), 1)) != NULL)
|
||||
{
|
||||
dataset->head.allocsize = sizeof (struct dataset) + req->key_len;
|
||||
dataset->head.recsize = total;
|
||||
diff -rup a/nscd/grpcache.c b/nscd/grpcache.c
|
||||
--- a/nscd/grpcache.c 2012-01-24 20:32:58.910826427 -0700
|
||||
+++ b/nscd/grpcache.c 2012-01-24 20:42:17.666968883 -0700
|
||||
@@ -114,13 +114,21 @@ cache_addgr (struct database_dyn *db, in
|
||||
case. */
|
||||
total = sizeof (notfound);
|
||||
|
||||
- written = TEMP_FAILURE_RETRY (send (fd, ¬found, total,
|
||||
- MSG_NOSIGNAL));
|
||||
+ if (fd != -1)
|
||||
+ written = TEMP_FAILURE_RETRY (send (fd, ¬found, total,
|
||||
+ MSG_NOSIGNAL));
|
||||
+ else
|
||||
+ written = total;
|
||||
|
||||
- dataset = mempool_alloc (db, sizeof (struct dataset) + req->key_len,
|
||||
- 1);
|
||||
- /* If we cannot permanently store the result, so be it. */
|
||||
- if (dataset != NULL)
|
||||
+ /* If we have a transient error or cannot permanently store
|
||||
+ the result, so be it. */
|
||||
+ if (errno == EAGAIN || __builtin_expect (db->negtimeout == 0, 0))
|
||||
+ {
|
||||
+ /* Mark the old entry as obsolete. */
|
||||
+ if (dh != NULL)
|
||||
+ dh->usable = false;
|
||||
+ }
|
||||
+ else if ((dataset = mempool_alloc (db, sizeof (struct dataset) + req->key_len, 1)) != NULL)
|
||||
{
|
||||
dataset->head.allocsize = sizeof (struct dataset) + req->key_len;
|
||||
dataset->head.recsize = total;
|
||||
diff -rup a/nscd/hstcache.c b/nscd/hstcache.c
|
||||
--- a/nscd/hstcache.c 2012-01-24 20:32:58.911826427 -0700
|
||||
+++ b/nscd/hstcache.c 2012-01-24 20:42:17.668968883 -0700
|
||||
@@ -141,10 +141,16 @@ cache_addhst (struct database_dyn *db, i
|
||||
MSG_NOSIGNAL)) != total)
|
||||
all_written = false;
|
||||
|
||||
- dataset = mempool_alloc (db, sizeof (struct dataset) + req->key_len,
|
||||
- 1);
|
||||
- /* If we cannot permanently store the result, so be it. */
|
||||
- if (dataset != NULL)
|
||||
+ /* If we have a transient error or cannot permanently store
|
||||
+ the result, so be it. */
|
||||
+ if (errval == EAGAIN || __builtin_expect (db->negtimeout == 0, 0))
|
||||
+ {
|
||||
+ /* Mark the old entry as obsolete. */
|
||||
+ if (dh != NULL)
|
||||
+ dh->usable = false;
|
||||
+ }
|
||||
+ else if ((dataset = mempool_alloc (db, (sizeof (struct dataset)
|
||||
+ + req->key_len), 1)) != NULL)
|
||||
{
|
||||
dataset->head.allocsize = sizeof (struct dataset) + req->key_len;
|
||||
dataset->head.recsize = total;
|
||||
diff -rup a/nscd/initgrcache.c b/nscd/initgrcache.c
|
||||
--- a/nscd/initgrcache.c 2012-01-24 20:32:58.912826427 -0700
|
||||
+++ b/nscd/initgrcache.c 2012-01-24 20:42:17.671968883 -0700
|
||||
@@ -202,10 +202,16 @@ addinitgroupsX (struct database_dyn *db,
|
||||
written = TEMP_FAILURE_RETRY (send (fd, ¬found, total,
|
||||
MSG_NOSIGNAL));
|
||||
|
||||
- dataset = mempool_alloc (db, sizeof (struct dataset) + req->key_len,
|
||||
- 1);
|
||||
- /* If we cannot permanently store the result, so be it. */
|
||||
- if (dataset != NULL)
|
||||
+ /* If we have a transient error or cannot permanently store
|
||||
+ the result, so be it. */
|
||||
+ if (all_tryagain || __builtin_expect (db->negtimeout == 0, 0))
|
||||
+ {
|
||||
+ /* Mark the old entry as obsolete. */
|
||||
+ if (dh != NULL)
|
||||
+ dh->usable = false;
|
||||
+ }
|
||||
+ else if ((dataset = mempool_alloc (db, (sizeof (struct dataset)
|
||||
+ + req->key_len), 1)) != NULL)
|
||||
{
|
||||
dataset->head.allocsize = sizeof (struct dataset) + req->key_len;
|
||||
dataset->head.recsize = total;
|
||||
diff -rup a/nscd/pwdcache.c b/nscd/pwdcache.c
|
||||
--- a/nscd/pwdcache.c 2012-01-24 20:32:58.914826427 -0700
|
||||
+++ b/nscd/pwdcache.c 2012-01-24 20:42:17.671968883 -0700
|
||||
@@ -124,10 +124,16 @@ cache_addpw (struct database_dyn *db, in
|
||||
written = TEMP_FAILURE_RETRY (send (fd, ¬found, total,
|
||||
MSG_NOSIGNAL));
|
||||
|
||||
- dataset = mempool_alloc (db, sizeof (struct dataset) + req->key_len,
|
||||
- 1);
|
||||
- /* If we cannot permanently store the result, so be it. */
|
||||
- if (dataset != NULL)
|
||||
+ /* If we have a transient error or cannot permanently store
|
||||
+ the result, so be it. */
|
||||
+ if (errno == EAGAIN || __builtin_expect (db->negtimeout == 0, 0))
|
||||
+ {
|
||||
+ /* Mark the old entry as obsolete. */
|
||||
+ if (dh != NULL)
|
||||
+ dh->usable = false;
|
||||
+ }
|
||||
+ else if ((dataset = mempool_alloc (db, (sizeof (struct dataset)
|
||||
+ + req->key_len), 1)) != NULL)
|
||||
{
|
||||
dataset->head.allocsize = sizeof (struct dataset) + req->key_len;
|
||||
dataset->head.recsize = total;
|
||||
diff -rup a/nscd/servicescache.c b/nscd/servicescache.c
|
||||
--- a/nscd/servicescache.c 2012-01-24 20:32:58.915826427 -0700
|
||||
+++ b/nscd/servicescache.c 2012-01-24 20:42:17.672968884 -0700
|
||||
@@ -102,15 +102,22 @@ cache_addserv (struct database_dyn *db,
|
||||
{
|
||||
/* We have no data. This means we send the standard reply for this
|
||||
case. */
|
||||
- total = sizeof (notfound);
|
||||
+ written = total = sizeof (notfound);
|
||||
|
||||
- written = TEMP_FAILURE_RETRY (send (fd, ¬found, total,
|
||||
- MSG_NOSIGNAL));
|
||||
+ if (fd != -1)
|
||||
+ written = TEMP_FAILURE_RETRY (send (fd, ¬found, total,
|
||||
+ MSG_NOSIGNAL));
|
||||
|
||||
- dataset = mempool_alloc (db, sizeof (struct dataset) + req->key_len,
|
||||
- 1);
|
||||
- /* If we cannot permanently store the result, so be it. */
|
||||
- if (dataset != NULL)
|
||||
+ /* If we have a transient error or cannot permanently store
|
||||
+ the result, so be it. */
|
||||
+ if (errval == EAGAIN || __builtin_expect (db->negtimeout == 0, 0))
|
||||
+ {
|
||||
+ /* Mark the old entry as obsolete. */
|
||||
+ if (dh != NULL)
|
||||
+ dh->usable = false;
|
||||
+ }
|
||||
+ else if ((dataset = mempool_alloc (db, (sizeof (struct dataset)
|
||||
+ + req->key_len), 1)) != NULL)
|
||||
{
|
||||
dataset->head.allocsize = sizeof (struct dataset) + req->key_len;
|
||||
dataset->head.recsize = total;
|
||||
20
src/patches/glibc/glibc-rh785984.patch
Normal file
20
src/patches/glibc/glibc-rh785984.patch
Normal file
@@ -0,0 +1,20 @@
|
||||
diff -rup a/localedata/locales/zh_CN b/localedata/locales/zh_CN
|
||||
--- a/localedata/locales/zh_CN 2006-07-30 16:19:43.000000000 -0600
|
||||
+++ b/localedata/locales/zh_CN 2012-01-30 21:24:46.905115483 -0700
|
||||
@@ -108,11 +108,11 @@ day "<U661F><U671F><U65E5>";/
|
||||
"<U661F><U671F><U4E94>";/
|
||||
"<U661F><U671F><U516D>"
|
||||
|
||||
-abmon "<U0020><U0031><U6708>";"<U0020><U0032><U6708>";/
|
||||
- "<U0020><U0033><U6708>";"<U0020><U0034><U6708>";/
|
||||
- "<U0020><U0035><U6708>";"<U0020><U0036><U6708>";/
|
||||
- "<U0020><U0037><U6708>";"<U0020><U0038><U6708>";/
|
||||
- "<U0020><U0039><U6708>";"<U0031><U0030><U6708>";/
|
||||
+abmon "<U0031><U6708>";"<U0032><U6708>";/
|
||||
+ "<U0033><U6708>";"<U0034><U6708>";/
|
||||
+ "<U0035><U6708>";"<U0036><U6708>";/
|
||||
+ "<U0037><U6708>";"<U0038><U6708>";/
|
||||
+ "<U0039><U6708>";"<U0031><U0030><U6708>";/
|
||||
"<U0031><U0031><U6708>";"<U0031><U0032><U6708>"
|
||||
|
||||
mon "<U4E00><U6708>";"<U4E8C><U6708>";"<U4E09><U6708>";/
|
||||
153
src/patches/glibc/glibc-rh788959-2.patch
Normal file
153
src/patches/glibc/glibc-rh788959-2.patch
Normal file
@@ -0,0 +1,153 @@
|
||||
diff -rcp a/nscd/grpcache.c b/nscd/grpcache.c
|
||||
*** a/nscd/grpcache.c Wed Apr 11 12:50:07 2012
|
||||
--- b/nscd/grpcache.c Wed Apr 11 21:45:58 2012
|
||||
*************** cache_addgr (struct database_dyn *db, in
|
||||
*** 178,184 ****
|
||||
char *cp;
|
||||
const size_t key_len = strlen (key);
|
||||
const size_t buf_len = 3 * sizeof (grp->gr_gid) + key_len + 1;
|
||||
! char *buf = alloca (buf_len);
|
||||
ssize_t n;
|
||||
size_t cnt;
|
||||
|
||||
--- 178,185 ----
|
||||
char *cp;
|
||||
const size_t key_len = strlen (key);
|
||||
const size_t buf_len = 3 * sizeof (grp->gr_gid) + key_len + 1;
|
||||
! size_t alloca_used = 0;
|
||||
! char *buf = alloca_account (buf_len, alloca_used);
|
||||
ssize_t n;
|
||||
size_t cnt;
|
||||
|
||||
*************** cache_addgr (struct database_dyn *db, in
|
||||
*** 190,196 ****
|
||||
/* Determine the length of all members. */
|
||||
while (grp->gr_mem[gr_mem_cnt])
|
||||
++gr_mem_cnt;
|
||||
! gr_mem_len = (uint32_t *) alloca (gr_mem_cnt * sizeof (uint32_t));
|
||||
for (gr_mem_cnt = 0; grp->gr_mem[gr_mem_cnt]; ++gr_mem_cnt)
|
||||
{
|
||||
gr_mem_len[gr_mem_cnt] = strlen (grp->gr_mem[gr_mem_cnt]) + 1;
|
||||
--- 191,198 ----
|
||||
/* Determine the length of all members. */
|
||||
while (grp->gr_mem[gr_mem_cnt])
|
||||
++gr_mem_cnt;
|
||||
! gr_mem_len = (uint32_t *) alloca_account (gr_mem_cnt * sizeof (uint32_t),
|
||||
! alloca_used);
|
||||
for (gr_mem_cnt = 0; grp->gr_mem[gr_mem_cnt]; ++gr_mem_cnt)
|
||||
{
|
||||
gr_mem_len[gr_mem_cnt] = strlen (grp->gr_mem[gr_mem_cnt]) + 1;
|
||||
*************** cache_addgr (struct database_dyn *db, in
|
||||
*** 205,214 ****
|
||||
change. Allocate memory on the cache since it is likely
|
||||
discarded anyway. If it turns out to be necessary to have a
|
||||
new record we can still allocate real memory. */
|
||||
! bool alloca_used = false;
|
||||
dataset = NULL;
|
||||
|
||||
! if (he == NULL)
|
||||
dataset = (struct dataset *) mempool_alloc (db, total + n, 1);
|
||||
|
||||
if (dataset == NULL)
|
||||
--- 207,216 ----
|
||||
change. Allocate memory on the cache since it is likely
|
||||
discarded anyway. If it turns out to be necessary to have a
|
||||
new record we can still allocate real memory. */
|
||||
! bool dataset_in_stack_or_freed = false;
|
||||
dataset = NULL;
|
||||
|
||||
! if (he == NULL || ! __libc_use_alloca (alloca_used + total + n))
|
||||
dataset = (struct dataset *) mempool_alloc (db, total + n, 1);
|
||||
|
||||
if (dataset == NULL)
|
||||
*************** cache_addgr (struct database_dyn *db, in
|
||||
*** 216,225 ****
|
||||
/* We cannot permanently add the result in the moment. But
|
||||
we can provide the result as is. Store the data in some
|
||||
temporary memory. */
|
||||
! dataset = (struct dataset *) alloca (total + n);
|
||||
|
||||
/* We cannot add this record to the permanent database. */
|
||||
! alloca_used = true;
|
||||
}
|
||||
|
||||
dataset->head.allocsize = total + n;
|
||||
--- 218,227 ----
|
||||
/* We cannot permanently add the result in the moment. But
|
||||
we can provide the result as is. Store the data in some
|
||||
temporary memory. */
|
||||
! dataset = (struct dataset *) alloca_account (total + n, alloca_used);
|
||||
|
||||
/* We cannot add this record to the permanent database. */
|
||||
! dataset_in_stack_or_freed = true;
|
||||
}
|
||||
|
||||
dataset->head.allocsize = total + n;
|
||||
*************** cache_addgr (struct database_dyn *db, in
|
||||
*** 273,278 ****
|
||||
--- 275,288 ----
|
||||
allocated on the stack and need not be freed. */
|
||||
dh->timeout = dataset->head.timeout;
|
||||
++dh->nreloads;
|
||||
+
|
||||
+ /* If the new record was not allocated on the stack, then it must
|
||||
+ be freed. Note that it can no longer be used. */
|
||||
+ if (! dataset_in_stack_or_freed)
|
||||
+ {
|
||||
+ free (dataset);
|
||||
+ dataset_in_stack_or_freed = true;
|
||||
+ }
|
||||
}
|
||||
else
|
||||
{
|
||||
*************** cache_addgr (struct database_dyn *db, in
|
||||
*** 288,294 ****
|
||||
key_copy = (char *) newp + (key_copy - (char *) dataset);
|
||||
|
||||
dataset = memcpy (newp, dataset, total + n);
|
||||
! alloca_used = false;
|
||||
}
|
||||
|
||||
/* Mark the old record as obsolete. */
|
||||
--- 298,304 ----
|
||||
key_copy = (char *) newp + (key_copy - (char *) dataset);
|
||||
|
||||
dataset = memcpy (newp, dataset, total + n);
|
||||
! dataset_in_stack_or_freed = false;
|
||||
}
|
||||
|
||||
/* Mark the old record as obsolete. */
|
||||
*************** cache_addgr (struct database_dyn *db, in
|
||||
*** 303,309 ****
|
||||
assert (fd != -1);
|
||||
|
||||
#ifdef HAVE_SENDFILE
|
||||
! if (__builtin_expect (db->mmap_used, 1) && !alloca_used)
|
||||
{
|
||||
assert (db->wr_fd != -1);
|
||||
assert ((char *) &dataset->resp > (char *) db->data);
|
||||
--- 313,319 ----
|
||||
assert (fd != -1);
|
||||
|
||||
#ifdef HAVE_SENDFILE
|
||||
! if (__builtin_expect (db->mmap_used, 1) && !dataset_in_stack_or_freed)
|
||||
{
|
||||
assert (db->wr_fd != -1);
|
||||
assert ((char *) &dataset->resp > (char *) db->data);
|
||||
*************** cache_addgr (struct database_dyn *db, in
|
||||
*** 330,336 ****
|
||||
|
||||
/* Add the record to the database. But only if it has not been
|
||||
stored on the stack. */
|
||||
! if (! alloca_used)
|
||||
{
|
||||
/* If necessary, we also propagate the data to disk. */
|
||||
if (db->persistent)
|
||||
--- 340,346 ----
|
||||
|
||||
/* Add the record to the database. But only if it has not been
|
||||
stored on the stack. */
|
||||
! if (! dataset_in_stack_or_freed)
|
||||
{
|
||||
/* If necessary, we also propagate the data to disk. */
|
||||
if (db->persistent)
|
||||
130
src/patches/glibc/glibc-rh788959.patch
Normal file
130
src/patches/glibc/glibc-rh788959.patch
Normal file
@@ -0,0 +1,130 @@
|
||||
diff -pruN glibc-2.12-2-gc4ccff1/nis/nss_compat/compat-initgroups.c glibc-2.12-2-gc4ccff1.patched/nis/nss_compat/compat-initgroups.c
|
||||
--- glibc-2.12-2-gc4ccff1/nis/nss_compat/compat-initgroups.c 2010-05-04 16:57:23.000000000 +0530
|
||||
+++ glibc-2.12-2-gc4ccff1.patched/nis/nss_compat/compat-initgroups.c 2012-02-21 11:11:19.877008465 +0530
|
||||
@@ -297,6 +297,8 @@ getgrent_next_nss (ent_t *ent, char *buf
|
||||
if (nss_initgroups_dyn (user, group, &mystart, &mysize, &mygroups,
|
||||
limit, errnop) == NSS_STATUS_SUCCESS)
|
||||
{
|
||||
+ status = NSS_STATUS_NOTFOUND;
|
||||
+
|
||||
/* If there is no blacklist we can trust the underlying
|
||||
initgroups implementation. */
|
||||
if (ent->blacklist.current <= 1)
|
||||
@@ -309,6 +311,7 @@ getgrent_next_nss (ent_t *ent, char *buf
|
||||
overwrite the pointer with one to a bigger buffer. */
|
||||
char *tmpbuf = buffer;
|
||||
size_t tmplen = buflen;
|
||||
+ bool use_malloc = false;
|
||||
|
||||
for (int i = 0; i < mystart; i++)
|
||||
{
|
||||
@@ -316,21 +319,36 @@ getgrent_next_nss (ent_t *ent, char *buf
|
||||
tmpbuf, tmplen, errnop))
|
||||
== NSS_STATUS_TRYAGAIN
|
||||
&& *errnop == ERANGE)
|
||||
- if (tmpbuf == buffer)
|
||||
- {
|
||||
- tmplen *= 2;
|
||||
- tmpbuf = __alloca (tmplen);
|
||||
- }
|
||||
- else
|
||||
- tmpbuf = extend_alloca (tmpbuf, tmplen, 2 * tmplen);
|
||||
+ {
|
||||
+ if (__libc_use_alloca (tmplen * 2))
|
||||
+ {
|
||||
+ if (tmpbuf == buffer)
|
||||
+ {
|
||||
+ tmplen *= 2;
|
||||
+ tmpbuf = __alloca (tmplen);
|
||||
+ }
|
||||
+ else
|
||||
+ tmpbuf = extend_alloca (tmpbuf, tmplen, tmplen * 2);
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ tmplen *= 2;
|
||||
+ char *newbuf = realloc (use_malloc ? tmpbuf : NULL, tmplen);
|
||||
+
|
||||
+ if (newbuf == NULL)
|
||||
+ {
|
||||
+ status = NSS_STATUS_TRYAGAIN;
|
||||
+ goto done;
|
||||
+ }
|
||||
+ use_malloc = true;
|
||||
+ tmpbuf = newbuf;
|
||||
+ }
|
||||
+ }
|
||||
|
||||
if (__builtin_expect (status != NSS_STATUS_NOTFOUND, 1))
|
||||
{
|
||||
if (__builtin_expect (status != NSS_STATUS_SUCCESS, 0))
|
||||
- {
|
||||
- free (mygroups);
|
||||
- return status;
|
||||
- }
|
||||
+ goto done;
|
||||
|
||||
if (!in_blacklist (grpbuf.gr_name,
|
||||
strlen (grpbuf.gr_name), ent)
|
||||
@@ -348,11 +366,17 @@ getgrent_next_nss (ent_t *ent, char *buf
|
||||
}
|
||||
}
|
||||
}
|
||||
+
|
||||
+ status = NSS_STATUS_NOTFOUND;
|
||||
+
|
||||
+ done:
|
||||
+ if (use_malloc)
|
||||
+ free (tmpbuf);
|
||||
}
|
||||
|
||||
free (mygroups);
|
||||
|
||||
- return NSS_STATUS_NOTFOUND;
|
||||
+ return status;
|
||||
}
|
||||
|
||||
free (mygroups);
|
||||
@@ -506,6 +530,7 @@ _nss_compat_initgroups_dyn (const char *
|
||||
char *tmpbuf;
|
||||
enum nss_status status;
|
||||
ent_t intern = { true, false, false, NULL, {NULL, 0, 0} };
|
||||
+ bool use_malloc = false;
|
||||
|
||||
status = internal_setgrent (&intern);
|
||||
if (status != NSS_STATUS_SUCCESS)
|
||||
@@ -519,13 +544,32 @@ _nss_compat_initgroups_dyn (const char *
|
||||
user, group, start, size,
|
||||
groupsp, limit, errnop))
|
||||
== NSS_STATUS_TRYAGAIN && *errnop == ERANGE)
|
||||
- tmpbuf = extend_alloca (tmpbuf, buflen, 2 * buflen);
|
||||
+ if (__libc_use_alloca (buflen * 2))
|
||||
+ tmpbuf = extend_alloca (tmpbuf, buflen, 2 * buflen);
|
||||
+ else
|
||||
+ {
|
||||
+ buflen *= 2;
|
||||
+ char *newbuf = realloc (use_malloc ? tmpbuf : NULL, buflen);
|
||||
+ if (newbuf == NULL)
|
||||
+ {
|
||||
+ status = NSS_STATUS_TRYAGAIN;
|
||||
+ goto done;
|
||||
+ }
|
||||
+ use_malloc = true;
|
||||
+ tmpbuf = newbuf;
|
||||
+ }
|
||||
}
|
||||
while (status == NSS_STATUS_SUCCESS);
|
||||
|
||||
+ status = NSS_STATUS_SUCCESS;
|
||||
+
|
||||
+ done:
|
||||
+ if (use_malloc)
|
||||
+ free (tmpbuf);
|
||||
+
|
||||
internal_endgrent (&intern);
|
||||
|
||||
- return NSS_STATUS_SUCCESS;
|
||||
+ return status;
|
||||
}
|
||||
|
||||
|
||||
12
src/patches/glibc/glibc-rh789189.patch
Normal file
12
src/patches/glibc/glibc-rh789189.patch
Normal file
@@ -0,0 +1,12 @@
|
||||
diff -rup a/resolv/res_init.c b/resolv/res_init.c
|
||||
--- a/resolv/res_init.c 2010-05-04 05:27:23.000000000 -0600
|
||||
+++ b/resolv/res_init.c 2012-02-10 10:20:24.923578396 -0700
|
||||
@@ -325,7 +325,7 @@ __res_vinit(res_state statp, int preinit
|
||||
struct in6_addr a6;
|
||||
char *el;
|
||||
|
||||
- if ((el = strchr(cp, '\n')) != NULL)
|
||||
+ if ((el = strpbrk(cp, " \t\n")) != NULL)
|
||||
*el = '\0';
|
||||
if ((el = strchr(cp, SCOPE_DELIMITER)) != NULL)
|
||||
*el = '\0';
|
||||
12
src/patches/glibc/glibc-rh789209.patch
Normal file
12
src/patches/glibc/glibc-rh789209.patch
Normal file
@@ -0,0 +1,12 @@
|
||||
diff -rup a/localedata/locales/uk_UA b/localedata/locales/uk_UA
|
||||
--- a/localedata/locales/uk_UA 2010-05-04 05:27:23.000000000 -0600
|
||||
+++ b/localedata/locales/uk_UA 2012-02-10 09:59:16.934189715 -0700
|
||||
@@ -700,7 +700,7 @@ LC_MONETARY
|
||||
% 200 hrv. - 200 hryven (money)
|
||||
|
||||
% the local currency symbol
|
||||
-currency_symbol "<U0433><U0440>" % hr (hryvnya)
|
||||
+currency_symbol "<U0433><U0440><U043D><U002E>" % hr (hryvnya)
|
||||
|
||||
% This must be a 4-character string containing the international currency
|
||||
% symbol as defined by the ISO 4217 standard (three characters) followed
|
||||
114
src/patches/glibc/glibc-rh789238-2.patch
Normal file
114
src/patches/glibc/glibc-rh789238-2.patch
Normal file
@@ -0,0 +1,114 @@
|
||||
diff -rup a/malloc/arena.c b/malloc/arena.c
|
||||
--- a/malloc/arena.c 2012-03-02 10:22:47.025002715 -0700
|
||||
+++ b/malloc/arena.c 2012-03-02 10:27:47.442361529 -0700
|
||||
@@ -123,14 +123,14 @@ int __malloc_initialized = -1;
|
||||
if(ptr) \
|
||||
(void)mutex_lock(&ptr->mutex); \
|
||||
else \
|
||||
- ptr = arena_get2(ptr, (size)); \
|
||||
+ ptr = arena_get2(ptr, (size), false); \
|
||||
} while(0)
|
||||
#else
|
||||
#define arena_lock(ptr, size) do { \
|
||||
if(ptr && !mutex_trylock(&ptr->mutex)) { \
|
||||
THREAD_STAT(++(ptr->stat_lock_direct)); \
|
||||
} else \
|
||||
- ptr = arena_get2(ptr, (size)); \
|
||||
+ ptr = arena_get2(ptr, (size), false); \
|
||||
} while(0)
|
||||
#endif
|
||||
|
||||
@@ -982,7 +982,7 @@ get_free_list (void)
|
||||
|
||||
|
||||
static mstate
|
||||
-reused_arena (void)
|
||||
+reused_arena (bool retrying)
|
||||
{
|
||||
mstate result;
|
||||
static mstate next_to_use;
|
||||
@@ -999,6 +999,15 @@ reused_arena (void)
|
||||
}
|
||||
while (result != next_to_use);
|
||||
|
||||
+ /* If we are retrying due to a failure to allocate in the main
|
||||
+ arena, don't wait for the main arena to become available, select
|
||||
+ another.
|
||||
+
|
||||
+ To really fix this right we would have to try the allocation
|
||||
+ in every other arena, but that seems like severe overkill. */
|
||||
+ if (retrying && result == &main_arena)
|
||||
+ result = result->next;
|
||||
+
|
||||
/* No arena available. Wait for the next in line. */
|
||||
(void)mutex_lock(&result->mutex);
|
||||
|
||||
@@ -1014,9 +1023,9 @@ reused_arena (void)
|
||||
static mstate
|
||||
internal_function
|
||||
#if __STD_C
|
||||
-arena_get2(mstate a_tsd, size_t size)
|
||||
+arena_get2(mstate a_tsd, size_t size, bool retrying)
|
||||
#else
|
||||
-arena_get2(a_tsd, size) mstate a_tsd; size_t size;
|
||||
+arena_get2(a_tsd, size, retrying) mstate a_tsd; size_t size; bool retrying
|
||||
#endif
|
||||
{
|
||||
mstate a;
|
||||
@@ -1055,7 +1064,7 @@ arena_get2(a_tsd, size) mstate a_tsd; si
|
||||
catomic_decrement (&narenas);
|
||||
}
|
||||
else
|
||||
- a = reused_arena ();
|
||||
+ a = reused_arena (retrying);
|
||||
}
|
||||
#else
|
||||
if(!a_tsd)
|
||||
diff -rup a/malloc/malloc.c b/malloc/malloc.c
|
||||
--- a/malloc/malloc.c 2012-03-02 10:22:47.061002519 -0700
|
||||
+++ b/malloc/malloc.c 2012-03-02 10:23:53.151643863 -0700
|
||||
@@ -3671,7 +3671,7 @@ public_mALLOc(size_t bytes)
|
||||
/* ... or sbrk() has failed and there is still a chance to mmap() */
|
||||
mstate prev = ar_ptr->next ? ar_ptr : 0;
|
||||
(void)mutex_unlock(&ar_ptr->mutex);
|
||||
- ar_ptr = arena_get2(prev, bytes);
|
||||
+ ar_ptr = arena_get2(prev, bytes, true);
|
||||
if(ar_ptr) {
|
||||
victim = _int_malloc(ar_ptr, bytes);
|
||||
(void)mutex_unlock(&ar_ptr->mutex);
|
||||
@@ -3892,7 +3892,7 @@ public_mEMALIGn(size_t alignment, size_t
|
||||
/* ... or sbrk() has failed and there is still a chance to mmap() */
|
||||
mstate prev = ar_ptr->next ? ar_ptr : 0;
|
||||
(void)mutex_unlock(&ar_ptr->mutex);
|
||||
- ar_ptr = arena_get2(prev, bytes);
|
||||
+ ar_ptr = arena_get2(prev, bytes, true);
|
||||
if(ar_ptr) {
|
||||
p = _int_memalign(ar_ptr, alignment, bytes);
|
||||
(void)mutex_unlock(&ar_ptr->mutex);
|
||||
@@ -3943,7 +3943,7 @@ public_vALLOc(size_t bytes)
|
||||
/* ... or sbrk() has failed and there is still a chance to mmap() */
|
||||
mstate prev = ar_ptr->next ? ar_ptr : 0;
|
||||
(void)mutex_unlock(&ar_ptr->mutex);
|
||||
- ar_ptr = arena_get2(prev, bytes);
|
||||
+ ar_ptr = arena_get2(prev, bytes, true);
|
||||
if(ar_ptr) {
|
||||
p = _int_memalign(ar_ptr, pagesz, bytes);
|
||||
(void)mutex_unlock(&ar_ptr->mutex);
|
||||
@@ -3992,7 +3992,7 @@ public_pVALLOc(size_t bytes)
|
||||
/* ... or sbrk() has failed and there is still a chance to mmap() */
|
||||
mstate prev = ar_ptr->next ? ar_ptr : 0;
|
||||
(void)mutex_unlock(&ar_ptr->mutex);
|
||||
- ar_ptr = arena_get2(prev, bytes + 2*pagesz + MINSIZE);
|
||||
+ ar_ptr = arena_get2(prev, bytes + 2*pagesz + MINSIZE, true);
|
||||
if(ar_ptr) {
|
||||
p = _int_memalign(ar_ptr, pagesz, rounded_bytes);
|
||||
(void)mutex_unlock(&ar_ptr->mutex);
|
||||
@@ -4086,7 +4086,7 @@ public_cALLOc(size_t n, size_t elem_size
|
||||
/* ... or sbrk() has failed and there is still a chance to mmap() */
|
||||
mstate prev = av->next ? av : 0;
|
||||
(void)mutex_unlock(&av->mutex);
|
||||
- av = arena_get2(prev, sz);
|
||||
+ av = arena_get2(prev, sz, true);
|
||||
if(av) {
|
||||
mem = _int_malloc(av, sz);
|
||||
(void)mutex_unlock(&av->mutex);
|
||||
119
src/patches/glibc/glibc-rh789238.patch
Normal file
119
src/patches/glibc/glibc-rh789238.patch
Normal file
@@ -0,0 +1,119 @@
|
||||
diff -rup a/malloc/malloc.c b/malloc/malloc.c
|
||||
--- a/malloc/malloc.c 2012-02-13 21:46:11.678847531 -0700
|
||||
+++ b/malloc/malloc.c 2012-02-13 22:43:14.788431976 -0700
|
||||
@@ -3669,8 +3669,9 @@ public_mALLOc(size_t bytes)
|
||||
} else {
|
||||
#if USE_ARENAS
|
||||
/* ... or sbrk() has failed and there is still a chance to mmap() */
|
||||
- ar_ptr = arena_get2(ar_ptr->next ? ar_ptr : 0, bytes);
|
||||
- (void)mutex_unlock(&main_arena.mutex);
|
||||
+ mstate prev = ar_ptr->next ? ar_ptr : 0;
|
||||
+ (void)mutex_unlock(&ar_ptr->mutex);
|
||||
+ ar_ptr = arena_get2(prev, bytes);
|
||||
if(ar_ptr) {
|
||||
victim = _int_malloc(ar_ptr, bytes);
|
||||
(void)mutex_unlock(&ar_ptr->mutex);
|
||||
@@ -3929,10 +3930,10 @@ public_vALLOc(size_t bytes)
|
||||
if(!ar_ptr)
|
||||
return 0;
|
||||
p = _int_valloc(ar_ptr, bytes);
|
||||
- (void)mutex_unlock(&ar_ptr->mutex);
|
||||
if(!p) {
|
||||
/* Maybe the failure is due to running out of mmapped areas. */
|
||||
if(ar_ptr != &main_arena) {
|
||||
+ (void)mutex_unlock(&ar_ptr->mutex);
|
||||
ar_ptr = &main_arena;
|
||||
(void)mutex_lock(&ar_ptr->mutex);
|
||||
p = _int_memalign(ar_ptr, pagesz, bytes);
|
||||
@@ -3940,14 +3941,17 @@ public_vALLOc(size_t bytes)
|
||||
} else {
|
||||
#if USE_ARENAS
|
||||
/* ... or sbrk() has failed and there is still a chance to mmap() */
|
||||
- ar_ptr = arena_get2(ar_ptr->next ? ar_ptr : 0, bytes);
|
||||
+ mstate prev = ar_ptr->next ? ar_ptr : 0;
|
||||
+ (void)mutex_unlock(&ar_ptr->mutex);
|
||||
+ ar_ptr = arena_get2(prev, bytes);
|
||||
if(ar_ptr) {
|
||||
p = _int_memalign(ar_ptr, pagesz, bytes);
|
||||
(void)mutex_unlock(&ar_ptr->mutex);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
- }
|
||||
+ } else
|
||||
+ (void)mutex_unlock(&ar_ptr->mutex);
|
||||
assert(!p || chunk_is_mmapped(mem2chunk(p)) ||
|
||||
ar_ptr == arena_for_chunk(mem2chunk(p)));
|
||||
|
||||
@@ -3975,10 +3979,10 @@ public_pVALLOc(size_t bytes)
|
||||
|
||||
arena_get(ar_ptr, bytes + 2*pagesz + MINSIZE);
|
||||
p = _int_pvalloc(ar_ptr, bytes);
|
||||
- (void)mutex_unlock(&ar_ptr->mutex);
|
||||
if(!p) {
|
||||
/* Maybe the failure is due to running out of mmapped areas. */
|
||||
if(ar_ptr != &main_arena) {
|
||||
+ (void)mutex_unlock(&ar_ptr->mutex);
|
||||
ar_ptr = &main_arena;
|
||||
(void)mutex_lock(&ar_ptr->mutex);
|
||||
p = _int_memalign(ar_ptr, pagesz, rounded_bytes);
|
||||
@@ -3986,15 +3990,17 @@ public_pVALLOc(size_t bytes)
|
||||
} else {
|
||||
#if USE_ARENAS
|
||||
/* ... or sbrk() has failed and there is still a chance to mmap() */
|
||||
- ar_ptr = arena_get2(ar_ptr->next ? ar_ptr : 0,
|
||||
- bytes + 2*pagesz + MINSIZE);
|
||||
+ mstate prev = ar_ptr->next ? ar_ptr : 0;
|
||||
+ (void)mutex_unlock(&ar_ptr->mutex);
|
||||
+ ar_ptr = arena_get2(prev, bytes + 2*pagesz + MINSIZE);
|
||||
if(ar_ptr) {
|
||||
p = _int_memalign(ar_ptr, pagesz, rounded_bytes);
|
||||
(void)mutex_unlock(&ar_ptr->mutex);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
- }
|
||||
+ } else
|
||||
+ (void)mutex_unlock(&ar_ptr->mutex);
|
||||
assert(!p || chunk_is_mmapped(mem2chunk(p)) ||
|
||||
ar_ptr == arena_for_chunk(mem2chunk(p)));
|
||||
|
||||
@@ -4064,8 +4070,6 @@ public_cALLOc(size_t n, size_t elem_size
|
||||
#endif
|
||||
mem = _int_malloc(av, sz);
|
||||
|
||||
- /* Only clearing follows, so we can unlock early. */
|
||||
- (void)mutex_unlock(&av->mutex);
|
||||
|
||||
assert(!mem || chunk_is_mmapped(mem2chunk(mem)) ||
|
||||
av == arena_for_chunk(mem2chunk(mem)));
|
||||
@@ -4073,15 +4077,16 @@ public_cALLOc(size_t n, size_t elem_size
|
||||
if (mem == 0) {
|
||||
/* Maybe the failure is due to running out of mmapped areas. */
|
||||
if(av != &main_arena) {
|
||||
+ (void)mutex_unlock(&av->mutex);
|
||||
(void)mutex_lock(&main_arena.mutex);
|
||||
mem = _int_malloc(&main_arena, sz);
|
||||
(void)mutex_unlock(&main_arena.mutex);
|
||||
} else {
|
||||
#if USE_ARENAS
|
||||
/* ... or sbrk() has failed and there is still a chance to mmap() */
|
||||
- (void)mutex_lock(&main_arena.mutex);
|
||||
- av = arena_get2(av->next ? av : 0, sz);
|
||||
- (void)mutex_unlock(&main_arena.mutex);
|
||||
+ mstate prev = av->next ? av : 0;
|
||||
+ (void)mutex_unlock(&av->mutex);
|
||||
+ av = arena_get2(prev, sz);
|
||||
if(av) {
|
||||
mem = _int_malloc(av, sz);
|
||||
(void)mutex_unlock(&av->mutex);
|
||||
@@ -4089,7 +4094,8 @@ public_cALLOc(size_t n, size_t elem_size
|
||||
#endif
|
||||
}
|
||||
if (mem == 0) return 0;
|
||||
- }
|
||||
+ } else
|
||||
+ (void)mutex_unlock(&av->mutex);
|
||||
p = mem2chunk(mem);
|
||||
|
||||
/* Two optional cases in which clearing not necessary */
|
||||
85
src/patches/glibc/glibc-rh794817-2.patch
Normal file
85
src/patches/glibc/glibc-rh794817-2.patch
Normal file
@@ -0,0 +1,85 @@
|
||||
diff -rup a/stdio-common/vfprintf.c b/stdio-common/vfprintf.c
|
||||
--- a/stdio-common/vfprintf.c 2012-03-05 09:43:14.705536167 -0700
|
||||
+++ b/stdio-common/vfprintf.c 2012-03-05 09:48:11.602890982 -0700
|
||||
@@ -822,7 +822,7 @@ vfprintf (FILE *s, const CHAR_T *format,
|
||||
\
|
||||
if (function_done < 0) \
|
||||
{ \
|
||||
- /* Error in print handler. */ \
|
||||
+ /* Error in print handler; up to handler to set errno. */ \
|
||||
done = -1; \
|
||||
goto all_done; \
|
||||
} \
|
||||
@@ -876,7 +876,7 @@ vfprintf (FILE *s, const CHAR_T *format,
|
||||
\
|
||||
if (function_done < 0) \
|
||||
{ \
|
||||
- /* Error in print handler. */ \
|
||||
+ /* Error in print handler; up to handler to set errno. */ \
|
||||
done = -1; \
|
||||
goto all_done; \
|
||||
} \
|
||||
@@ -1117,7 +1117,7 @@ vfprintf (FILE *s, const CHAR_T *format,
|
||||
&mbstate); \
|
||||
if (len == (size_t) -1) \
|
||||
{ \
|
||||
- /* Something went wron gduring the conversion. Bail out. */ \
|
||||
+ /* Something went wrong during the conversion. Bail out. */ \
|
||||
done = -1; \
|
||||
goto all_done; \
|
||||
} \
|
||||
@@ -1188,6 +1188,7 @@ vfprintf (FILE *s, const CHAR_T *format,
|
||||
if (__mbsnrtowcs (ignore, &str2, strend - str2, \
|
||||
ignore_size, &ps) == (size_t) -1) \
|
||||
{ \
|
||||
+ /* Conversion function has set errno. */ \
|
||||
done = -1; \
|
||||
goto all_done; \
|
||||
} \
|
||||
@@ -1599,6 +1600,7 @@ vfprintf (FILE *s, const CHAR_T *format,
|
||||
if (spec == L_('\0'))
|
||||
{
|
||||
/* The format string ended before the specifier is complete. */
|
||||
+ __set_errno (EINVAL);
|
||||
done = -1;
|
||||
goto all_done;
|
||||
}
|
||||
@@ -1696,17 +1698,20 @@ do_positional:
|
||||
|
||||
/* Determine the number of arguments the format string consumes. */
|
||||
nargs = MAX (nargs, max_ref_arg);
|
||||
+ /* Calculate total size needed to represent a single argument across
|
||||
+ all three argument-related arrays. */
|
||||
bytes_per_arg = sizeof (*args_value) + sizeof (*args_size)
|
||||
+ sizeof (*args_type);
|
||||
|
||||
/* Check for potential integer overflow. */
|
||||
- if (nargs > SIZE_MAX / bytes_per_arg)
|
||||
+ if (__builtin_expect (nargs > SIZE_MAX / bytes_per_arg, 0))
|
||||
{
|
||||
+ __set_errno (ERANGE);
|
||||
done = -1;
|
||||
goto all_done;
|
||||
}
|
||||
|
||||
- /* Allocate memory for the argument descriptions. */
|
||||
+ /* Allocate memory for all three argument arrays. */
|
||||
if (__libc_use_alloca (nargs * bytes_per_arg))
|
||||
args_value = alloca (nargs * bytes_per_arg);
|
||||
else
|
||||
@@ -1937,6 +1942,7 @@ do_positional:
|
||||
about # of chars. */
|
||||
if (function_done < 0)
|
||||
{
|
||||
+ /* Function has set errno. */
|
||||
done = -1;
|
||||
goto all_done;
|
||||
}
|
||||
@@ -1971,6 +1977,7 @@ do_positional:
|
||||
of chars. */
|
||||
if (function_done < 0)
|
||||
{
|
||||
+ /* Function has set errno. */
|
||||
done = -1;
|
||||
goto all_done;
|
||||
}
|
||||
239
src/patches/glibc/glibc-rh794817.patch
Normal file
239
src/patches/glibc/glibc-rh794817.patch
Normal file
@@ -0,0 +1,239 @@
|
||||
From libc-alpha-return-25252-listarch-libc-alpha=sources dot redhat dot com at sourceware dot org Thu Feb 16 16:21:17 2012
|
||||
Return-Path: <libc-alpha-return-25252-listarch-libc-alpha=sources dot redhat dot com at sourceware dot org>
|
||||
Delivered-To: listarch-libc-alpha at sources dot redhat dot com
|
||||
Received: (qmail 5187 invoked by alias); 16 Feb 2012 16:21:14 -0000
|
||||
Delivered-To: moderator for libc-alpha at sourceware dot org
|
||||
Received: (qmail 2174 invoked by uid 22791); 16 Feb 2012 16:17:18 -0000
|
||||
X-SWARE-Spam-Status: No, hits=-2.0 required=5.0
|
||||
tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,SPF_HELO_PASS,TW_TV,TW_VB,TW_VF,T_RP_MATCHES_RCVD
|
||||
X-Spam-Check-By: sourceware.org
|
||||
Date: Thu, 16 Feb 2012 08:16:13 -0800
|
||||
From: Kees Cook <kees at outflux dot net>
|
||||
To: "Ryan S dot Arnold" <ryan dot arnold at gmail dot com>
|
||||
Cc: libc-alpha at sourceware dot org, Paul Eggert <eggert at cs dot ucla dot edu>,
|
||||
Roland McGrath <roland at hack dot frob dot com>,
|
||||
Andreas Schwab <schwab at linux-m68k dot org>
|
||||
Subject: Re: [PATCH] vfprintf: validate nargs and maybe allocate from heap
|
||||
Message-ID: <20120216161613.GZ20420@outflux.net>
|
||||
References: <20120206062537.GM4979@outflux.net>
|
||||
<20120207000509 dot GP4989 at outflux dot net>
|
||||
<20120210192457 dot GF20420 at outflux dot net>
|
||||
<CAAKybw8AgkGsKAx=kvX4Tsi74f+HtuVnatTCB0VfsHi7vVFi1Q at mail dot gmail dot com>
|
||||
<20120214223048 dot GM20420 at outflux dot net>
|
||||
<CAAKybw_HS+cav+YcDw3ns7UXu6_xA7EHPrkiB87P+OGwEB0PVQ at mail dot gmail dot com>
|
||||
<20120214224543 dot GN20420 at outflux dot net>
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=us-ascii
|
||||
Content-Disposition: inline
|
||||
In-Reply-To: <20120214224543 dot GN20420 at outflux dot net>
|
||||
X-MIMEDefang-Filter: outflux$Revision: 1.316 $
|
||||
X-HELO: www.outflux.net
|
||||
Mailing-List: contact libc-alpha-help at sourceware dot org; run by ezmlm
|
||||
Precedence: bulk
|
||||
List-Id: <libc-alpha.sourceware.org>
|
||||
List-Subscribe: <mailto:libc-alpha-subscribe at sourceware dot org>
|
||||
List-Archive: <http://sourceware.org/ml/libc-alpha/>
|
||||
List-Post: <mailto:libc-alpha at sourceware dot org>
|
||||
List-Help: <mailto:libc-alpha-help at sourceware dot org>, <http://sourceware dot org/ml/#faqs>
|
||||
Sender: libc-alpha-owner at sourceware dot org
|
||||
Delivered-To: mailing list libc-alpha at sourceware dot org
|
||||
|
||||
The nargs value can overflow when doing allocations, allowing arbitrary
|
||||
memory writes via format strings, bypassing _FORTIFY_SOURCE:
|
||||
http://www.phrack.org/issues.html?issue=67&id=9
|
||||
|
||||
This checks for nargs overflow and possibly allocates from heap instead of
|
||||
stack, and adds a regression test for the situation.
|
||||
|
||||
I have FSF assignment via Google. (Sent from @outflux since that's how I'm
|
||||
subscribed here, but CL shows @chromium.org as part of my Google work.)
|
||||
|
||||
This version disables the useless test on non-32-bit platforms.
|
||||
|
||||
2012-02-16 Kees Cook <keescook@chromium.org>
|
||||
|
||||
[BZ #13656]
|
||||
* stdio-common/vfprintf.c (vfprintf): Check for nargs overflow and
|
||||
possibly allocate from heap instead of stack.
|
||||
* stdio-common/bug-vfprintf-nargs.c: New file.
|
||||
* stdio-common/Makefile (tests): Add nargs overflow test.
|
||||
|
||||
|
||||
diff -rup a/stdio-common/Makefile b/stdio-common/Makefile
|
||||
--- a/stdio-common/Makefile 2010-05-04 05:27:23.000000000 -0600
|
||||
+++ b/stdio-common/Makefile 2012-02-20 21:57:52.983040992 -0700
|
||||
@@ -60,7 +60,7 @@ tests := tstscanf test_rdwr test-popen t
|
||||
tst-popen tst-unlockedio tst-fmemopen2 tst-put-error tst-fgets \
|
||||
tst-fwrite bug16 bug17 tst-swscanf tst-sprintf2 bug18 bug18a \
|
||||
bug19 bug19a tst-popen2 scanf13 scanf14 scanf15 bug20 bug21 bug22 \
|
||||
- scanf16 scanf17 tst-setvbuf1
|
||||
+ scanf16 scanf17 tst-setvbuf1 bug-vfprintf-nargs
|
||||
|
||||
test-srcs = tst-unbputc tst-printf
|
||||
|
||||
diff --git a/stdio-common/bug-vfprintf-nargs.c b/stdio-common/bug-vfprintf-nargs.c
|
||||
new file mode 100644
|
||||
index 0000000..13c66c0
|
||||
--- /dev/null
|
||||
+++ b/stdio-common/bug-vfprintf-nargs.c
|
||||
@@ -0,0 +1,78 @@
|
||||
+/* Test for vfprintf nargs allocation overflow (BZ #13656).
|
||||
+ Copyright (C) 2012 Free Software Foundation, Inc.
|
||||
+ This file is part of the GNU C Library.
|
||||
+ Contributed by Kees Cook <keescook@chromium.org>, 2012.
|
||||
+
|
||||
+ The GNU C Library is free software; you can redistribute it and/or
|
||||
+ modify it under the terms of the GNU Lesser General Public
|
||||
+ License as published by the Free Software Foundation; either
|
||||
+ version 2.1 of the License, or (at your option) any later version.
|
||||
+
|
||||
+ The GNU C Library is distributed in the hope that it will be useful,
|
||||
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
+ Lesser General Public License for more details.
|
||||
+
|
||||
+ You should have received a copy of the GNU Lesser General Public
|
||||
+ License along with the GNU C Library; if not, write to the Free
|
||||
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
+ 02111-1307 USA. */
|
||||
+
|
||||
+#include <stdio.h>
|
||||
+#include <stdlib.h>
|
||||
+#include <stdint.h>
|
||||
+#include <unistd.h>
|
||||
+#include <inttypes.h>
|
||||
+#include <string.h>
|
||||
+#include <signal.h>
|
||||
+
|
||||
+static int
|
||||
+format_failed (const char *fmt, const char *expected)
|
||||
+{
|
||||
+ char output[80];
|
||||
+
|
||||
+ printf ("%s : ", fmt);
|
||||
+
|
||||
+ memset (output, 0, sizeof output);
|
||||
+ /* Having sprintf itself detect a failure is good. */
|
||||
+ if (sprintf (output, fmt, 1, 2, 3, "test") > 0
|
||||
+ && strcmp (output, expected) != 0)
|
||||
+ {
|
||||
+ printf ("FAIL (output '%s' != expected '%s')\n", output, expected);
|
||||
+ return 1;
|
||||
+ }
|
||||
+ puts ("ok");
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int
|
||||
+do_test (void)
|
||||
+{
|
||||
+ int rc = 0;
|
||||
+ char buf[64];
|
||||
+
|
||||
+ /* Regular positionals work. */
|
||||
+ if (format_failed ("%1$d", "1") != 0)
|
||||
+ rc = 1;
|
||||
+
|
||||
+ /* Regular width positionals work. */
|
||||
+ if (format_failed ("%1$*2$d", " 1") != 0)
|
||||
+ rc = 1;
|
||||
+
|
||||
+ /* Positional arguments are constructed via read_int, so nargs can only
|
||||
+ overflow on 32-bit systems. On 64-bit systems, it will attempt to
|
||||
+ allocate a giant amount of memory and possibly crash, which is the
|
||||
+ expected situation. Since the 64-bit behavior is arch-specific, only
|
||||
+ test this on 32-bit systems. */
|
||||
+ if (sizeof (long int) == 4)
|
||||
+ {
|
||||
+ sprintf (buf, "%%1$d %%%" PRIdPTR "$d", UINT32_MAX / sizeof (int));
|
||||
+ if (format_failed (buf, "1 %$d") != 0)
|
||||
+ rc = 1;
|
||||
+ }
|
||||
+
|
||||
+ return rc;
|
||||
+}
|
||||
+
|
||||
+#define TEST_FUNCTION do_test ()
|
||||
+#include "../test-skeleton.c"
|
||||
diff --git a/stdio-common/vfprintf.c b/stdio-common/vfprintf.c
|
||||
index 863cd5d..022e72b 100644
|
||||
--- a/stdio-common/vfprintf.c
|
||||
+++ b/stdio-common/vfprintf.c
|
||||
@@ -235,6 +235,9 @@ vfprintf (FILE *s, const CHAR_T *format, va_list ap)
|
||||
0 if unknown. */
|
||||
int readonly_format = 0;
|
||||
|
||||
+ /* For the argument descriptions, which may be allocated on the heap. */
|
||||
+ void *args_malloced = NULL;
|
||||
+
|
||||
/* This table maps a character into a number representing a
|
||||
class. In each step there is a destination label for each
|
||||
class. */
|
||||
@@ -1647,9 +1650,10 @@ do_positional:
|
||||
determine the size of the array needed to store the argument
|
||||
attributes. */
|
||||
size_t nargs = 0;
|
||||
- int *args_type;
|
||||
- union printf_arg *args_value = NULL;
|
||||
+ size_t bytes_per_arg;
|
||||
+ union printf_arg *args_value;
|
||||
int *args_size;
|
||||
+ int *args_type;
|
||||
|
||||
/* Positional parameters refer to arguments directly. This could
|
||||
also determine the maximum number of arguments. Track the
|
||||
@@ -1698,13 +1702,33 @@ do_positional:
|
||||
|
||||
/* Determine the number of arguments the format string consumes. */
|
||||
nargs = MAX (nargs, max_ref_arg);
|
||||
+ bytes_per_arg = sizeof (*args_value) + sizeof (*args_size)
|
||||
+ + sizeof (*args_type);
|
||||
+
|
||||
+ /* Check for potential integer overflow. */
|
||||
+ if (nargs > SIZE_MAX / bytes_per_arg)
|
||||
+ {
|
||||
+ done = -1;
|
||||
+ goto all_done;
|
||||
+ }
|
||||
|
||||
/* Allocate memory for the argument descriptions. */
|
||||
- args_type = alloca (nargs * sizeof (int));
|
||||
+ if (__libc_use_alloca (nargs * bytes_per_arg))
|
||||
+ args_value = alloca (nargs * bytes_per_arg);
|
||||
+ else
|
||||
+ {
|
||||
+ args_value = args_malloced = malloc (nargs * bytes_per_arg);
|
||||
+ if (args_value == NULL)
|
||||
+ {
|
||||
+ done = -1;
|
||||
+ goto all_done;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ args_size = &args_value[nargs].pa_int;
|
||||
+ args_type = &args_size[nargs];
|
||||
memset (args_type, s->_flags2 & _IO_FLAGS2_FORTIFY ? '\xff' : '\0',
|
||||
- nargs * sizeof (int));
|
||||
- args_value = alloca (nargs * sizeof (union printf_arg));
|
||||
- args_size = alloca (nargs * sizeof (int));
|
||||
+ nargs * sizeof (*args_type));
|
||||
|
||||
/* XXX Could do sanity check here: If any element in ARGS_TYPE is
|
||||
still zero after this loop, format is invalid. For now we
|
||||
@@ -1973,8 +1997,8 @@ do_positional:
|
||||
}
|
||||
|
||||
all_done:
|
||||
- if (__builtin_expect (workstart != NULL, 0))
|
||||
- free (workstart);
|
||||
+ free (args_malloced);
|
||||
+ free (workstart);
|
||||
/* Unlock the stream. */
|
||||
_IO_funlockfile (s);
|
||||
_IO_cleanup_region_end (0);
|
||||
--
|
||||
1.7.5.4
|
||||
|
||||
--
|
||||
Kees Cook @outflux.net
|
||||
|
||||
13
src/patches/glibc/glibc-rh795498.patch
Normal file
13
src/patches/glibc/glibc-rh795498.patch
Normal file
@@ -0,0 +1,13 @@
|
||||
diff --git a/resolv/nss_dns/dns-host.c b/resolv/nss_dns/dns-host.c
|
||||
index 01369f6..44ad04d 100644
|
||||
--- a/resolv/nss_dns/dns-host.c
|
||||
+++ b/resolv/nss_dns/dns-host.c
|
||||
@@ -1219,7 +1219,7 @@ gaih_getanswer (const querybuf *answer1, int anslen1, const querybuf *answer2,
|
||||
&first);
|
||||
if ((status == NSS_STATUS_SUCCESS || status == NSS_STATUS_NOTFOUND
|
||||
|| (status == NSS_STATUS_TRYAGAIN
|
||||
- && (errno != ERANGE || *h_errnop != NO_RECOVERY)))
|
||||
+ && (*errnop != ERANGE || *h_errnop == NO_RECOVERY)))
|
||||
&& answer2 != NULL && anslen2 > 0)
|
||||
{
|
||||
enum nss_status status2 = gaih_getanswer_slice(answer2, anslen2, qname,
|
||||
657
src/patches/glibc/glibc-rh797094-1.patch
Normal file
657
src/patches/glibc/glibc-rh797094-1.patch
Normal file
@@ -0,0 +1,657 @@
|
||||
diff -rup a/include/alloca.h b/include/alloca.h
|
||||
--- a/include/alloca.h 2012-02-29 13:11:19.439693476 -0700
|
||||
+++ b/include/alloca.h 2012-02-29 13:11:49.832530623 -0700
|
||||
@@ -49,15 +49,24 @@ libc_hidden_proto (__libc_alloca_cutoff)
|
||||
|
||||
#if defined stackinfo_get_sp && defined stackinfo_sub_sp
|
||||
# define alloca_account(size, avar) \
|
||||
- ({ void *old__ = stackinfo_get_sp (); \
|
||||
- void *m__ = __alloca (size); \
|
||||
- avar += stackinfo_sub_sp (old__); \
|
||||
+ ({ void *old__ = stackinfo_get_sp (); \
|
||||
+ void *m__ = __alloca (size); \
|
||||
+ avar += stackinfo_sub_sp (old__); \
|
||||
+ m__; })
|
||||
+# define extend_alloca_account(buf, len, newlen, avar) \
|
||||
+ ({ void *old__ = stackinfo_get_sp (); \
|
||||
+ void *m__ = extend_alloca (buf, len, newlen); \
|
||||
+ avar += stackinfo_sub_sp (old__); \
|
||||
m__; })
|
||||
#else
|
||||
# define alloca_account(size, avar) \
|
||||
- ({ size_t s__ = (size); \
|
||||
- avar += s__; \
|
||||
+ ({ size_t s__ = (size); \
|
||||
+ avar += s__; \
|
||||
__alloca (s__); })
|
||||
+# define extend_alloca_account(buf, len, newlen, avar) \
|
||||
+ ({ size_t s__ = (newlen); \
|
||||
+ avar += s__; \
|
||||
+ extend_alloca (buf, len, s__); })
|
||||
#endif
|
||||
|
||||
#endif
|
||||
diff -rup a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c
|
||||
--- a/sysdeps/posix/getaddrinfo.c 2012-02-29 13:11:19.588692676 -0700
|
||||
+++ b/sysdeps/posix/getaddrinfo.c 2012-02-29 13:12:42.972245862 -0700
|
||||
@@ -278,6 +278,7 @@ gaih_inet (const char *name, const struc
|
||||
bool got_ipv6 = false;
|
||||
const char *canon = NULL;
|
||||
const char *orig_name = name;
|
||||
+ size_t alloca_used = 0;
|
||||
|
||||
if (req->ai_protocol || req->ai_socktype)
|
||||
{
|
||||
@@ -310,7 +311,7 @@ gaih_inet (const char *name, const struc
|
||||
if (tp->name[0])
|
||||
{
|
||||
st = (struct gaih_servtuple *)
|
||||
- __alloca (sizeof (struct gaih_servtuple));
|
||||
+ alloca_account (sizeof (struct gaih_servtuple), alloca_used);
|
||||
|
||||
if ((rc = gaih_inet_serv (service->name, tp, req, st)))
|
||||
return rc;
|
||||
@@ -334,7 +335,8 @@ gaih_inet (const char *name, const struc
|
||||
continue;
|
||||
|
||||
newp = (struct gaih_servtuple *)
|
||||
- __alloca (sizeof (struct gaih_servtuple));
|
||||
+ alloca_account (sizeof (struct gaih_servtuple),
|
||||
+ alloca_used);
|
||||
|
||||
if ((rc = gaih_inet_serv (service->name, tp, req, newp)))
|
||||
{
|
||||
@@ -362,7 +364,7 @@ gaih_inet (const char *name, const struc
|
||||
|
||||
if (req->ai_socktype || req->ai_protocol)
|
||||
{
|
||||
- st = __alloca (sizeof (struct gaih_servtuple));
|
||||
+ st = alloca_account (sizeof (struct gaih_servtuple), alloca_used);
|
||||
st->next = NULL;
|
||||
st->socktype = tp->socktype;
|
||||
st->protocol = ((tp->protoflag & GAI_PROTO_PROTOANY)
|
||||
@@ -379,7 +381,8 @@ gaih_inet (const char *name, const struc
|
||||
{
|
||||
struct gaih_servtuple *newp;
|
||||
|
||||
- newp = __alloca (sizeof (struct gaih_servtuple));
|
||||
+ newp = alloca_account (sizeof (struct gaih_servtuple),
|
||||
+ alloca_used);
|
||||
newp->next = NULL;
|
||||
newp->socktype = tp->socktype;
|
||||
newp->protocol = tp->protocol;
|
||||
@@ -391,10 +394,17 @@ gaih_inet (const char *name, const struc
|
||||
}
|
||||
}
|
||||
|
||||
+ bool malloc_name = false;
|
||||
+ bool malloc_addrmem = false;
|
||||
+ struct gaih_addrtuple *addrmem = NULL;
|
||||
+ bool malloc_canonbuf = false;
|
||||
+ char *canonbuf = NULL;
|
||||
+ bool malloc_tmpbuf = false;
|
||||
+ char *tmpbuf = NULL;
|
||||
+ int result = 0;
|
||||
if (name != NULL)
|
||||
{
|
||||
- at = __alloca (sizeof (struct gaih_addrtuple));
|
||||
-
|
||||
+ at = alloca_account (sizeof (struct gaih_addrtuple), alloca_used);
|
||||
at->family = AF_UNSPEC;
|
||||
at->scopeid = 0;
|
||||
at->next = NULL;
|
||||
@@ -412,6 +422,7 @@ gaih_inet (const char *name, const struc
|
||||
rc = __idna_to_ascii_lz (name, &p, idn_flags);
|
||||
if (rc != IDNA_SUCCESS)
|
||||
{
|
||||
+ /* No need to jump to free_and_return here. */
|
||||
if (rc == IDNA_MALLOC_ERROR)
|
||||
return -EAI_MEMORY;
|
||||
if (rc == IDNA_DLOPEN_ERROR)
|
||||
@@ -421,10 +432,7 @@ gaih_inet (const char *name, const struc
|
||||
/* In case the output string is the same as the input string
|
||||
no new string has been allocated. */
|
||||
if (p != name)
|
||||
- {
|
||||
- name = strdupa (p);
|
||||
- free (p);
|
||||
- }
|
||||
+ malloc_name = true;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -441,23 +449,59 @@ gaih_inet (const char *name, const struc
|
||||
at->family = AF_INET6;
|
||||
}
|
||||
else
|
||||
- return -EAI_ADDRFAMILY;
|
||||
+ {
|
||||
+ result = -EAI_ADDRFAMILY;
|
||||
+ goto free_and_return;
|
||||
+ }
|
||||
|
||||
if (req->ai_flags & AI_CANONNAME)
|
||||
canon = name;
|
||||
}
|
||||
else if (at->family == AF_UNSPEC)
|
||||
{
|
||||
- char *namebuf = (char *) name;
|
||||
char *scope_delim = strchr (name, SCOPE_DELIMITER);
|
||||
+ int e;
|
||||
|
||||
- if (__builtin_expect (scope_delim != NULL, 0))
|
||||
- {
|
||||
- namebuf = alloca (scope_delim - name + 1);
|
||||
- *((char *) __mempcpy (namebuf, name, scope_delim - name)) = '\0';
|
||||
- }
|
||||
+ {
|
||||
+ bool malloc_namebuf = false;
|
||||
+ char *namebuf = (char *) name;
|
||||
+
|
||||
+ if (__builtin_expect (scope_delim != NULL, 0))
|
||||
+ {
|
||||
+ if (malloc_name)
|
||||
+ *scope_delim = '\0';
|
||||
+ else
|
||||
+ {
|
||||
+ if (__libc_use_alloca (alloca_used
|
||||
+ + scope_delim - name + 1))
|
||||
+ {
|
||||
+ namebuf = alloca_account (scope_delim - name + 1,
|
||||
+ alloca_used);
|
||||
+ *((char *) __mempcpy (namebuf, name,
|
||||
+ scope_delim - name)) = '\0';
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ namebuf = strndup (name, scope_delim - name);
|
||||
+ if (namebuf == NULL)
|
||||
+ {
|
||||
+ assert (!malloc_name);
|
||||
+ return -EAI_MEMORY;
|
||||
+ }
|
||||
+ malloc_namebuf = true;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
|
||||
- if (inet_pton (AF_INET6, namebuf, at->addr) > 0)
|
||||
+ e = inet_pton (AF_INET6, namebuf, at->addr);
|
||||
+
|
||||
+ if (malloc_namebuf)
|
||||
+ free (namebuf);
|
||||
+ else if (scope_delim != NULL && malloc_name)
|
||||
+ /* Undo what we did above. */
|
||||
+ *scope_delim = SCOPE_DELIMITER;
|
||||
+ }
|
||||
+ if (e > 0)
|
||||
{
|
||||
if (req->ai_family == AF_UNSPEC || req->ai_family == AF_INET6)
|
||||
at->family = AF_INET6;
|
||||
@@ -468,7 +512,10 @@ gaih_inet (const char *name, const struc
|
||||
at->family = AF_INET;
|
||||
}
|
||||
else
|
||||
- return -EAI_ADDRFAMILY;
|
||||
+ {
|
||||
+ result = -EAI_ADDRFAMILY;
|
||||
+ goto free_and_return;
|
||||
+ }
|
||||
|
||||
if (scope_delim != NULL)
|
||||
{
|
||||
@@ -490,7 +537,10 @@ gaih_inet (const char *name, const struc
|
||||
at->scopeid = (uint32_t) strtoul (scope_delim + 1, &end,
|
||||
10);
|
||||
if (*end != '\0')
|
||||
- return GAIH_OKIFUNSPEC | -EAI_NONAME;
|
||||
+ {
|
||||
+ result = GAIH_OKIFUNSPEC | -EAI_NONAME;
|
||||
+ goto free_and_return;
|
||||
+ }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -520,59 +570,80 @@ gaih_inet (const char *name, const struc
|
||||
{
|
||||
int family = req->ai_family;
|
||||
size_t tmpbuflen = 512;
|
||||
- char *tmpbuf = alloca (tmpbuflen);
|
||||
+ assert (tmpbuf == NULL);
|
||||
+ tmpbuf = alloca_account (tmpbuflen, alloca_used);
|
||||
int rc;
|
||||
struct hostent th;
|
||||
struct hostent *h;
|
||||
int herrno;
|
||||
|
||||
- simple_again:
|
||||
while (1)
|
||||
{
|
||||
- rc = __gethostbyname2_r (name, family, &th, tmpbuf,
|
||||
+ rc = __gethostbyname2_r (name, AF_INET, &th, tmpbuf,
|
||||
tmpbuflen, &h, &herrno);
|
||||
if (rc != ERANGE || herrno != NETDB_INTERNAL)
|
||||
break;
|
||||
- tmpbuf = extend_alloca (tmpbuf, tmpbuflen, 2 * tmpbuflen);
|
||||
+
|
||||
+ if (!malloc_tmpbuf
|
||||
+ && __libc_use_alloca (alloca_used + 2 * tmpbuflen))
|
||||
+ tmpbuf = extend_alloca_account (tmpbuf, tmpbuflen,
|
||||
+ 2 * tmpbuflen,
|
||||
+ alloca_used);
|
||||
+ else
|
||||
+ {
|
||||
+ char *newp = realloc (malloc_tmpbuf ? tmpbuf : NULL,
|
||||
+ 2 * tmpbuflen);
|
||||
+ if (newp == NULL)
|
||||
+ {
|
||||
+ result = -EAI_MEMORY;
|
||||
+ goto free_and_return;
|
||||
+ }
|
||||
+ tmpbuf = newp;
|
||||
+ malloc_tmpbuf = true;
|
||||
+ tmpbuflen = 2 * tmpbuflen;
|
||||
+ }
|
||||
}
|
||||
|
||||
if (rc == 0)
|
||||
{
|
||||
- if (h == NULL)
|
||||
+ if (h != NULL)
|
||||
{
|
||||
- if (req->ai_family == AF_INET6
|
||||
- && (req->ai_flags & AI_V4MAPPED)
|
||||
- && family == AF_INET6)
|
||||
+ int i;
|
||||
+ /* We found data, count the number of addresses. */
|
||||
+ for (i = 0; h->h_addr_list[i]; ++i)
|
||||
+ ;
|
||||
+ if (i > 0 && *pat != NULL)
|
||||
+ --i;
|
||||
+
|
||||
+ if (__libc_use_alloca (alloca_used
|
||||
+ + i * sizeof (struct gaih_addrtuple)))
|
||||
+ addrmem = alloca_account (i * sizeof (struct gaih_addrtuple),
|
||||
+ alloca_used);
|
||||
+ else
|
||||
{
|
||||
- /* Try again, this time looking for IPv4
|
||||
- addresses. */
|
||||
- family = AF_INET;
|
||||
- goto simple_again;
|
||||
+ addrmem = malloc (i
|
||||
+ * sizeof (struct gaih_addrtuple));
|
||||
+ if (addrmem == NULL)
|
||||
+ {
|
||||
+ result = -EAI_MEMORY;
|
||||
+ goto free_and_return;
|
||||
}
|
||||
+ malloc_addrmem = true;
|
||||
}
|
||||
- else
|
||||
- {
|
||||
- /* We found data, now convert it into the list. */
|
||||
- for (int i = 0; h->h_addr_list[i]; ++i)
|
||||
+
|
||||
+ /* Now convert it into the list. */
|
||||
+ struct gaih_addrtuple *addrfree = addrmem;
|
||||
+ for (i = 0; h->h_addr_list[i]; ++i)
|
||||
{
|
||||
if (*pat == NULL)
|
||||
{
|
||||
- *pat = __alloca (sizeof (struct gaih_addrtuple));
|
||||
+ *pat = addrfree++;
|
||||
(*pat)->scopeid = 0;
|
||||
}
|
||||
(*pat)->next = NULL;
|
||||
- (*pat)->family = req->ai_family;
|
||||
- if (family == req->ai_family)
|
||||
+ (*pat)->family = AF_INET;
|
||||
memcpy ((*pat)->addr, h->h_addr_list[i],
|
||||
h->h_length);
|
||||
- else
|
||||
- {
|
||||
- uint32_t *addr = (uint32_t *) (*pat)->addr;
|
||||
- addr[3] = *(uint32_t *) h->h_addr_list[i];
|
||||
- addr[2] = htonl (0xffff);
|
||||
- addr[1] = 0;
|
||||
- addr[0] = 0;
|
||||
- }
|
||||
pat = &((*pat)->next);
|
||||
}
|
||||
}
|
||||
@@ -582,15 +653,16 @@ gaih_inet (const char *name, const struc
|
||||
if (herrno == NETDB_INTERNAL)
|
||||
{
|
||||
__set_h_errno (herrno);
|
||||
- return -EAI_SYSTEM;
|
||||
- }
|
||||
- if (herrno == TRY_AGAIN)
|
||||
- {
|
||||
- return -EAI_AGAIN;
|
||||
+ result = -EAI_SYSTEM;
|
||||
}
|
||||
+ else if (herrno == TRY_AGAIN)
|
||||
+ result = -EAI_AGAIN;
|
||||
+ else
|
||||
/* We made requests but they turned out no data.
|
||||
The name is known, though. */
|
||||
- return GAIH_OKIFUNSPEC | -EAI_NODATA;
|
||||
+ result = GAIH_OKIFUNSPEC | -EAI_NODATA;
|
||||
+
|
||||
+ goto free_and_return;
|
||||
}
|
||||
|
||||
goto process_list;
|
||||
@@ -613,21 +685,56 @@ gaih_inet (const char *name, const struc
|
||||
bool added_canon = (req->ai_flags & AI_CANONNAME) == 0;
|
||||
char *addrs = air->addrs;
|
||||
|
||||
+ if (__libc_use_alloca (alloca_used
|
||||
+ + air->naddrs * sizeof (struct gaih_addrtuple)))
|
||||
+ addrmem = alloca_account (air->naddrs
|
||||
+ * sizeof (struct gaih_addrtuple),
|
||||
+ alloca_used);
|
||||
+ else
|
||||
+ {
|
||||
+ addrmem = malloc (air->naddrs
|
||||
+ * sizeof (struct gaih_addrtuple));
|
||||
+ if (addrmem == NULL)
|
||||
+ {
|
||||
+ result = -EAI_MEMORY;
|
||||
+ goto free_and_return;
|
||||
+ }
|
||||
+ malloc_addrmem = true;
|
||||
+ }
|
||||
+
|
||||
+ struct gaih_addrtuple *addrfree = addrmem;
|
||||
for (int i = 0; i < air->naddrs; ++i)
|
||||
{
|
||||
socklen_t size = (air->family[i] == AF_INET
|
||||
? INADDRSZ : IN6ADDRSZ);
|
||||
if (*pat == NULL)
|
||||
{
|
||||
- *pat = __alloca (sizeof (struct gaih_addrtuple));
|
||||
+ *pat = addrfree++;
|
||||
(*pat)->scopeid = 0;
|
||||
}
|
||||
uint32_t *pataddr = (*pat)->addr;
|
||||
(*pat)->next = NULL;
|
||||
if (added_canon || air->canon == NULL)
|
||||
(*pat)->name = NULL;
|
||||
- else
|
||||
- canon = (*pat)->name = strdupa (air->canon);
|
||||
+ else if (canonbuf == NULL)
|
||||
+ {
|
||||
+ size_t canonlen = strlen (air->canon) + 1;
|
||||
+ if ((req->ai_flags & AI_CANONIDN) != 0
|
||||
+ && __libc_use_alloca (alloca_used + canonlen))
|
||||
+ canonbuf = alloca_account (canonlen, alloca_used);
|
||||
+ else
|
||||
+ {
|
||||
+ canonbuf = malloc (canonlen);
|
||||
+ if (canonbuf == NULL)
|
||||
+ {
|
||||
+ result = -EAI_MEMORY;
|
||||
+ goto free_and_return;
|
||||
+ }
|
||||
+ malloc_canonbuf = true;
|
||||
+ }
|
||||
+ canon = (*pat)->name = memcpy (canonbuf, air->canon,
|
||||
+ canonlen);
|
||||
+ }
|
||||
|
||||
if (air->family[i] == AF_INET
|
||||
&& req->ai_family == AF_INET6
|
||||
@@ -657,20 +764,26 @@ gaih_inet (const char *name, const struc
|
||||
free (air);
|
||||
|
||||
if (at->family == AF_UNSPEC)
|
||||
- return GAIH_OKIFUNSPEC | -EAI_NONAME;
|
||||
+ {
|
||||
+ result = GAIH_OKIFUNSPEC | -EAI_NONAME;
|
||||
+ goto free_and_return;
|
||||
+ }
|
||||
|
||||
goto process_list;
|
||||
}
|
||||
else if (err == 0)
|
||||
/* The database contains a negative entry. */
|
||||
- return 0;
|
||||
+ goto free_and_return;
|
||||
else if (__nss_not_use_nscd_hosts == 0)
|
||||
{
|
||||
if (herrno == NETDB_INTERNAL && errno == ENOMEM)
|
||||
- return -EAI_MEMORY;
|
||||
- if (herrno == TRY_AGAIN)
|
||||
- return -EAI_AGAIN;
|
||||
- return -EAI_SYSTEM;
|
||||
+ result = -EAI_MEMORY;
|
||||
+ else if (herrno == TRY_AGAIN)
|
||||
+ result = -EAI_AGAIN;
|
||||
+ else
|
||||
+ result = -EAI_SYSTEM;
|
||||
+
|
||||
+ goto free_and_return;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -699,7 +812,19 @@ gaih_inet (const char *name, const struc
|
||||
_res.options &= ~RES_USE_INET6;
|
||||
|
||||
size_t tmpbuflen = 1024;
|
||||
- char *tmpbuf = alloca (tmpbuflen);
|
||||
+ malloc_tmpbuf = !__libc_use_alloca (alloca_used + tmpbuflen);
|
||||
+ assert (tmpbuf == NULL);
|
||||
+ if (!malloc_tmpbuf)
|
||||
+ tmpbuf = alloca_account (tmpbuflen, alloca_used);
|
||||
+ else
|
||||
+ {
|
||||
+ tmpbuf = malloc (tmpbuflen);
|
||||
+ if (tmpbuf == NULL)
|
||||
+ {
|
||||
+ result = -EAI_MEMORY;
|
||||
+ goto free_and_return;
|
||||
+ }
|
||||
+ }
|
||||
|
||||
while (!no_more)
|
||||
{
|
||||
@@ -728,8 +853,25 @@ gaih_inet (const char *name, const struc
|
||||
no_data = herrno == NO_DATA;
|
||||
break;
|
||||
}
|
||||
- tmpbuf = extend_alloca (tmpbuf,
|
||||
- tmpbuflen, 2 * tmpbuflen);
|
||||
+
|
||||
+ if (!malloc_tmpbuf
|
||||
+ && __libc_use_alloca (alloca_used + 2 * tmpbuflen))
|
||||
+ tmpbuf = extend_alloca_account (tmpbuf, tmpbuflen,
|
||||
+ 2 * tmpbuflen,
|
||||
+ alloca_used);
|
||||
+ else
|
||||
+ {
|
||||
+ char *newp = realloc (malloc_tmpbuf ? tmpbuf : NULL,
|
||||
+ 2 * tmpbuflen);
|
||||
+ if (newp == NULL)
|
||||
+ {
|
||||
+ result = -EAI_MEMORY;
|
||||
+ goto free_and_return;
|
||||
+ }
|
||||
+ tmpbuf = newp;
|
||||
+ malloc_tmpbuf = true;
|
||||
+ tmpbuflen = 2 * tmpbuflen;
|
||||
+ }
|
||||
}
|
||||
|
||||
if (status == NSS_STATUS_SUCCESS)
|
||||
@@ -832,18 +974,40 @@ gaih_inet (const char *name, const struc
|
||||
if (cfct != NULL)
|
||||
{
|
||||
const size_t max_fqdn_len = 256;
|
||||
- char *buf = alloca (max_fqdn_len);
|
||||
+ if ((req->ai_flags & AI_CANONIDN) != 0
|
||||
+ && __libc_use_alloca (alloca_used
|
||||
+ + max_fqdn_len))
|
||||
+ canonbuf = alloca_account (max_fqdn_len,
|
||||
+ alloca_used);
|
||||
+ else
|
||||
+ {
|
||||
+ canonbuf = malloc (max_fqdn_len);
|
||||
+ if (canonbuf == NULL)
|
||||
+ {
|
||||
+ result = -EAI_MEMORY;
|
||||
+ goto free_and_return;
|
||||
+ }
|
||||
+ malloc_canonbuf = true;
|
||||
+ }
|
||||
char *s;
|
||||
|
||||
if (DL_CALL_FCT (cfct, (at->name ?: name,
|
||||
- buf, max_fqdn_len,
|
||||
+ canonbuf,
|
||||
+ max_fqdn_len,
|
||||
&s, &rc, &herrno))
|
||||
== NSS_STATUS_SUCCESS)
|
||||
canon = s;
|
||||
else
|
||||
- /* Set to name now to avoid using
|
||||
- gethostbyaddr. */
|
||||
- canon = name;
|
||||
+ {
|
||||
+ /* Set to name now to avoid using
|
||||
+ gethostbyaddr. */
|
||||
+ if (malloc_canonbuf)
|
||||
+ {
|
||||
+ free (canonbuf);
|
||||
+ malloc_canonbuf = false;
|
||||
+ }
|
||||
+ canon = name;
|
||||
+ }
|
||||
}
|
||||
}
|
||||
status = NSS_STATUS_SUCCESS;
|
||||
@@ -878,22 +1042,27 @@ gaih_inet (const char *name, const struc
|
||||
{
|
||||
/* If both requests timed out report this. */
|
||||
if (no_data == EAI_AGAIN && no_inet6_data == EAI_AGAIN)
|
||||
- return -EAI_AGAIN;
|
||||
+ result = -EAI_AGAIN;
|
||||
+ else
|
||||
+ /* We made requests but they turned out no data. The name
|
||||
+ is known, though. */
|
||||
+ result = GAIH_OKIFUNSPEC | -EAI_NODATA;
|
||||
|
||||
- /* We made requests but they turned out no data. The name
|
||||
- is known, though. */
|
||||
- return GAIH_OKIFUNSPEC | -EAI_NODATA;
|
||||
+ goto free_and_return;
|
||||
}
|
||||
}
|
||||
|
||||
process_list:
|
||||
if (at->family == AF_UNSPEC)
|
||||
- return GAIH_OKIFUNSPEC | -EAI_NONAME;
|
||||
+ {
|
||||
+ result = GAIH_OKIFUNSPEC | -EAI_NONAME;
|
||||
+ goto free_and_return;
|
||||
+ }
|
||||
}
|
||||
else
|
||||
{
|
||||
struct gaih_addrtuple *atr;
|
||||
- atr = at = __alloca (sizeof (struct gaih_addrtuple));
|
||||
+ atr = at = alloca_account (sizeof (struct gaih_addrtuple), alloca_used);
|
||||
memset (at, '\0', sizeof (struct gaih_addrtuple));
|
||||
|
||||
if (req->ai_family == AF_UNSPEC)
|
||||
@@ -932,6 +1101,9 @@ gaih_inet (const char *name, const struc
|
||||
/* Only the first entry gets the canonical name. */
|
||||
if (at2 == at && (req->ai_flags & AI_CANONNAME) != 0)
|
||||
{
|
||||
+ char *tmpbuf2 = NULL;
|
||||
+ bool malloc_tmpbuf2 = false;
|
||||
+
|
||||
if (canon == NULL)
|
||||
{
|
||||
/* If the canonical name cannot be determined, use
|
||||
@@ -952,11 +1124,16 @@ gaih_inet (const char *name, const struc
|
||||
int rc = __idna_to_unicode_lzlz (canon, &out, idn_flags);
|
||||
if (rc != IDNA_SUCCESS)
|
||||
{
|
||||
+ if (malloc_tmpbuf2)
|
||||
+ free (tmpbuf2);
|
||||
+
|
||||
if (rc == IDNA_MALLOC_ERROR)
|
||||
- return -EAI_MEMORY;
|
||||
- if (rc == IDNA_DLOPEN_ERROR)
|
||||
- return -EAI_SYSTEM;
|
||||
- return -EAI_IDN_ENCODE;
|
||||
+ result = -EAI_MEMORY;
|
||||
+ else if (rc == IDNA_DLOPEN_ERROR)
|
||||
+ result = -EAI_SYSTEM;
|
||||
+ else
|
||||
+ result = -EAI_IDN_ENCODE;
|
||||
+ goto free_and_return;
|
||||
}
|
||||
/* In case the output string is the same as the input
|
||||
string no new string has been allocated and we
|
||||
@@ -970,10 +1147,25 @@ gaih_inet (const char *name, const struc
|
||||
#ifdef HAVE_LIBIDN
|
||||
make_copy:
|
||||
#endif
|
||||
- canon = strdup (canon);
|
||||
- if (canon == NULL)
|
||||
- return -EAI_MEMORY;
|
||||
+ if (malloc_canonbuf)
|
||||
+ /* We already allocated the string using malloc. */
|
||||
+ malloc_canonbuf = false;
|
||||
+ else
|
||||
+ {
|
||||
+ canon = strdup (canon);
|
||||
+ if (canon == NULL)
|
||||
+ {
|
||||
+ if (malloc_tmpbuf2)
|
||||
+ free (tmpbuf2);
|
||||
+
|
||||
+ result = -EAI_MEMORY;
|
||||
+ goto free_and_return;
|
||||
+ }
|
||||
+ }
|
||||
}
|
||||
+
|
||||
+ if (malloc_tmpbuf2)
|
||||
+ free (tmpbuf2);
|
||||
}
|
||||
|
||||
family = at2->family;
|
||||
@@ -999,7 +1191,8 @@ gaih_inet (const char *name, const struc
|
||||
if (ai == NULL)
|
||||
{
|
||||
free ((char *) canon);
|
||||
- return -EAI_MEMORY;
|
||||
+ result = -EAI_MEMORY;
|
||||
+ goto free_and_return;
|
||||
}
|
||||
|
||||
ai->ai_flags = req->ai_flags;
|
||||
@@ -1052,7 +1245,18 @@ gaih_inet (const char *name, const struc
|
||||
at2 = at2->next;
|
||||
}
|
||||
}
|
||||
- return 0;
|
||||
+
|
||||
+ free_and_return:
|
||||
+ if (malloc_name)
|
||||
+ free ((char *) name);
|
||||
+ if (malloc_addrmem)
|
||||
+ free (addrmem);
|
||||
+ if (malloc_canonbuf)
|
||||
+ free (canonbuf);
|
||||
+ if (malloc_tmpbuf)
|
||||
+ free (tmpbuf);
|
||||
+
|
||||
+ return result;
|
||||
}
|
||||
|
||||
|
||||
862
src/patches/glibc/glibc-rh797094-2.patch
Normal file
862
src/patches/glibc/glibc-rh797094-2.patch
Normal file
@@ -0,0 +1,862 @@
|
||||
From: Ulrich Drepper <drepper@gmail.com>
|
||||
Date: Mon, 23 May 2011 03:04:16 +0000 (-0400)
|
||||
Subject: Add a few more alloca size checks
|
||||
X-Git-Tag: glibc-2.14~41
|
||||
X-Git-Url: http://sourceware.org/git/?p=glibc.git;a=commitdiff_plain;h=f2962a71959fd254a7a223437ca4b63b9e81130c
|
||||
|
||||
Add a few more alloca size checks
|
||||
---
|
||||
|
||||
2011-05-22 Ulrich Drepper <drepper@gmail.com>
|
||||
|
||||
[BZ #12671]
|
||||
* nis/nss_nis/nis-alias.c (_nss_nis_getaliasbyname_r): Use malloc in
|
||||
some situations.
|
||||
* nscd/nscd_getserv_r.c (nscd_getserv_r): Likewise.
|
||||
* posix/glob.c (glob_in_dir): Take additional parameter alloca_used.
|
||||
add in in __libc_use_alloca calls. Adjust callers.
|
||||
(glob): Use malloc in some situations.
|
||||
diff --git a/nis/nss_nis/nis-alias.c b/nis/nss_nis/nis-alias.c
|
||||
index 9286e36..cfe4097 100644
|
||||
--- a/nis/nss_nis/nis-alias.c
|
||||
+++ b/nis/nss_nis/nis-alias.c
|
||||
@@ -1,4 +1,4 @@
|
||||
-/* Copyright (C) 1996-2002, 2003, 2006 Free Software Foundation, Inc.
|
||||
+/* Copyright (C) 1996-2002, 2003, 2006, 2011 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1996.
|
||||
|
||||
@@ -142,10 +142,10 @@ internal_nis_getaliasent_r (struct aliasent *alias, char *buffer,
|
||||
int yperr;
|
||||
|
||||
if (new_start)
|
||||
- yperr = yp_first (domain, "mail.aliases", &outkey, &keylen, &result,
|
||||
+ yperr = yp_first (domain, "mail.aliases", &outkey, &keylen, &result,
|
||||
&len);
|
||||
else
|
||||
- yperr = yp_next (domain, "mail.aliases", oldkey, oldkeylen, &outkey,
|
||||
+ yperr = yp_next (domain, "mail.aliases", oldkey, oldkeylen, &outkey,
|
||||
&keylen, &result, &len);
|
||||
|
||||
if (__builtin_expect (yperr != YPERR_SUCCESS, 0))
|
||||
@@ -153,20 +153,20 @@ internal_nis_getaliasent_r (struct aliasent *alias, char *buffer,
|
||||
enum nss_status retval = yperr2nss (yperr);
|
||||
|
||||
if (retval == NSS_STATUS_TRYAGAIN)
|
||||
- *errnop = errno;
|
||||
- return retval;
|
||||
- }
|
||||
+ *errnop = errno;
|
||||
+ return retval;
|
||||
+ }
|
||||
|
||||
if (__builtin_expect ((size_t) (len + 1) > buflen, 0))
|
||||
- {
|
||||
+ {
|
||||
free (result);
|
||||
- *errnop = ERANGE;
|
||||
- return NSS_STATUS_TRYAGAIN;
|
||||
- }
|
||||
+ *errnop = ERANGE;
|
||||
+ return NSS_STATUS_TRYAGAIN;
|
||||
+ }
|
||||
char *p = strncpy (buffer, result, len);
|
||||
buffer[len] = '\0';
|
||||
while (isspace (*p))
|
||||
- ++p;
|
||||
+ ++p;
|
||||
free (result);
|
||||
|
||||
parse_res = _nss_nis_parse_aliasent (outkey, p, alias, buffer,
|
||||
@@ -213,13 +213,25 @@ _nss_nis_getaliasbyname_r (const char *name, struct aliasent *alias,
|
||||
return NSS_STATUS_UNAVAIL;
|
||||
}
|
||||
|
||||
- size_t namlen = strlen (name);
|
||||
- char name2[namlen + 1];
|
||||
-
|
||||
char *domain;
|
||||
if (__builtin_expect (yp_get_default_domain (&domain), 0))
|
||||
return NSS_STATUS_UNAVAIL;
|
||||
|
||||
+ size_t namlen = strlen (name);
|
||||
+ char *name2;
|
||||
+ int use_alloca = __libc_use_alloca (namlen + 1);
|
||||
+ if (use_alloca)
|
||||
+ name2 = __alloca (namlen + 1);
|
||||
+ else
|
||||
+ {
|
||||
+ name2 = malloc (namlen + 1);
|
||||
+ if (name2 == NULL)
|
||||
+ {
|
||||
+ *errnop = ENOMEM;
|
||||
+ return NSS_STATUS_TRYAGAIN;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
/* Convert name to lowercase. */
|
||||
size_t i;
|
||||
for (i = 0; i < namlen; ++i)
|
||||
@@ -230,6 +242,9 @@ _nss_nis_getaliasbyname_r (const char *name, struct aliasent *alias,
|
||||
int len;
|
||||
int yperr = yp_match (domain, "mail.aliases", name2, namlen, &result, &len);
|
||||
|
||||
+ if (!use_alloca)
|
||||
+ free (name2);
|
||||
+
|
||||
if (__builtin_expect (yperr != YPERR_SUCCESS, 0))
|
||||
{
|
||||
enum nss_status retval = yperr2nss (yperr);
|
||||
diff --git a/nscd/nscd_getserv_r.c b/nscd/nscd_getserv_r.c
|
||||
index dce4165..de96a57 100644
|
||||
--- a/nscd/nscd_getserv_r.c
|
||||
+++ b/nscd/nscd_getserv_r.c
|
||||
@@ -1,4 +1,4 @@
|
||||
-/* Copyright (C) 2007, 2009 Free Software Foundation, Inc.
|
||||
+/* Copyright (C) 2007, 2009, 2011 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@redhat.com>, 2007.
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA. */
|
||||
|
||||
+#include <assert.h>
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#include <not-cancel.h>
|
||||
@@ -80,6 +81,7 @@ nscd_getserv_r (const char *crit, size_t critlen, const char *proto,
|
||||
{
|
||||
int gc_cycle;
|
||||
int nretries = 0;
|
||||
+ size_t alloca_used = 0;
|
||||
|
||||
/* If the mapping is available, try to search there instead of
|
||||
communicating with the nscd. */
|
||||
@@ -88,13 +90,23 @@ nscd_getserv_r (const char *crit, size_t critlen, const char *proto,
|
||||
&gc_cycle);
|
||||
size_t protolen = proto == NULL ? 0 : strlen (proto);
|
||||
size_t keylen = critlen + 1 + protolen + 1;
|
||||
- char *key = alloca (keylen);
|
||||
+ int alloca_key = __libc_use_alloca (keylen);
|
||||
+ char *key;
|
||||
+ if (alloca_key)
|
||||
+ key = alloca_account (keylen, alloca_used);
|
||||
+ else
|
||||
+ {
|
||||
+ key = malloc (keylen);
|
||||
+ if (key == NULL)
|
||||
+ return -1;
|
||||
+ }
|
||||
memcpy (__mempcpy (__mempcpy (key, crit, critlen),
|
||||
"/", 1), proto ?: "", protolen + 1);
|
||||
|
||||
retry:;
|
||||
const char *s_name = NULL;
|
||||
const char *s_proto = NULL;
|
||||
+ int alloca_aliases_len = 0;
|
||||
const uint32_t *aliases_len = NULL;
|
||||
const char *aliases_list = NULL;
|
||||
int retval = -1;
|
||||
@@ -136,8 +148,22 @@ nscd_getserv_r (const char *crit, size_t critlen, const char *proto,
|
||||
if (((uintptr_t) aliases_len & (__alignof__ (*aliases_len) - 1))
|
||||
!= 0)
|
||||
{
|
||||
- uint32_t *tmp = alloca (serv_resp.s_aliases_cnt
|
||||
- * sizeof (uint32_t));
|
||||
+ uint32_t *tmp;
|
||||
+ alloca_aliases_len
|
||||
+ = __libc_use_alloca (alloca_used
|
||||
+ + (serv_resp.s_aliases_cnt
|
||||
+ * sizeof (uint32_t)));
|
||||
+ if (alloca_aliases_len)
|
||||
+ tmp = __alloca (serv_resp.s_aliases_cnt * sizeof (uint32_t));
|
||||
+ else
|
||||
+ {
|
||||
+ tmp = malloc (serv_resp.s_aliases_cnt * sizeof (uint32_t));
|
||||
+ if (tmp == NULL)
|
||||
+ {
|
||||
+ retval = ENOMEM;
|
||||
+ goto out;
|
||||
+ }
|
||||
+ }
|
||||
aliases_len = memcpy (tmp, aliases_len,
|
||||
serv_resp.s_aliases_cnt
|
||||
* sizeof (uint32_t));
|
||||
@@ -217,8 +243,24 @@ nscd_getserv_r (const char *crit, size_t critlen, const char *proto,
|
||||
|
||||
if (serv_resp.s_aliases_cnt > 0)
|
||||
{
|
||||
- aliases_len = alloca (serv_resp.s_aliases_cnt
|
||||
- * sizeof (uint32_t));
|
||||
+ assert (alloca_aliases_len == 0);
|
||||
+ alloca_aliases_len
|
||||
+ = __libc_use_alloca (alloca_used
|
||||
+ + (serv_resp.s_aliases_cnt
|
||||
+ * sizeof (uint32_t)));
|
||||
+ if (alloca_aliases_len)
|
||||
+ aliases_len = alloca (serv_resp.s_aliases_cnt
|
||||
+ * sizeof (uint32_t));
|
||||
+ else
|
||||
+ {
|
||||
+ aliases_len = malloc (serv_resp.s_aliases_cnt
|
||||
+ * sizeof (uint32_t));
|
||||
+ if (aliases_len == NULL)
|
||||
+ {
|
||||
+ retval = ENOMEM;
|
||||
+ goto out_close;
|
||||
+ }
|
||||
+ }
|
||||
vec[n].iov_base = (void *) aliases_len;
|
||||
vec[n].iov_len = serv_resp.s_aliases_cnt * sizeof (uint32_t);
|
||||
|
||||
@@ -329,5 +371,10 @@ nscd_getserv_r (const char *crit, size_t critlen, const char *proto,
|
||||
goto retry;
|
||||
}
|
||||
|
||||
+ if (!alloca_aliases_len)
|
||||
+ free ((void *) aliases_len);
|
||||
+ if (!alloca_key)
|
||||
+ free (key);
|
||||
+
|
||||
return retval;
|
||||
}
|
||||
diff --git a/posix/glob.c b/posix/glob.c
|
||||
index 6df083a..79b6e50 100644
|
||||
--- a/posix/glob.c
|
||||
+++ b/posix/glob.c
|
||||
@@ -1,4 +1,4 @@
|
||||
-/* Copyright (C) 1991-2002, 2003, 2004, 2005, 2006, 2007, 2008, 2010
|
||||
+/* Copyright (C) 1991-2002, 2003, 2004, 2005, 2006, 2007, 2008, 2010, 2011
|
||||
Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
@@ -199,7 +199,7 @@ static const char *next_brace_sub (const char *begin, int flags) __THROW;
|
||||
|
||||
static int glob_in_dir (const char *pattern, const char *directory,
|
||||
int flags, int (*errfunc) (const char *, int),
|
||||
- glob_t *pglob);
|
||||
+ glob_t *pglob, size_t alloca_used);
|
||||
extern int __glob_pattern_type (const char *pattern, int quote)
|
||||
attribute_hidden;
|
||||
|
||||
@@ -253,13 +253,18 @@ glob (pattern, flags, errfunc, pglob)
|
||||
glob_t *pglob;
|
||||
{
|
||||
const char *filename;
|
||||
- const char *dirname;
|
||||
+ char *dirname = NULL;
|
||||
size_t dirlen;
|
||||
int status;
|
||||
size_t oldcount;
|
||||
int meta;
|
||||
int dirname_modified;
|
||||
+ int malloc_dirname = 0;
|
||||
glob_t dirs;
|
||||
+ int retval = 0;
|
||||
+#ifdef _LIBC
|
||||
+ size_t alloca_used = 0;
|
||||
+#endif
|
||||
|
||||
if (pattern == NULL || pglob == NULL || (flags & ~__GLOB_FLAGS) != 0)
|
||||
{
|
||||
@@ -308,20 +313,26 @@ glob (pattern, flags, errfunc, pglob)
|
||||
const char *next;
|
||||
const char *rest;
|
||||
size_t rest_len;
|
||||
-#ifdef __GNUC__
|
||||
- char onealt[strlen (pattern) - 1];
|
||||
-#else
|
||||
- char *onealt = (char *) malloc (strlen (pattern) - 1);
|
||||
- if (onealt == NULL)
|
||||
+ char *onealt;
|
||||
+ size_t pattern_len = strlen (pattern) - 1;
|
||||
+#ifdef _LIBC
|
||||
+ int alloca_onealt = __libc_use_alloca (alloca_used + pattern_len);
|
||||
+ if (alloca_onealt)
|
||||
+ onealt = alloca_account (pattern_len, alloca_used);
|
||||
+ else
|
||||
+#endif
|
||||
{
|
||||
- if (!(flags & GLOB_APPEND))
|
||||
+ onealt = (char *) malloc (pattern_len);
|
||||
+ if (onealt == NULL)
|
||||
{
|
||||
- pglob->gl_pathc = 0;
|
||||
- pglob->gl_pathv = NULL;
|
||||
+ if (!(flags & GLOB_APPEND))
|
||||
+ {
|
||||
+ pglob->gl_pathc = 0;
|
||||
+ pglob->gl_pathv = NULL;
|
||||
+ }
|
||||
+ return GLOB_NOSPACE;
|
||||
}
|
||||
- return GLOB_NOSPACE;
|
||||
}
|
||||
-#endif
|
||||
|
||||
/* We know the prefix for all sub-patterns. */
|
||||
alt_start = mempcpy (onealt, pattern, begin - pattern);
|
||||
@@ -332,9 +343,11 @@ glob (pattern, flags, errfunc, pglob)
|
||||
if (next == NULL)
|
||||
{
|
||||
/* It is an illegal expression. */
|
||||
-#ifndef __GNUC__
|
||||
- free (onealt);
|
||||
+ illegal_brace:
|
||||
+#ifdef _LIBC
|
||||
+ if (__builtin_expect (!alloca_onealt, 0))
|
||||
#endif
|
||||
+ free (onealt);
|
||||
return glob (pattern, flags & ~GLOB_BRACE, errfunc, pglob);
|
||||
}
|
||||
|
||||
@@ -344,13 +357,8 @@ glob (pattern, flags, errfunc, pglob)
|
||||
{
|
||||
rest = next_brace_sub (rest + 1, flags);
|
||||
if (rest == NULL)
|
||||
- {
|
||||
- /* It is an illegal expression. */
|
||||
-#ifndef __GNUC__
|
||||
- free (onealt);
|
||||
-#endif
|
||||
- return glob (pattern, flags & ~GLOB_BRACE, errfunc, pglob);
|
||||
- }
|
||||
+ /* It is an illegal expression. */
|
||||
+ goto illegal_brace;
|
||||
}
|
||||
/* Please note that we now can be sure the brace expression
|
||||
is well-formed. */
|
||||
@@ -386,9 +394,10 @@ glob (pattern, flags, errfunc, pglob)
|
||||
/* If we got an error, return it. */
|
||||
if (result && result != GLOB_NOMATCH)
|
||||
{
|
||||
-#ifndef __GNUC__
|
||||
- free (onealt);
|
||||
+#ifdef _LIBC
|
||||
+ if (__builtin_expect (!alloca_onealt, 0))
|
||||
#endif
|
||||
+ free (onealt);
|
||||
if (!(flags & GLOB_APPEND))
|
||||
{
|
||||
globfree (pglob);
|
||||
@@ -406,9 +415,10 @@ glob (pattern, flags, errfunc, pglob)
|
||||
assert (next != NULL);
|
||||
}
|
||||
|
||||
-#ifndef __GNUC__
|
||||
- free (onealt);
|
||||
+#ifdef _LIBC
|
||||
+ if (__builtin_expect (!alloca_onealt, 0))
|
||||
#endif
|
||||
+ free (onealt);
|
||||
|
||||
if (pglob->gl_pathc != firstc)
|
||||
/* We found some entries. */
|
||||
@@ -455,7 +465,7 @@ glob (pattern, flags, errfunc, pglob)
|
||||
case is nothing but a notation for a directory. */
|
||||
if ((flags & (GLOB_TILDE|GLOB_TILDE_CHECK)) && pattern[0] == '~')
|
||||
{
|
||||
- dirname = pattern;
|
||||
+ dirname = (char *) pattern;
|
||||
dirlen = strlen (pattern);
|
||||
|
||||
/* Set FILENAME to NULL as a special flag. This is ugly but
|
||||
@@ -473,9 +483,9 @@ glob (pattern, flags, errfunc, pglob)
|
||||
|
||||
filename = pattern;
|
||||
#ifdef _AMIGA
|
||||
- dirname = "";
|
||||
+ dirname = (char *) "";
|
||||
#else
|
||||
- dirname = ".";
|
||||
+ dirname = (char *) ".";
|
||||
#endif
|
||||
dirlen = 0;
|
||||
}
|
||||
@@ -485,7 +495,7 @@ glob (pattern, flags, errfunc, pglob)
|
||||
&& (flags & GLOB_NOESCAPE) == 0))
|
||||
{
|
||||
/* "/pattern" or "\\/pattern". */
|
||||
- dirname = "/";
|
||||
+ dirname = (char *) "/";
|
||||
dirlen = 1;
|
||||
++filename;
|
||||
}
|
||||
@@ -511,7 +521,17 @@ glob (pattern, flags, errfunc, pglob)
|
||||
from "d:/", since "d:" and "d:/" are not the same.*/
|
||||
}
|
||||
#endif
|
||||
- newp = (char *) __alloca (dirlen + 1);
|
||||
+#ifdef _LIBC
|
||||
+ if (__libc_use_alloca (alloca_used + dirlen + 1))
|
||||
+ newp = alloca_account (dirlen + 1, alloca_used);
|
||||
+ else
|
||||
+#endif
|
||||
+ {
|
||||
+ newp = malloc (dirlen + 1);
|
||||
+ if (newp == NULL)
|
||||
+ return GLOB_NOSPACE;
|
||||
+ malloc_dirname = 1;
|
||||
+ }
|
||||
*((char *) mempcpy (newp, pattern, dirlen)) = '\0';
|
||||
dirname = newp;
|
||||
++filename;
|
||||
@@ -551,7 +571,8 @@ glob (pattern, flags, errfunc, pglob)
|
||||
oldcount = pglob->gl_pathc + pglob->gl_offs;
|
||||
goto no_matches;
|
||||
}
|
||||
- return val;
|
||||
+ retval = val;
|
||||
+ goto out;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -563,7 +584,8 @@ glob (pattern, flags, errfunc, pglob)
|
||||
&& (dirname[2] == '\0' || dirname[2] == '/')))
|
||||
{
|
||||
/* Look up home directory. */
|
||||
- const char *home_dir = getenv ("HOME");
|
||||
+ char *home_dir = getenv ("HOME");
|
||||
+ int malloc_home_dir = 0;
|
||||
# ifdef _AMIGA
|
||||
if (home_dir == NULL || home_dir[0] == '\0')
|
||||
home_dir = "SYS:";
|
||||
@@ -582,7 +604,7 @@ glob (pattern, flags, errfunc, pglob)
|
||||
/* `sysconf' does not support _SC_LOGIN_NAME_MAX. Try
|
||||
a moderate value. */
|
||||
buflen = 20;
|
||||
- name = (char *) __alloca (buflen);
|
||||
+ name = alloca_account (buflen, alloca_used);
|
||||
|
||||
success = getlogin_r (name, buflen) == 0;
|
||||
if (success)
|
||||
@@ -592,6 +614,7 @@ glob (pattern, flags, errfunc, pglob)
|
||||
long int pwbuflen = GETPW_R_SIZE_MAX ();
|
||||
char *pwtmpbuf;
|
||||
struct passwd pwbuf;
|
||||
+ int malloc_pwtmpbuf = 0;
|
||||
int save = errno;
|
||||
|
||||
# ifndef _LIBC
|
||||
@@ -600,7 +623,18 @@ glob (pattern, flags, errfunc, pglob)
|
||||
Try a moderate value. */
|
||||
pwbuflen = 1024;
|
||||
# endif
|
||||
- pwtmpbuf = (char *) __alloca (pwbuflen);
|
||||
+ if (__libc_use_alloca (alloca_used + pwbuflen))
|
||||
+ pwtmpbuf = alloca_account (pwbuflen, alloca_used);
|
||||
+ else
|
||||
+ {
|
||||
+ pwtmpbuf = malloc (pwbuflen);
|
||||
+ if (pwtmpbuf == NULL)
|
||||
+ {
|
||||
+ retval = GLOB_NOSPACE;
|
||||
+ goto out;
|
||||
+ }
|
||||
+ malloc_pwtmpbuf = 1;
|
||||
+ }
|
||||
|
||||
while (getpwnam_r (name, &pwbuf, pwtmpbuf, pwbuflen, &p)
|
||||
!= 0)
|
||||
@@ -610,46 +644,115 @@ glob (pattern, flags, errfunc, pglob)
|
||||
p = NULL;
|
||||
break;
|
||||
}
|
||||
-# ifdef _LIBC
|
||||
- pwtmpbuf = extend_alloca (pwtmpbuf, pwbuflen,
|
||||
+
|
||||
+ if (!malloc_pwtmpbuf
|
||||
+ && __libc_use_alloca (alloca_used
|
||||
+ + 2 * pwbuflen))
|
||||
+ pwtmpbuf = extend_alloca_account (pwtmpbuf, pwbuflen,
|
||||
+ 2 * pwbuflen,
|
||||
+ alloca_used);
|
||||
+ else
|
||||
+ {
|
||||
+ char *newp = realloc (malloc_pwtmpbuf
|
||||
+ ? pwtmpbuf : NULL,
|
||||
2 * pwbuflen);
|
||||
-# else
|
||||
- pwbuflen *= 2;
|
||||
- pwtmpbuf = (char *) __alloca (pwbuflen);
|
||||
-# endif
|
||||
+ if (newp == NULL)
|
||||
+ {
|
||||
+ if (__builtin_expect (malloc_pwtmpbuf, 0))
|
||||
+ free (pwtmpbuf);
|
||||
+ retval = GLOB_NOSPACE;
|
||||
+ goto out;
|
||||
+ }
|
||||
+ pwtmpbuf = newp;
|
||||
+ pwbuflen = 2 * pwbuflen;
|
||||
+ malloc_pwtmpbuf = 1;
|
||||
+ }
|
||||
__set_errno (save);
|
||||
}
|
||||
# else
|
||||
p = getpwnam (name);
|
||||
# endif
|
||||
if (p != NULL)
|
||||
- home_dir = p->pw_dir;
|
||||
+ {
|
||||
+ if (!malloc_pwtmpbuf)
|
||||
+ home_dir = p->pw_dir;
|
||||
+ else
|
||||
+ {
|
||||
+ size_t home_dir_len = strlen (p->pw_dir) + 1;
|
||||
+ if (__libc_use_alloca (alloca_used + home_dir_len))
|
||||
+ home_dir = alloca_account (home_dir_len,
|
||||
+ alloca_used);
|
||||
+ else
|
||||
+ {
|
||||
+ home_dir = malloc (home_dir_len);
|
||||
+ if (home_dir == NULL)
|
||||
+ {
|
||||
+ free (pwtmpbuf);
|
||||
+ retval = GLOB_NOSPACE;
|
||||
+ goto out;
|
||||
+ }
|
||||
+ malloc_home_dir = 1;
|
||||
+ }
|
||||
+ memcpy (home_dir, p->pw_dir, home_dir_len);
|
||||
+
|
||||
+ free (pwtmpbuf);
|
||||
+ }
|
||||
+ }
|
||||
}
|
||||
}
|
||||
if (home_dir == NULL || home_dir[0] == '\0')
|
||||
{
|
||||
if (flags & GLOB_TILDE_CHECK)
|
||||
- return GLOB_NOMATCH;
|
||||
+ {
|
||||
+ if (__builtin_expect (malloc_home_dir, 0))
|
||||
+ free (home_dir);
|
||||
+ retval = GLOB_NOMATCH;
|
||||
+ goto out;
|
||||
+ }
|
||||
else
|
||||
- home_dir = "~"; /* No luck. */
|
||||
+ home_dir = (char *) "~"; /* No luck. */
|
||||
}
|
||||
# endif /* WINDOWS32 */
|
||||
# endif
|
||||
/* Now construct the full directory. */
|
||||
if (dirname[1] == '\0')
|
||||
{
|
||||
+ if (__builtin_expect (malloc_dirname, 0))
|
||||
+ free (dirname);
|
||||
+
|
||||
dirname = home_dir;
|
||||
dirlen = strlen (dirname);
|
||||
+ malloc_dirname = malloc_home_dir;
|
||||
}
|
||||
else
|
||||
{
|
||||
char *newp;
|
||||
size_t home_len = strlen (home_dir);
|
||||
- newp = (char *) __alloca (home_len + dirlen);
|
||||
+ int use_alloca = __libc_use_alloca (alloca_used
|
||||
+ + home_len + dirlen);
|
||||
+ if (use_alloca)
|
||||
+ newp = alloca_account (home_len + dirlen, alloca_used);
|
||||
+ else
|
||||
+ {
|
||||
+ newp = malloc (home_len + dirlen);
|
||||
+ if (newp == NULL)
|
||||
+ {
|
||||
+ if (__builtin_expect (malloc_home_dir, 0))
|
||||
+ free (home_dir);
|
||||
+ retval = GLOB_NOSPACE;
|
||||
+ goto out;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
mempcpy (mempcpy (newp, home_dir, home_len),
|
||||
&dirname[1], dirlen);
|
||||
+
|
||||
+ if (__builtin_expect (malloc_dirname, 0))
|
||||
+ free (dirname);
|
||||
+
|
||||
dirname = newp;
|
||||
dirlen += home_len - 1;
|
||||
+ malloc_dirname = !use_alloca;
|
||||
}
|
||||
dirname_modified = 1;
|
||||
}
|
||||
@@ -657,7 +760,8 @@ glob (pattern, flags, errfunc, pglob)
|
||||
else
|
||||
{
|
||||
char *end_name = strchr (dirname, '/');
|
||||
- const char *user_name;
|
||||
+ char *user_name;
|
||||
+ int malloc_user_name = 0;
|
||||
const char *home_dir;
|
||||
char *unescape = NULL;
|
||||
|
||||
@@ -677,7 +781,18 @@ glob (pattern, flags, errfunc, pglob)
|
||||
else
|
||||
{
|
||||
char *newp;
|
||||
- newp = (char *) __alloca (end_name - dirname);
|
||||
+ if (__libc_use_alloca (alloca_used + (end_name - dirname)))
|
||||
+ newp = alloca_account (end_name - dirname, alloca_used);
|
||||
+ else
|
||||
+ {
|
||||
+ newp = malloc (end_name - dirname);
|
||||
+ if (newp == NULL)
|
||||
+ {
|
||||
+ retval = GLOB_NOSPACE;
|
||||
+ goto out;
|
||||
+ }
|
||||
+ malloc_user_name = 1;
|
||||
+ }
|
||||
if (unescape != NULL)
|
||||
{
|
||||
char *p = mempcpy (newp, dirname + 1,
|
||||
@@ -714,6 +829,7 @@ glob (pattern, flags, errfunc, pglob)
|
||||
# if defined HAVE_GETPWNAM_R || defined _LIBC
|
||||
long int buflen = GETPW_R_SIZE_MAX ();
|
||||
char *pwtmpbuf;
|
||||
+ int malloc_pwtmpbuf = 0;
|
||||
struct passwd pwbuf;
|
||||
int save = errno;
|
||||
|
||||
@@ -723,7 +839,21 @@ glob (pattern, flags, errfunc, pglob)
|
||||
moderate value. */
|
||||
buflen = 1024;
|
||||
# endif
|
||||
- pwtmpbuf = (char *) __alloca (buflen);
|
||||
+ if (__libc_use_alloca (alloca_used + buflen))
|
||||
+ pwtmpbuf = alloca_account (buflen, alloca_used);
|
||||
+ else
|
||||
+ {
|
||||
+ pwtmpbuf = malloc (buflen);
|
||||
+ if (pwtmpbuf == NULL)
|
||||
+ {
|
||||
+ nomem_getpw:
|
||||
+ if (__builtin_expect (malloc_user_name, 0))
|
||||
+ free (user_name);
|
||||
+ retval = GLOB_NOSPACE;
|
||||
+ goto out;
|
||||
+ }
|
||||
+ malloc_pwtmpbuf = 1;
|
||||
+ }
|
||||
|
||||
while (getpwnam_r (user_name, &pwbuf, pwtmpbuf, buflen, &p) != 0)
|
||||
{
|
||||
@@ -732,40 +862,77 @@ glob (pattern, flags, errfunc, pglob)
|
||||
p = NULL;
|
||||
break;
|
||||
}
|
||||
-# ifdef _LIBC
|
||||
- pwtmpbuf = extend_alloca (pwtmpbuf, buflen, 2 * buflen);
|
||||
-# else
|
||||
- buflen *= 2;
|
||||
- pwtmpbuf = __alloca (buflen);
|
||||
-# endif
|
||||
+ if (!malloc_pwtmpbuf
|
||||
+ && __libc_use_alloca (alloca_used + 2 * buflen))
|
||||
+ pwtmpbuf = extend_alloca_account (pwtmpbuf, buflen,
|
||||
+ 2 * buflen, alloca_used);
|
||||
+ else
|
||||
+ {
|
||||
+ char *newp = realloc (malloc_pwtmpbuf ? pwtmpbuf : NULL,
|
||||
+ 2 * buflen);
|
||||
+ if (newp == NULL)
|
||||
+ {
|
||||
+ if (__builtin_expect (malloc_pwtmpbuf, 0))
|
||||
+ free (pwtmpbuf);
|
||||
+ goto nomem_getpw;
|
||||
+ }
|
||||
+ pwtmpbuf = newp;
|
||||
+ malloc_pwtmpbuf = 1;
|
||||
+ }
|
||||
__set_errno (save);
|
||||
}
|
||||
# else
|
||||
p = getpwnam (user_name);
|
||||
# endif
|
||||
+
|
||||
+ if (__builtin_expect (malloc_user_name, 0))
|
||||
+ free (user_name);
|
||||
+
|
||||
+ /* If we found a home directory use this. */
|
||||
if (p != NULL)
|
||||
- home_dir = p->pw_dir;
|
||||
+ {
|
||||
+ size_t home_len = strlen (p->pw_dir);
|
||||
+ size_t rest_len = end_name == NULL ? 0 : strlen (end_name);
|
||||
+
|
||||
+ if (__builtin_expect (malloc_dirname, 0))
|
||||
+ free (dirname);
|
||||
+ malloc_dirname = 0;
|
||||
+
|
||||
+ if (__libc_use_alloca (alloca_used + home_len + rest_len + 1))
|
||||
+ dirname = alloca_account (home_len + rest_len + 1,
|
||||
+ alloca_used);
|
||||
+ else
|
||||
+ {
|
||||
+ dirname = malloc (home_len + rest_len + 1);
|
||||
+ if (dirname == NULL)
|
||||
+ {
|
||||
+ if (__builtin_expect (malloc_pwtmpbuf, 0))
|
||||
+ free (pwtmpbuf);
|
||||
+ retval = GLOB_NOSPACE;
|
||||
+ goto out;
|
||||
+ }
|
||||
+ malloc_dirname = 1;
|
||||
+ }
|
||||
+ *((char *) mempcpy (mempcpy (dirname, p->pw_dir, home_len),
|
||||
+ end_name, rest_len)) = '\0';
|
||||
+
|
||||
+ dirlen = home_len + rest_len;
|
||||
+ dirname_modified = 1;
|
||||
+
|
||||
+ if (__builtin_expect (malloc_pwtmpbuf, 0))
|
||||
+ free (pwtmpbuf);
|
||||
+ }
|
||||
else
|
||||
- home_dir = NULL;
|
||||
+ {
|
||||
+ if (__builtin_expect (malloc_pwtmpbuf, 0))
|
||||
+ free (pwtmpbuf);
|
||||
+
|
||||
+ if (flags & GLOB_TILDE_CHECK)
|
||||
+ /* We have to regard it as an error if we cannot find the
|
||||
+ home directory. */
|
||||
+ return GLOB_NOMATCH;
|
||||
+ }
|
||||
}
|
||||
- /* If we found a home directory use this. */
|
||||
- if (home_dir != NULL)
|
||||
- {
|
||||
- char *newp;
|
||||
- size_t home_len = strlen (home_dir);
|
||||
- size_t rest_len = end_name == NULL ? 0 : strlen (end_name);
|
||||
- newp = (char *) __alloca (home_len + rest_len + 1);
|
||||
- *((char *) mempcpy (mempcpy (newp, home_dir, home_len),
|
||||
- end_name, rest_len)) = '\0';
|
||||
- dirname = newp;
|
||||
- dirlen = home_len + rest_len;
|
||||
- dirname_modified = 1;
|
||||
- }
|
||||
- else
|
||||
- if (flags & GLOB_TILDE_CHECK)
|
||||
- /* We have to regard it as an error if we cannot find the
|
||||
- home directory. */
|
||||
- return GLOB_NOMATCH;
|
||||
}
|
||||
# endif /* Not Amiga && not WINDOWS32. */
|
||||
}
|
||||
@@ -899,7 +1066,7 @@ glob (pattern, flags, errfunc, pglob)
|
||||
status = glob_in_dir (filename, dirs.gl_pathv[i],
|
||||
((flags | GLOB_APPEND)
|
||||
& ~(GLOB_NOCHECK | GLOB_NOMAGIC)),
|
||||
- errfunc, pglob);
|
||||
+ errfunc, pglob, alloca_used);
|
||||
if (status == GLOB_NOMATCH)
|
||||
/* No matches in this directory. Try the next. */
|
||||
continue;
|
||||
@@ -1000,7 +1167,8 @@ glob (pattern, flags, errfunc, pglob)
|
||||
}
|
||||
if (dirname_modified)
|
||||
flags &= ~(GLOB_NOCHECK | GLOB_NOMAGIC);
|
||||
- status = glob_in_dir (filename, dirname, flags, errfunc, pglob);
|
||||
+ status = glob_in_dir (filename, dirname, flags, errfunc, pglob,
|
||||
+ alloca_used);
|
||||
if (status != 0)
|
||||
{
|
||||
if (status == GLOB_NOMATCH && flags != orig_flags
|
||||
@@ -1063,7 +1231,11 @@ glob (pattern, flags, errfunc, pglob)
|
||||
sizeof (char *), collated_compare);
|
||||
}
|
||||
|
||||
- return 0;
|
||||
+ out:
|
||||
+ if (__builtin_expect (malloc_dirname, 0))
|
||||
+ free (dirname);
|
||||
+
|
||||
+ return retval;
|
||||
}
|
||||
#if defined _LIBC && !defined glob
|
||||
libc_hidden_def (glob)
|
||||
@@ -1273,7 +1445,7 @@ link_exists2_p (const char *dir, size_t dirlen, const char *fname,
|
||||
static int
|
||||
glob_in_dir (const char *pattern, const char *directory, int flags,
|
||||
int (*errfunc) (const char *, int),
|
||||
- glob_t *pglob)
|
||||
+ glob_t *pglob, size_t alloca_used)
|
||||
{
|
||||
size_t dirlen = strlen (directory);
|
||||
void *stream = NULL;
|
||||
@@ -1288,11 +1460,12 @@ glob_in_dir (const char *pattern, const char *directory, int flags,
|
||||
struct globnames *names = &init_names;
|
||||
struct globnames *names_alloca = &init_names;
|
||||
size_t nfound = 0;
|
||||
- size_t allocasize = sizeof (init_names);
|
||||
size_t cur = 0;
|
||||
int meta;
|
||||
int save;
|
||||
|
||||
+ alloca_used += sizeof (init_names);
|
||||
+
|
||||
init_names.next = NULL;
|
||||
init_names.count = INITIAL_COUNT;
|
||||
|
||||
@@ -1308,20 +1481,36 @@ glob_in_dir (const char *pattern, const char *directory, int flags,
|
||||
{
|
||||
/* Since we use the normal file functions we can also use stat()
|
||||
to verify the file is there. */
|
||||
- struct stat st;
|
||||
- struct_stat64 st64;
|
||||
+ union
|
||||
+ {
|
||||
+ struct stat st;
|
||||
+ struct_stat64 st64;
|
||||
+ } ust;
|
||||
size_t patlen = strlen (pattern);
|
||||
- char *fullname = (char *) __alloca (dirlen + 1 + patlen + 1);
|
||||
+ int alloca_fullname = __libc_use_alloca (alloca_used
|
||||
+ + dirlen + 1 + patlen + 1);
|
||||
+ char *fullname;
|
||||
+ if (alloca_fullname)
|
||||
+ fullname = alloca_account (dirlen + 1 + patlen + 1, alloca_used);
|
||||
+ else
|
||||
+ {
|
||||
+ fullname = malloc (dirlen + 1 + patlen + 1);
|
||||
+ if (fullname == NULL)
|
||||
+ return GLOB_NOSPACE;
|
||||
+ }
|
||||
|
||||
mempcpy (mempcpy (mempcpy (fullname, directory, dirlen),
|
||||
"/", 1),
|
||||
pattern, patlen + 1);
|
||||
if ((__builtin_expect (flags & GLOB_ALTDIRFUNC, 0)
|
||||
- ? (*pglob->gl_stat) (fullname, &st)
|
||||
- : __stat64 (fullname, &st64)) == 0)
|
||||
+ ? (*pglob->gl_stat) (fullname, &ust.st)
|
||||
+ : __stat64 (fullname, &ust.st64)) == 0)
|
||||
/* We found this file to be existing. Now tell the rest
|
||||
of the function to copy this name into the result. */
|
||||
flags |= GLOB_NOCHECK;
|
||||
+
|
||||
+ if (__builtin_expect (!alloca_fullname, 0))
|
||||
+ free (fullname);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1409,9 +1598,9 @@ glob_in_dir (const char *pattern, const char *directory, int flags,
|
||||
size_t size = (sizeof (struct globnames)
|
||||
+ ((count - INITIAL_COUNT)
|
||||
* sizeof (char *)));
|
||||
- allocasize += size;
|
||||
- if (__libc_use_alloca (allocasize))
|
||||
- newnames = names_alloca = __alloca (size);
|
||||
+ if (__libc_use_alloca (alloca_used + size))
|
||||
+ newnames = names_alloca
|
||||
+ = alloca_account (size, alloca_used);
|
||||
else if ((newnames = malloc (size))
|
||||
== NULL)
|
||||
goto memory_error;
|
||||
23
src/patches/glibc/glibc-rh804630.patch
Normal file
23
src/patches/glibc/glibc-rh804630.patch
Normal file
@@ -0,0 +1,23 @@
|
||||
diff -rup c/resolv/res_send.c d/resolv/res_send.c
|
||||
--- c/resolv/res_send.c 2012-01-01 05:16:32.000000000 -0700
|
||||
+++ d/resolv/res_send.c 2012-03-30 12:39:30.862467628 -0600
|
||||
@@ -409,6 +409,7 @@ __libc_res_nsend(res_state statp, const
|
||||
*/
|
||||
if (EXT(statp).nsinit == 0) {
|
||||
unsigned char map[MAXNS];
|
||||
+ unsigned int ext_total_nscount;
|
||||
|
||||
memset (map, MAXNS, sizeof (map));
|
||||
for (n = 0; n < MAXNS; n++) {
|
||||
@@ -422,8 +423,9 @@ __libc_res_nsend(res_state statp, const
|
||||
}
|
||||
}
|
||||
n = statp->nscount;
|
||||
- if (statp->nscount > EXT(statp).nscount)
|
||||
- for (n = EXT(statp).nscount, ns = 0;
|
||||
+ ext_total_nscount = EXT(statp).nscount + EXT(statp).nscount6;
|
||||
+ if (statp->nscount > ext_total_nscount)
|
||||
+ for (n = ext_total_nscount, ns = 0;
|
||||
n < statp->nscount; n++) {
|
||||
while (ns < MAXNS
|
||||
&& EXT(statp).nsmap[ns] != MAXNS)
|
||||
23
src/patches/glibc/glibc-rh804689.patch
Normal file
23
src/patches/glibc/glibc-rh804689.patch
Normal file
@@ -0,0 +1,23 @@
|
||||
diff -rup a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c
|
||||
--- a/sysdeps/posix/getaddrinfo.c 2012-03-20 21:31:14.177358937 -0600
|
||||
+++ b/sysdeps/posix/getaddrinfo.c 2012-03-21 09:13:17.198290683 -0600
|
||||
@@ -560,15 +563,11 @@ gaih_inet (const char *name, const struc
|
||||
int no_more;
|
||||
int old_res_options;
|
||||
|
||||
- /* If we do not have to look for IPv4 and IPv6 together, use
|
||||
- the simple, old functions. */
|
||||
- if ((req->ai_family == AF_INET
|
||||
- || (req->ai_family == AF_INET6
|
||||
- && ((req->ai_flags & AI_V4MAPPED) == 0
|
||||
- || (req->ai_flags & AI_ALL) == 0)))
|
||||
- && (req->ai_flags & AI_CANONNAME) == 0)
|
||||
+ /* If we do not have to look for IPv6 addresses, use
|
||||
+ the simple, old functions, which do not support
|
||||
+ IPv6 scope ids. */
|
||||
+ if (req->ai_family == AF_INET)
|
||||
{
|
||||
- int family = req->ai_family;
|
||||
size_t tmpbuflen = 512;
|
||||
assert (tmpbuf == NULL);
|
||||
tmpbuf = alloca_account (tmpbuflen, alloca_used);
|
||||
21
src/patches/glibc/glibc-rh808337.patch
Normal file
21
src/patches/glibc/glibc-rh808337.patch
Normal file
@@ -0,0 +1,21 @@
|
||||
commit 6a5ee1029b3966c5ae9adaaa881e255b2880f511
|
||||
Author: Ulrich Drepper <drepper@gmail.com>
|
||||
Date: Sun Mar 6 00:01:50 2011 -0500
|
||||
|
||||
Fix loading first object along a path when tracing.
|
||||
|
||||
diff --git a/elf/dl-load.c b/elf/dl-load.c
|
||||
index 1ad16a0..f866066 100644
|
||||
--- a/elf/dl-load.c
|
||||
+++ b/elf/dl-load.c
|
||||
@@ -2111,7 +2111,9 @@ _dl_map_object (struct link_map *loader, const char *name,
|
||||
{
|
||||
#ifdef SHARED
|
||||
// XXX Correct to unconditionally default to namespace 0?
|
||||
- l = loader ?: GL(dl_ns)[LM_ID_BASE]._ns_loaded;
|
||||
+ l = (loader
|
||||
+ ?: GL(dl_ns)[LM_ID_BASE]._ns_loaded
|
||||
+ ?: &GL(dl_rtld_map));
|
||||
#else
|
||||
l = loader;
|
||||
#endif
|
||||
44
src/patches/glibc/glibc-rh808545.patch
Normal file
44
src/patches/glibc/glibc-rh808545.patch
Normal file
@@ -0,0 +1,44 @@
|
||||
diff -rup a/resolv/nss_dns/dns-host.c b/resolv/nss_dns/dns-host.c
|
||||
--- a/resolv/nss_dns/dns-host.c 2012-04-18 11:17:31.527539744 -0600
|
||||
+++ b/resolv/nss_dns/dns-host.c 2012-04-18 11:21:45.441394159 -0600
|
||||
@@ -745,6 +745,10 @@ getanswer_r (const querybuf *answer, int
|
||||
|
||||
if ((qtype == T_A || qtype == T_AAAA) && type == T_CNAME)
|
||||
{
|
||||
+ /* A CNAME could also have a TTL entry. */
|
||||
+ if (ttlp != NULL && ttl < *ttlp)
|
||||
+ *ttlp = ttl;
|
||||
+
|
||||
if (ap >= &host_data->aliases[MAX_NR_ALIASES - 1])
|
||||
continue;
|
||||
n = dn_expand (answer->buf, end_of_message, cp, tbuf, sizeof tbuf);
|
||||
@@ -906,7 +910,7 @@ getanswer_r (const querybuf *answer, int
|
||||
{
|
||||
register int nn;
|
||||
|
||||
- if (ttlp != NULL)
|
||||
+ if (ttlp != NULL && ttl < *ttlp)
|
||||
*ttlp = ttl;
|
||||
if (canonp != NULL)
|
||||
*canonp = bp;
|
||||
@@ -1082,6 +1086,11 @@ gaih_getanswer_slice (const querybuf *an
|
||||
if (type == T_CNAME)
|
||||
{
|
||||
char tbuf[MAXDNAME];
|
||||
+
|
||||
+ /* A CNAME could also have a TTL entry. */
|
||||
+ if (ttlp != NULL && ttl < *ttlp)
|
||||
+ *ttlp = ttl;
|
||||
+
|
||||
n = dn_expand (answer->buf, end_of_message, cp, tbuf, sizeof tbuf);
|
||||
if (__builtin_expect (n < 0 || res_hnok (tbuf) == 0, 0))
|
||||
{
|
||||
@@ -1162,7 +1171,7 @@ gaih_getanswer_slice (const querybuf *an
|
||||
|
||||
if (*firstp)
|
||||
{
|
||||
- if (ttlp != NULL)
|
||||
+ if (ttlp != NULL && ttl < *ttlp)
|
||||
*ttlp = ttl;
|
||||
|
||||
(*pat)->name = canon ?: h_name;
|
||||
47
src/patches/glibc/glibc-rh809602.patch
Normal file
47
src/patches/glibc/glibc-rh809602.patch
Normal file
@@ -0,0 +1,47 @@
|
||||
diff -rup a/nscd/nscd_getserv_r.c b/nscd/nscd_getserv_r.c
|
||||
--- a/nscd/nscd_getserv_r.c 2012-04-04 16:37:27.873951850 -0600
|
||||
+++ b/nscd/nscd_getserv_r.c 2012-04-04 16:37:49.904837348 -0600
|
||||
@@ -124,6 +123,7 @@ nscd_getserv_r (const char *crit, size_t
|
||||
s_name = (char *) (&found->data[0].servdata + 1);
|
||||
serv_resp = found->data[0].servdata;
|
||||
s_proto = s_name + serv_resp.s_name_len;
|
||||
+ alloca_aliases_len = 1;
|
||||
aliases_len = (uint32_t *) (s_proto + serv_resp.s_proto_len);
|
||||
aliases_list = ((char *) aliases_len
|
||||
+ serv_resp.s_aliases_cnt * sizeof (uint32_t));
|
||||
@@ -154,7 +154,9 @@ nscd_getserv_r (const char *crit, size_t
|
||||
+ (serv_resp.s_aliases_cnt
|
||||
* sizeof (uint32_t)));
|
||||
if (alloca_aliases_len)
|
||||
- tmp = __alloca (serv_resp.s_aliases_cnt * sizeof (uint32_t));
|
||||
+ tmp = alloca_account (serv_resp.s_aliases_cnt
|
||||
+ * sizeof (uint32_t),
|
||||
+ alloca_used);
|
||||
else
|
||||
{
|
||||
tmp = malloc (serv_resp.s_aliases_cnt * sizeof (uint32_t));
|
||||
@@ -249,8 +251,9 @@ nscd_getserv_r (const char *crit, size_t
|
||||
+ (serv_resp.s_aliases_cnt
|
||||
* sizeof (uint32_t)));
|
||||
if (alloca_aliases_len)
|
||||
- aliases_len = alloca (serv_resp.s_aliases_cnt
|
||||
- * sizeof (uint32_t));
|
||||
+ aliases_len = alloca_account (serv_resp.s_aliases_cnt
|
||||
+ * sizeof (uint32_t),
|
||||
+ alloca_used);
|
||||
else
|
||||
{
|
||||
aliases_len = malloc (serv_resp.s_aliases_cnt
|
||||
@@ -368,7 +371,11 @@ nscd_getserv_r (const char *crit, size_t
|
||||
}
|
||||
|
||||
if (retval != -1)
|
||||
- goto retry;
|
||||
+ {
|
||||
+ if (!alloca_aliases_len)
|
||||
+ free ((void *) aliases_len);
|
||||
+ goto retry;
|
||||
+ }
|
||||
}
|
||||
|
||||
if (!alloca_aliases_len)
|
||||
45265
src/patches/glibc/glibc-rh833716.patch
Normal file
45265
src/patches/glibc/glibc-rh833716.patch
Normal file
File diff suppressed because it is too large
Load Diff
30
src/patches/glibc/glibc-rh837026.patch
Normal file
30
src/patches/glibc/glibc-rh837026.patch
Normal file
@@ -0,0 +1,30 @@
|
||||
diff -rup a/resolv/res_send.c b/resolv/res_send.c
|
||||
--- a/resolv/res_send.c 2012-06-28 11:55:38.361886650 -0600
|
||||
+++ b/resolv/res_send.c 2012-06-28 11:51:38.253963687 -0600
|
||||
@@ -424,17 +424,15 @@ __libc_res_nsend(res_state statp, const
|
||||
}
|
||||
n = statp->nscount;
|
||||
ext_total_nscount = EXT(statp).nscount + EXT(statp).nscount6;
|
||||
- if (statp->nscount > ext_total_nscount)
|
||||
- for (n = ext_total_nscount, ns = 0;
|
||||
- n < statp->nscount; n++) {
|
||||
- while (ns < MAXNS
|
||||
- && EXT(statp).nsmap[ns] != MAXNS)
|
||||
- ns++;
|
||||
- if (ns == MAXNS)
|
||||
- break;
|
||||
- EXT(statp).nsmap[ns] = n;
|
||||
- map[n] = ns++;
|
||||
- }
|
||||
+ for (n = 0, ns = 0; n < statp->nscount - ext_total_nscount; n++) {
|
||||
+ while (ns < MAXNS
|
||||
+ && EXT(statp).nsmap[ns] != MAXNS)
|
||||
+ ns++;
|
||||
+ if (ns == MAXNS)
|
||||
+ break;
|
||||
+ EXT(statp).nsmap[ns] = n;
|
||||
+ map[n] = ns++;
|
||||
+ }
|
||||
EXT(statp).nscount = n;
|
||||
for (ns = 0; ns < EXT(statp).nscount; ns++) {
|
||||
n = map[ns];
|
||||
Reference in New Issue
Block a user