From 2455d11258712bbab8a52c7951301924a483a295 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Mon, 28 Aug 2006 19:19:33 +0000 Subject: Updated to fedora-glibc-20060828T1903 --- ChangeLog | 31 +++++++++++ fedora/branch.mk | 4 +- fedora/glibc.spec.in | 10 +++- inet/getnameinfo.c | 71 ++++++++++-------------- locale/programs/ld-collate.c | 5 +- locale/programs/ld-ctype.c | 7 ++- malloc/malloc.c | 47 +++++++++++++--- nptl/ChangeLog | 5 ++ nptl/sysdeps/unix/sysv/linux/libc_pthread_init.c | 3 +- 9 files changed, 124 insertions(+), 59 deletions(-) diff --git a/ChangeLog b/ChangeLog index b95ea69c5e..2f46b1e408 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,34 @@ +2006-08-28 Jakub Jelinek + + * inet/getnameinfo.c (getnameinfo): For AF_INET, check errno + only if herrno is NETDB_INTERNAL. Handle errors other than + ERANGE outside of the loops, handle TRY_AGAIN. + + * locale/programs/ld-ctype.c (translit_flatten): Issue error + if other's ctype category was missing. + * locale/programs/ld-collate.c (collate_read): Return if + copy_locale's collate category is missing. + +2006-08-27 Ulrich Drepper + + [BZ #2684] + * malloc/malloc.c (public_rEALLOc): Try harder by using other + arenas if allocation failed. + Patch mostly by Jan Edler . + +2006-08-26 Ulrich Drepper + + * malloc/malloc.c (bin_at): Rewrite to be more clear and to not + waste bins[0..1]. + (malloc_state): Reduce bins size by 2. + (_int_malloc): Fix test for large enough buffer for early termination. + When no unsorted block matches perfectly and an exiting block has + to be split, use full list insert and not shortcut which assumes + the list is empty. + + * locale/programs/ld-ctype.c (ctype_read): Better patch for read + failure. + 2006-08-24 Ulrich Drepper * locale/programs/ld-ctype.c (ctype_read): If CTYPE is NULL, don't diff --git a/fedora/branch.mk b/fedora/branch.mk index fb723d026c..7e4461da37 100644 --- a/fedora/branch.mk +++ b/fedora/branch.mk @@ -3,5 +3,5 @@ glibc-branch := fedora glibc-base := HEAD DIST_BRANCH := devel COLLECTION := dist-fc4 -fedora-sync-date := 2006-08-25 06:39 UTC -fedora-sync-tag := fedora-glibc-20060825T0639 +fedora-sync-date := 2006-08-28 19:03 UTC +fedora-sync-tag := fedora-glibc-20060828T1903 diff --git a/fedora/glibc.spec.in b/fedora/glibc.spec.in index 4fb0f4709b..2674d2b564 100644 --- a/fedora/glibc.spec.in +++ b/fedora/glibc.spec.in @@ -1,4 +1,4 @@ -%define glibcrelease 24 +%define glibcrelease 26 %define auxarches i586 i686 athlon sparcv9 alphaev6 %define xenarches i686 athlon %ifarch %{xenarches} @@ -1448,7 +1448,13 @@ rm -f *.filelist* %endif %changelog -* Fri Aug 25 2006 Jakub Jelinek 2.4.90-24 +* Mon Aug 28 2006 Jakub Jelinek 2.4.90-26 +- real fix for the doubly linked list corruption problem +- try harder in realloc to allocate memory (BZ#2684) +- fix getnameinfo error reporting (#204122) +- make localedef more robust on invalid input (#203728) + +* Fri Aug 25 2006 Jakub Jelinek 2.4.90-25 - temporarily back out code to limit number of unsorted block sort iterations (#203735, #204027) - handle PLT symbols in dladdr properly (BZ#2683) diff --git a/inet/getnameinfo.c b/inet/getnameinfo.c index 5057fd221a..b7b2b151b2 100644 --- a/inet/getnameinfo.c +++ b/inet/getnameinfo.c @@ -203,48 +203,40 @@ getnameinfo (const struct sockaddr *sa, socklen_t addrlen, char *host, if (!(flags & NI_NUMERICHOST)) { struct hostent *h = NULL; + if (sa->sa_family == AF_INET6) + { + while (__gethostbyaddr_r ((const void *) &(((const struct sockaddr_in6 *) sa)->sin6_addr), + sizeof(struct in6_addr), + AF_INET6, &th, tmpbuf, tmpbuflen, + &h, &herrno)) + if (herrno == NETDB_INTERNAL && errno == ERANGE) + tmpbuf = extend_alloca (tmpbuf, tmpbuflen, 2 * tmpbuflen); + else + break; + } + else + { + while (__gethostbyaddr_r ((const void *) &(((const struct sockaddr_in *)sa)->sin_addr), + sizeof(struct in_addr), AF_INET, + &th, tmpbuf, tmpbuflen, + &h, &herrno)) + if (herrno == NETDB_INTERNAL && errno == ERANGE) + tmpbuf = extend_alloca (tmpbuf, tmpbuflen, 2 * tmpbuflen); + else + break; + } + if (h == NULL) { - if (sa->sa_family == AF_INET6) + if (herrno == NETDB_INTERNAL) { - while (__gethostbyaddr_r ((const void *) &(((const struct sockaddr_in6 *) sa)->sin6_addr), - sizeof(struct in6_addr), - AF_INET6, &th, tmpbuf, tmpbuflen, - &h, &herrno)) - { - if (herrno == NETDB_INTERNAL) - { - if (errno == ERANGE) - tmpbuf = extend_alloca (tmpbuf, tmpbuflen, - 2 * tmpbuflen); - else - { - __set_h_errno (herrno); - __set_errno (serrno); - return EAI_SYSTEM; - } - } - else - { - break; - } - } + __set_h_errno (herrno); + return EAI_SYSTEM; } - else + if (herrno == TRY_AGAIN) { - while (__gethostbyaddr_r ((const void *) &(((const struct sockaddr_in *)sa)->sin_addr), - sizeof(struct in_addr), AF_INET, - &th, tmpbuf, tmpbuflen, - &h, &herrno)) - { - if (errno == ERANGE) - tmpbuf = extend_alloca (tmpbuf, tmpbuflen, - 2 * tmpbuflen); - else - { - break; - } - } + __set_h_errno (herrno); + return EAI_AGAIN; } } @@ -361,10 +353,7 @@ getnameinfo (const struct sockaddr *sa, socklen_t addrlen, char *host, (const void *) &(((const struct sockaddr_in *) sa)->sin_addr), host, hostlen); if (c == NULL) - { - __set_errno (serrno); - return EAI_SYSTEM; - } + return EAI_SYSTEM; } ok = 1; } diff --git a/locale/programs/ld-collate.c b/locale/programs/ld-collate.c index 66638d50c8..e69ac85a95 100644 --- a/locale/programs/ld-collate.c +++ b/locale/programs/ld-collate.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1995-2002, 2003, 2005 Free Software Foundation, Inc. +/* Copyright (C) 1995-2002, 2003, 2005, 2006 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 1995. @@ -2671,6 +2671,9 @@ collate_read (struct linereader *ldfile, struct localedef_t *result, if (locfile_read (copy_locale, charmap) != 0) goto skip_category; } + + if (copy_locale->categories[LC_COLLATE].collate == NULL) + return; } lr_ignore_rest (ldfile, 1); diff --git a/locale/programs/ld-ctype.c b/locale/programs/ld-ctype.c index 0ffda62e29..b1a28b9280 100644 --- a/locale/programs/ld-ctype.c +++ b/locale/programs/ld-ctype.c @@ -2245,6 +2245,9 @@ ctype_read (struct linereader *ldfile, struct localedef_t *result, if (locfile_read (copy_locale, charmap) != 0) goto skip_category; } + + if (copy_locale->categories[LC_CTYPE].ctype == NULL) + return; } lr_ignore_rest (ldfile, 1); @@ -2256,8 +2259,6 @@ ctype_read (struct linereader *ldfile, struct localedef_t *result, /* Prepare the data structures. */ ctype_startup (ldfile, result, charmap, copy_locale, ignore_content); ctype = result->categories[LC_CTYPE].ctype; - if (ctype == NULL) - return; /* Remember the repertoire we use. */ if (!ignore_content) @@ -3768,7 +3769,7 @@ translit_flatten (struct locale_ctype_t *ctype, other = find_locale (LC_CTYPE, copy_locale, copy_repertoire, charmap); - if (other == NULL) + if (other == NULL || other->categories[LC_CTYPE].ctype == NULL) { WITH_CUR_LOCALE (error (0, 0, _("\ %s: transliteration data from locale `%s' not available"), diff --git a/malloc/malloc.c b/malloc/malloc.c index 64d898a61b..d37e521367 100644 --- a/malloc/malloc.c +++ b/malloc/malloc.c @@ -2061,7 +2061,9 @@ nextchunk-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ typedef struct malloc_chunk* mbinptr; /* addressing -- note that bin_at(0) does not exist */ -#define bin_at(m, i) ((mbinptr)((char*)&((m)->bins[(i)<<1]) - (SIZE_SZ<<1))) +#define bin_at(m, i) \ + (mbinptr) (((char *) &((m)->bins[((i) - 1) * 2])) \ + - offsetof (struct malloc_chunk, fd)) /* analog of ++bin */ #define next_bin(b) ((mbinptr)((char*)(b) + (sizeof(mchunkptr)<<1))) @@ -2301,7 +2303,7 @@ struct malloc_state { mchunkptr last_remainder; /* Normal bins packed as described above */ - mchunkptr bins[NBINS * 2]; + mchunkptr bins[NBINS * 2 - 2]; /* Bitmap of bins */ unsigned int binmap[BINMAPSIZE]; @@ -3623,6 +3625,29 @@ public_rEALLOc(Void_t* oldmem, size_t bytes) (void)mutex_unlock(&ar_ptr->mutex); assert(!newp || chunk_is_mmapped(mem2chunk(newp)) || ar_ptr == arena_for_chunk(mem2chunk(newp))); + + if (newp == NULL) + { + /* Try harder to allocate memory in other arenas. */ + newp = public_mALLOc(bytes); + if (newp != NULL) + { + MALLOC_COPY (newp, oldmem, oldsize - 2 * SIZE_SZ); +#if THREAD_STATS + if(!mutex_trylock(&ar_ptr->mutex)) + ++(ar_ptr->stat_lock_direct); + else { + (void)mutex_lock(&ar_ptr->mutex); + ++(ar_ptr->stat_lock_wait); + } +#else + (void)mutex_lock(&ar_ptr->mutex); +#endif + _int_free(ar_ptr, oldmem); + (void)mutex_unlock(&ar_ptr->mutex); + } + } + return newp; } #ifdef libc_hidden_def @@ -4069,10 +4094,9 @@ _int_malloc(mstate av, size_t bytes) */ for(;;) { -#if 0 + int iters = 0; bool any_larger = false; -#endif while ( (victim = unsorted_chunks(av)->bk) != unsorted_chunks(av)) { bck = victim->bk; if (__builtin_expect (victim->size <= 2 * SIZE_SZ, 0) @@ -4169,13 +4193,11 @@ _int_malloc(mstate av, size_t bytes) fwd->bk = victim; bck->fd = victim; -#if 0 - if (size >= nb) + if (size >= nb + MINSIZE) any_larger = true; #define MAX_ITERS 10000 if (++iters >= MAX_ITERS) break; -#endif } /* @@ -4294,8 +4316,15 @@ _int_malloc(mstate av, size_t bytes) else { remainder = chunk_at_offset(victim, nb); - unsorted_chunks(av)->bk = unsorted_chunks(av)->fd = remainder; - remainder->bk = remainder->fd = unsorted_chunks(av); + /* We cannot assume the unsorted list is empty and therefore + have to perform a complete insert here. */ + bck = unsorted_chunks(av); + fwd = bck->fd; + remainder->bk = bck; + remainder->fd = fwd; + bck->fd = remainder; + fwd->bk = remainder; + /* advertise as last remainder */ if (in_smallbin_range(nb)) av->last_remainder = remainder; diff --git a/nptl/ChangeLog b/nptl/ChangeLog index 07a1d2f7a7..eb4680d159 100644 --- a/nptl/ChangeLog +++ b/nptl/ChangeLog @@ -1,3 +1,8 @@ +2006-08-25 Jakub Jelinek + + * sysdeps/unix/sysv/linux/libc_pthread_init.c (freeres_libpthread): + Only define ifdef SHARED. + 2006-08-23 Ulrich Drepper * allocatestack.c (queue_stack): Move freeing of surplus stacks to... diff --git a/nptl/sysdeps/unix/sysv/linux/libc_pthread_init.c b/nptl/sysdeps/unix/sysv/linux/libc_pthread_init.c index 4e0001af91..714ad49428 100644 --- a/nptl/sysdeps/unix/sysv/linux/libc_pthread_init.c +++ b/nptl/sysdeps/unix/sysv/linux/libc_pthread_init.c @@ -58,9 +58,10 @@ __libc_pthread_init (ptr, reclaim, functions) #endif } - +#ifdef SHARED libc_freeres_fn (freeres_libptread) { if (__libc_pthread_functions.ptr_freeres != NULL) __libc_pthread_functions.ptr_freeres (); } +#endif -- cgit v1.2.3