- Change error text for ESTALE (#832694)

- Increase size of temporary buffers to avoid unnecessary DNS
    lookups (#837695)
  - Fix gcc_asset failure in _Unwind_SetSpColumn() on ppc64.  (#852445)
  - Don't free memory allocated by mempool allocator (#863453)
This commit is contained in:
Jeff Law 2012-10-16 12:53:44 -06:00
parent e707c1d128
commit 8377b8e913
5 changed files with 276 additions and 1 deletions

22
glibc-rh832694.patch Normal file
View File

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

50
glibc-rh837695.patch Normal file
View File

@ -0,0 +1,50 @@
diff -Nrup a/nss/nsswitch.h b/nss/nsswitch.h
--- a/nss/nsswitch.h 2012-06-30 13:12:34.000000000 -0600
+++ b/nss/nsswitch.h 2012-10-16 12:43:09.377834729 -0600
@@ -198,4 +198,8 @@ extern int __nss_hostname_digits_dots (c
int *h_errnop);
libc_hidden_proto (__nss_hostname_digits_dots)
+/* Maximum number of aliases we allow. */
+#define MAX_NR_ALIASES 48
+#define MAX_NR_ADDRS 48
+
#endif /* nsswitch.h */
diff -Nrup a/resolv/nss_dns/dns-host.c b/resolv/nss_dns/dns-host.c
--- a/resolv/nss_dns/dns-host.c 2012-06-30 13:12:34.000000000 -0600
+++ b/resolv/nss_dns/dns-host.c 2012-10-16 12:43:09.379834766 -0600
@@ -88,10 +88,6 @@
#define RESOLVSORT
-/* Maximum number of aliases we allow. */
-#define MAX_NR_ALIASES 48
-#define MAX_NR_ADDRS 48
-
#if PACKETSZ > 65536
# define MAXPACKET PACKETSZ
#else
diff -Nrup a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c
--- a/sysdeps/posix/getaddrinfo.c 2012-10-16 12:42:34.398174840 -0600
+++ b/sysdeps/posix/getaddrinfo.c 2012-10-16 12:43:09.381834802 -0600
@@ -568,7 +568,10 @@ gaih_inet (const char *name, const struc
IPv6 scope ids, nor retrieving the canonical name. */
if (req->ai_family == AF_INET && (req->ai_flags & AI_CANONNAME) == 0)
{
- size_t tmpbuflen = 512;
+ /* Add room for struct host_data in resolv/nss_dns/dns-host.c */
+ size_t tmpbuflen = 512 + (MAX_NR_ALIASES+MAX_NR_ADDRS+1)*sizeof(char*)
+ + 16 * sizeof(char);
+
assert (tmpbuf == NULL);
tmpbuf = alloca_account (tmpbuflen, alloca_used);
int rc;
@@ -811,7 +814,7 @@ gaih_inet (const char *name, const struc
old_res_options = _res.options;
_res.options &= ~RES_USE_INET6;
- size_t tmpbuflen = 1024;
+ size_t tmpbuflen = 1024 + sizeof(struct gaih_addrtuple);
malloc_tmpbuf = !__libc_use_alloca (alloca_used + tmpbuflen);
assert (tmpbuf == NULL);
if (!malloc_tmpbuf)

105
glibc-rh852445.patch Normal file
View File

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

81
glibc-rh863453.patch Normal file
View File

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

View File

@ -28,7 +28,7 @@
Summary: The GNU libc libraries Summary: The GNU libc libraries
Name: glibc Name: glibc
Version: %{glibcversion} Version: %{glibcversion}
Release: 20%{?dist} Release: 21%{?dist}
# GPLv2+ is used in a bunch of programs, LGPLv2+ is used for libraries. # GPLv2+ is used in a bunch of programs, LGPLv2+ is used for libraries.
# Things that are linked directly into dynamically linked programs # Things that are linked directly into dynamically linked programs
# and shared libraries (e.g. crt files, lib*_nonshared.a) have an additional # and shared libraries (e.g. crt files, lib*_nonshared.a) have an additional
@ -106,6 +106,11 @@ Patch0012: %{name}-stap-libm.patch
# Needs to be sent upstream # Needs to be sent upstream
Patch0034: %{name}-rh841318.patch Patch0034: %{name}-rh841318.patch
# Needs to be sent upstream
Patch0043: %{name}-rh832694.patch
Patch0044: %{name}-rh837695.patch
Patch0046: %{name}-rh863453.patch
# #
# Patches from upstream # Patches from upstream
# #
@ -114,6 +119,7 @@ Patch1037: %{name}-rh849203.patch
Patch1038: %{name}-rh805093.patch Patch1038: %{name}-rh805093.patch
Patch1041: %{name}-rh848748.patch Patch1041: %{name}-rh848748.patch
Patch1042: %{name}-rh865520.patch Patch1042: %{name}-rh865520.patch
Patch1045: %{name}-rh852445.patch
# #
# Patches submitted, but not yet approved upstream. # Patches submitted, but not yet approved upstream.
@ -449,6 +455,10 @@ rm -rf %{glibcportsdir}
%patch1041 -p1 %patch1041 -p1
%patch2042 -p1 %patch2042 -p1
%patch1042 -p1 %patch1042 -p1
%patch0043 -p1
%patch0044 -p1
%patch1045 -p1
%patch0046 -p1
# On powerpc32, hp timing is only available in power4/power6 # On powerpc32, hp timing is only available in power4/power6
# libs, not in base, so pre-power4 dynamic linker is incompatible # libs, not in base, so pre-power4 dynamic linker is incompatible
@ -1255,6 +1265,13 @@ rm -f *.filelist*
%endif %endif
%changelog %changelog
* Tue Oct 16 2012 Jeff Law <law@redhat.com> - 2.16-21
- Change error text for ESTALE (#832694)
- Increase size of temporary buffers to avoid unnecessary DNS
lookups (#837695)
- Fix gcc_asset failure in _Unwind_SetSpColumn() on ppc64. (#852445)
- Don't free memory allocated by mempool allocator (#863453)
* Fri Oct 12 2012 Patsy Franklin <pfrankli@redhat.com> - 2.16-20 * Fri Oct 12 2012 Patsy Franklin <pfrankli@redhat.com> - 2.16-20
- Backport of upstream BZ #14251: powerpc: add name_to_handle, - Backport of upstream BZ #14251: powerpc: add name_to_handle,
open_by_handle, etc to PowerPC bits/fcntl.h. (#rh865520). open_by_handle, etc to PowerPC bits/fcntl.h. (#rh865520).