From cc49a5a8837be1f9307b167d9bf4399798a847c9 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Sun, 1 Nov 2009 07:27:00 -0800 Subject: [PATCH 01/12] Restore locking in free_check. This code is only used when MALLOC_CHECK_ is used. Then some bogus crashes and/or assert could result from the locking changes. The code ain't fast. --- ChangeLog | 5 +++++ malloc/hooks.c | 37 ++++++++++++++++++++----------------- 2 files changed, 25 insertions(+), 17 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6a917dc1f4..a9f6357a69 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2009-11-01 Ulrich Drepper + + * malloc/hooks.c (free_check): Restore locking and call _int_free + appropriately. + 2009-10-30 Ulrich Drepper * version.h (VERSION): Bump for 2.11 release. diff --git a/malloc/hooks.c b/malloc/hooks.c index 622a815f32..28845eeb49 100644 --- a/malloc/hooks.c +++ b/malloc/hooks.c @@ -162,8 +162,8 @@ mem2chunk_check(mem, magic_p) Void_t* mem; unsigned char **magic_p; ((char*)p + sz)>=(mp_.sbrk_base+main_arena.system_mem) )) || szprev_size&MALLOC_ALIGN_MASK || - (contig && (char*)prev_chunk(p)size & PREV_INUSE) || ( (((unsigned long)p - p->prev_size) & page_mask) != 0 ) || ( (sz = chunksize(p)), ((p->prev_size + sz) & page_mask) != 0 ) ) @@ -276,13 +276,17 @@ free_check(mem, caller) Void_t* mem; const Void_t *caller; mchunkptr p; if(!mem) return; + (void)mutex_lock(&main_arena.mutex); p = mem2chunk_check(mem, NULL); if(!p) { + (void)mutex_unlock(&main_arena.mutex); + malloc_printerr(check_action, "free(): invalid pointer", mem); return; } #if HAVE_MMAP if (chunk_is_mmapped(p)) { + (void)mutex_unlock(&main_arena.mutex); munmap_chunk(p); return; } @@ -291,12 +295,11 @@ free_check(mem, caller) Void_t* mem; const Void_t *caller; memset(mem, 0, chunksize(p) - (SIZE_SZ+1)); #endif #ifdef ATOMIC_FASTBINS - _int_free(&main_arena, p, 0); + _int_free(&main_arena, p, 1); #else - (void)mutex_lock(&main_arena.mutex); _int_free(&main_arena, p); - (void)mutex_unlock(&main_arena.mutex); #endif + (void)mutex_unlock(&main_arena.mutex); } static Void_t* @@ -345,13 +348,13 @@ realloc_check(oldmem, bytes, caller) if(oldsize - SIZE_SZ >= nb) newmem = oldmem; /* do nothing */ else { - /* Must alloc, copy, free. */ - if (top_check() >= 0) + /* Must alloc, copy, free. */ + if (top_check() >= 0) newmem = _int_malloc(&main_arena, bytes+1); - if (newmem) { - MALLOC_COPY(BOUNDED_N(newmem, bytes+1), oldmem, oldsize - 2*SIZE_SZ); - munmap_chunk(oldp); - } + if (newmem) { + MALLOC_COPY(BOUNDED_N(newmem, bytes+1), oldmem, oldsize - 2*SIZE_SZ); + munmap_chunk(oldp); + } } } } else { @@ -367,7 +370,7 @@ realloc_check(oldmem, bytes, caller) nb = chunksize(newp); if(oldp=chunk_at_offset(newp, nb)) { memset((char*)oldmem + 2*sizeof(mbinptr), 0, - oldsize - (2*sizeof(mbinptr)+2*SIZE_SZ+1)); + oldsize - (2*sizeof(mbinptr)+2*SIZE_SZ+1)); } else if(nb > oldsize+SIZE_SZ) { memset((char*)BOUNDED_N(chunk2mem(newp), bytes) + oldsize, 0, nb - (oldsize+SIZE_SZ)); @@ -626,7 +629,7 @@ public_sET_STATe(Void_t* msptr) mark_bin(&main_arena, i); } else { /* Oops, index computation from chunksize must have changed. - Link the whole list into unsorted_chunks. */ + Link the whole list into unsorted_chunks. */ first(b) = last(b) = b; b = unsorted_chunks(&main_arena); ms->av[2*i+2]->bk = b; @@ -667,7 +670,7 @@ public_sET_STATe(Void_t* msptr) /* Check whether it is safe to enable malloc checking, or whether it is necessary to disable it. */ if (ms->using_malloc_checking && !using_malloc_checking && - !disallow_malloc_check) + !disallow_malloc_check) __malloc_check_init (); else if (!ms->using_malloc_checking && using_malloc_checking) { __malloc_hook = NULL; From 13f6812ffb5b8ad8c343d49e0be7e5ae0d31dc8e Mon Sep 17 00:00:00 2001 From: Andreas Schwab Date: Tue, 3 Nov 2009 23:52:01 +0100 Subject: [PATCH 02/12] Make name of libgcc_s library configurable --- ChangeLog | 6 ++++++ nptl/ChangeLog | 7 +++++++ nptl/sysdeps/pthread/unwind-forcedunwind.c | 5 +++-- nptl/sysdeps/pthread/unwind-resume.c | 5 +++-- sysdeps/generic/framestate.c | 3 ++- sysdeps/generic/libgcc_s.h | 2 ++ 6 files changed, 23 insertions(+), 5 deletions(-) create mode 100644 sysdeps/generic/libgcc_s.h diff --git a/ChangeLog b/ChangeLog index a9f6357a69..e6efe933c7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2009-11-03 Andreas Schwab + + [BZ #4457] + * sysdeps/generic/libgcc_s.h: New file. + * sysdeps/generic/framestate.c: Include it and use LIBGCC_S_SO. + 2009-11-01 Ulrich Drepper * malloc/hooks.c (free_check): Restore locking and call _int_free diff --git a/nptl/ChangeLog b/nptl/ChangeLog index 52176fc10d..0aaaa3f7b9 100644 --- a/nptl/ChangeLog +++ b/nptl/ChangeLog @@ -1,3 +1,10 @@ +2009-11-03 Andreas Schwab + + [BZ #4457] + * sysdeps/pthread/unwind-resume.c: Include and use + LIBGCC_S_SO. + * sysdeps/pthread/unwind-forcedunwind.c: Likewise. + 2009-10-30 Ulrich Drepper * tst-sem11.c (main): Rewrite to avoid aliasing problems. diff --git a/nptl/sysdeps/pthread/unwind-forcedunwind.c b/nptl/sysdeps/pthread/unwind-forcedunwind.c index 402591f6e4..ae43f335e7 100644 --- a/nptl/sysdeps/pthread/unwind-forcedunwind.c +++ b/nptl/sysdeps/pthread/unwind-forcedunwind.c @@ -22,6 +22,7 @@ #include #include #include +#include static void *libgcc_s_handle; static void (*libgcc_s_resume) (struct _Unwind_Exception *exc); @@ -49,7 +50,7 @@ pthread_cancel_init (void) return; } - handle = __libc_dlopen ("libgcc_s.so.1"); + handle = __libc_dlopen (LIBGCC_S_SO); if (handle == NULL || (resume = __libc_dlsym (handle, "_Unwind_Resume")) == NULL @@ -61,7 +62,7 @@ pthread_cancel_init (void) || ARCH_CANCEL_INIT (handle) #endif ) - __libc_fatal ("libgcc_s.so.1 must be installed for pthread_cancel to work\n"); + __libc_fatal (LIBGCC_S_SO " must be installed for pthread_cancel to work\n"); PTR_MANGLE (resume); libgcc_s_resume = resume; diff --git a/nptl/sysdeps/pthread/unwind-resume.c b/nptl/sysdeps/pthread/unwind-resume.c index 088f4c6f6c..69f3e04c43 100644 --- a/nptl/sysdeps/pthread/unwind-resume.c +++ b/nptl/sysdeps/pthread/unwind-resume.c @@ -20,6 +20,7 @@ #include #include #include +#include static void (*libgcc_s_resume) (struct _Unwind_Exception *exc); static _Unwind_Reason_Code (*libgcc_s_personality) @@ -32,12 +33,12 @@ init (void) void *resume, *personality; void *handle; - handle = __libc_dlopen ("libgcc_s.so.1"); + handle = __libc_dlopen (LIBGCC_S_SO); if (handle == NULL || (resume = __libc_dlsym (handle, "_Unwind_Resume")) == NULL || (personality = __libc_dlsym (handle, "__gcc_personality_v0")) == NULL) - __libc_fatal ("libgcc_s.so.1 must be installed for pthread_cancel to work\n"); + __libc_fatal (LIBGCC_S_SO " must be installed for pthread_cancel to work\n"); libgcc_s_resume = resume; libgcc_s_personality = personality; diff --git a/sysdeps/generic/framestate.c b/sysdeps/generic/framestate.c index a912a8c375..80375bba98 100644 --- a/sysdeps/generic/framestate.c +++ b/sysdeps/generic/framestate.c @@ -24,6 +24,7 @@ #define __frame_state_for fallback_frame_state_for #include #undef __frame_state_for +#include typedef struct frame_state * (*framesf)(void *pc, struct frame_state *); struct frame_state *__frame_state_for (void *pc, @@ -36,7 +37,7 @@ __frame_state_for (void *pc, struct frame_state *frame_state) if (frame_state_for == NULL) { - void *handle = __libc_dlopen ("libgcc_s.so.1"); + void *handle = __libc_dlopen (LIBGCC_S_SO); if (handle == NULL || (frame_state_for diff --git a/sysdeps/generic/libgcc_s.h b/sysdeps/generic/libgcc_s.h new file mode 100644 index 0000000000..e74a1034ca --- /dev/null +++ b/sysdeps/generic/libgcc_s.h @@ -0,0 +1,2 @@ +/* Name of libgcc_s library provided by gcc. */ +#define LIBGCC_S_SO "libgcc_s.so.1" From 34df851b3364e14133b865574dbc5f2a8b88874e Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Fri, 6 Nov 2009 09:26:31 -0800 Subject: [PATCH 03/12] Fix preadv, pwritev and fallocate for -D_FILE_OFFSET_BITS=64. As reported in http://bugzilla.redhat.com/533063 , preadv/pwritev prototypes are wrong on 32-bit arches with -D_FILE_OFFSET_BITS=64 and as I've just found, fallocate is wrong too. The problem is that only off_t is remapped to the 64-bit type transparently, __off_t is not. --- ChangeLog | 14 ++++++++++++++ misc/sys/uio.h | 4 ++-- sysdeps/unix/sysv/linux/i386/bits/fcntl.h | 4 ++-- sysdeps/unix/sysv/linux/ia64/bits/fcntl.h | 4 ++-- sysdeps/unix/sysv/linux/powerpc/bits/fcntl.h | 4 ++-- sysdeps/unix/sysv/linux/s390/bits/fcntl.h | 4 ++-- sysdeps/unix/sysv/linux/sh/bits/fcntl.h | 4 ++-- sysdeps/unix/sysv/linux/sparc/bits/fcntl.h | 4 ++-- sysdeps/unix/sysv/linux/x86_64/bits/fcntl.h | 4 ++-- 9 files changed, 30 insertions(+), 16 deletions(-) diff --git a/ChangeLog b/ChangeLog index e6efe933c7..5c4b5d497f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2009-11-04 Jakub Jelinek + + * misc/sys/uio.h (preadv, pwritev): Fix type of last argument + when -D_FILE_OFFSET_BITS=64. + + * sysdeps/unix/sysv/linux/ia64/bits/fcntl.h (fallocate): Fix types + of last two arguments when -D_FILE_OFFSET_BITS=64. + * sysdeps/unix/sysv/linux/i386/bits/fcntl.h (fallocate): Likewise. + * sysdeps/unix/sysv/linux/s390/bits/fcntl.h (fallocate): Likewise. + * sysdeps/unix/sysv/linux/powerpc/bits/fcntl.h (fallocate): Likewise. + * sysdeps/unix/sysv/linux/x86_64/bits/fcntl.h (fallocate): Likewise. + * sysdeps/unix/sysv/linux/sparc/bits/fcntl.h (fallocate): Likewise. + * sysdeps/unix/sysv/linux/sh/bits/fcntl.h (fallocate): Likewise. + 2009-11-03 Andreas Schwab [BZ #4457] diff --git a/misc/sys/uio.h b/misc/sys/uio.h index 05d956bfd3..a32b7ed8e5 100644 --- a/misc/sys/uio.h +++ b/misc/sys/uio.h @@ -80,10 +80,10 @@ extern ssize_t pwritev (int __fd, __const struct iovec *__iovec, int __count, # else # ifdef __REDIRECT extern ssize_t __REDIRECT (preadv, (int __fd, __const struct iovec *__iovec, - int __count, __off_t __offset), + int __count, __off64_t __offset), preadv64) __wur; extern ssize_t __REDIRECT (pwritev, (int __fd, __const struct iovec *__iovec, - int __count, __off_t __offset), + int __count, __off64_t __offset), pwritev64) __wur; # else # define preadv preadv64 diff --git a/sysdeps/unix/sysv/linux/i386/bits/fcntl.h b/sysdeps/unix/sysv/linux/i386/bits/fcntl.h index 06b9e48acc..6a38dc03fe 100644 --- a/sysdeps/unix/sysv/linux/i386/bits/fcntl.h +++ b/sysdeps/unix/sysv/linux/i386/bits/fcntl.h @@ -259,8 +259,8 @@ extern ssize_t tee (int __fdin, int __fdout, size_t __len, extern int fallocate (int __fd, int __mode, __off_t __offset, __off_t __len); # else # ifdef __REDIRECT -extern int __REDIRECT (fallocate, (int __fd, int __mode, __off_t __offset, - __off_t __len), +extern int __REDIRECT (fallocate, (int __fd, int __mode, __off64_t __offset, + __off64_t __len), fallocate64); # else # define fallocate fallocate64 diff --git a/sysdeps/unix/sysv/linux/ia64/bits/fcntl.h b/sysdeps/unix/sysv/linux/ia64/bits/fcntl.h index 9677394773..9a0245a6c4 100644 --- a/sysdeps/unix/sysv/linux/ia64/bits/fcntl.h +++ b/sysdeps/unix/sysv/linux/ia64/bits/fcntl.h @@ -253,8 +253,8 @@ extern ssize_t tee (int __fdin, int __fdout, size_t __len, extern int fallocate (int __fd, int __mode, __off_t __offset, __off_t __len); # else # ifdef __REDIRECT -extern int __REDIRECT (fallocate, (int __fd, int __mode, __off_t __offset, - __off_t __len), +extern int __REDIRECT (fallocate, (int __fd, int __mode, __off64_t __offset, + __off64_t __len), fallocate64); # else # define fallocate fallocate64 diff --git a/sysdeps/unix/sysv/linux/powerpc/bits/fcntl.h b/sysdeps/unix/sysv/linux/powerpc/bits/fcntl.h index ea0ee6e551..6c4b66b7ac 100644 --- a/sysdeps/unix/sysv/linux/powerpc/bits/fcntl.h +++ b/sysdeps/unix/sysv/linux/powerpc/bits/fcntl.h @@ -259,8 +259,8 @@ extern ssize_t tee (int __fdin, int __fdout, size_t __len, extern int fallocate (int __fd, int __mode, __off_t __offset, __off_t __len); # else # ifdef __REDIRECT -extern int __REDIRECT (fallocate, (int __fd, int __mode, __off_t __offset, - __off_t __len), +extern int __REDIRECT (fallocate, (int __fd, int __mode, __off64_t __offset, + __off64_t __len), fallocate64); # else # define fallocate fallocate64 diff --git a/sysdeps/unix/sysv/linux/s390/bits/fcntl.h b/sysdeps/unix/sysv/linux/s390/bits/fcntl.h index 3a11c48e04..d3dddbc368 100644 --- a/sysdeps/unix/sysv/linux/s390/bits/fcntl.h +++ b/sysdeps/unix/sysv/linux/s390/bits/fcntl.h @@ -279,8 +279,8 @@ extern ssize_t tee (int __fdin, int __fdout, size_t __len, extern int fallocate (int __fd, int __mode, __off_t __offset, __off_t __len); # else # ifdef __REDIRECT -extern int __REDIRECT (fallocate, (int __fd, int __mode, __off_t __offset, - __off_t __len), +extern int __REDIRECT (fallocate, (int __fd, int __mode, __off64_t __offset, + __off64_t __len), fallocate64); # else # define fallocate fallocate64 diff --git a/sysdeps/unix/sysv/linux/sh/bits/fcntl.h b/sysdeps/unix/sysv/linux/sh/bits/fcntl.h index 03ecd72fea..d7a21ea2e2 100644 --- a/sysdeps/unix/sysv/linux/sh/bits/fcntl.h +++ b/sysdeps/unix/sysv/linux/sh/bits/fcntl.h @@ -259,8 +259,8 @@ extern ssize_t tee (int __fdin, int __fdout, size_t __len, extern int fallocate (int __fd, int __mode, __off_t __offset, __off_t __len); # else # ifdef __REDIRECT -extern int __REDIRECT (fallocate, (int __fd, int __mode, __off_t __offset, - __off_t __len), +extern int __REDIRECT (fallocate, (int __fd, int __mode, __off64_t __offset, + __off64_t __len), fallocate64); # else # define fallocate fallocate64 diff --git a/sysdeps/unix/sysv/linux/sparc/bits/fcntl.h b/sysdeps/unix/sysv/linux/sparc/bits/fcntl.h index 2b8c9bd102..dfa848a377 100644 --- a/sysdeps/unix/sysv/linux/sparc/bits/fcntl.h +++ b/sysdeps/unix/sysv/linux/sparc/bits/fcntl.h @@ -278,8 +278,8 @@ extern ssize_t tee (int __fdin, int __fdout, size_t __len, extern int fallocate (int __fd, int __mode, __off_t __offset, __off_t __len); # else # ifdef __REDIRECT -extern int __REDIRECT (fallocate, (int __fd, int __mode, __off_t __offset, - __off_t __len), +extern int __REDIRECT (fallocate, (int __fd, int __mode, __off64_t __offset, + __off64_t __len), fallocate64); # else # define fallocate fallocate64 diff --git a/sysdeps/unix/sysv/linux/x86_64/bits/fcntl.h b/sysdeps/unix/sysv/linux/x86_64/bits/fcntl.h index 29c956cdf8..c3eb859e7d 100644 --- a/sysdeps/unix/sysv/linux/x86_64/bits/fcntl.h +++ b/sysdeps/unix/sysv/linux/x86_64/bits/fcntl.h @@ -273,8 +273,8 @@ extern ssize_t tee (int __fdin, int __fdout, size_t __len, extern int fallocate (int __fd, int __mode, __off_t __offset, __off_t __len); # else # ifdef __REDIRECT -extern int __REDIRECT (fallocate, (int __fd, int __mode, __off_t __offset, - __off_t __len), +extern int __REDIRECT (fallocate, (int __fd, int __mode, __off64_t __offset, + __off64_t __len), fallocate64); # else # define fallocate fallocate64 From 872873d48d5d96879a2dd8c249e688e73a5dd554 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Fri, 6 Nov 2009 09:27:41 -0800 Subject: [PATCH 04/12] Fix R_PPC64_{JMP_IREL,IRELATIVE} handling in dl-conflict.c. I've just committed STT_GNU_IFUNC ppc/ppc64 support into prelink, and this patch is needed on the glibc side. Without it ld.so segfaults, as in dl-conflict.c sym_map is always NULL. While dl-machine.h could use RESOLVE_CONFLICT_FIND_MAP macro to compute it, it doesn't make sense, because with prelink we know it is already properly relocated (all relative relocations are applied by prelink). --- ChangeLog | 5 +++++ sysdeps/powerpc/powerpc64/dl-machine.h | 6 ++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5c4b5d497f..1a44a6ba44 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2009-11-03 Jakub Jelinek + + * sysdeps/powerpc/powerpc64/dl-machine.h (resolve_ifunc): Don't + relocate opd entry when resolving prelink conflicts. + 2009-11-04 Jakub Jelinek * misc/sys/uio.h (preadv, pwritev): Fix type of last argument diff --git a/sysdeps/powerpc/powerpc64/dl-machine.h b/sysdeps/powerpc/powerpc64/dl-machine.h index 8a720ae9c2..00888587af 100644 --- a/sysdeps/powerpc/powerpc64/dl-machine.h +++ b/sysdeps/powerpc/powerpc64/dl-machine.h @@ -531,13 +531,14 @@ auto inline Elf64_Addr __attribute__ ((always_inline)) resolve_ifunc (Elf64_Addr value, const struct link_map *map, const struct link_map *sym_map) { +#ifndef RESOLVE_CONFLICT_FIND_MAP /* The function we are calling may not yet have its opd entry relocated. */ Elf64_FuncDesc opd; if (map != sym_map -#if !defined RTLD_BOOTSTRAP && defined SHARED +# if !defined RTLD_BOOTSTRAP && defined SHARED /* Bootstrap map doesn't have l_relocated set for it. */ && sym_map != &GL(dl_rtld_map) -#endif +# endif && !sym_map->l_relocated) { Elf64_FuncDesc *func = (Elf64_FuncDesc *) value; @@ -546,6 +547,7 @@ resolve_ifunc (Elf64_Addr value, opd.fd_aux = func->fd_aux; value = (Elf64_Addr) &opd; } +#endif return ((Elf64_Addr (*) (void)) value) (); } From 5b55d23611e939340d658f42212c474c8188053e Mon Sep 17 00:00:00 2001 From: Andreas Schwab Date: Fri, 6 Nov 2009 09:29:24 -0800 Subject: [PATCH 05/12] Correct readahead syscall wrapper on powerpc32. Due to alignment of 64bit parameters there is a dummy second argument. But other than that the syscall arguments are directly mapped to the function arguments. --- ChangeLog | 5 +++++ sysdeps/unix/sysv/linux/powerpc/powerpc32/syscalls.list | 3 +++ 2 files changed, 8 insertions(+) diff --git a/ChangeLog b/ChangeLog index 1a44a6ba44..03efd6c504 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2009-11-03 Andreas Schwab + + * sysdeps/unix/sysv/linux/powerpc/powerpc32/syscalls.list: Add + readahead. + 2009-11-03 Jakub Jelinek * sysdeps/powerpc/powerpc64/dl-machine.h (resolve_ifunc): Don't diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/syscalls.list b/sysdeps/unix/sysv/linux/powerpc/powerpc32/syscalls.list index 82025b4855..1233be671a 100644 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/syscalls.list +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/syscalls.list @@ -3,3 +3,6 @@ # System calls with wrappers. oldgetrlimit EXTRA getrlimit i:ip __old_getrlimit getrlimit@GLIBC_2.0 oldsetrlimit EXTRA setrlimit i:ip __old_setrlimit setrlimit@GLIBC_2.0 + +# Due to 64bit alignment there is a dummy second parameter +readahead - readahead i:iiiii __readahead readahead From 8608ae1f7ba31f2149f9620a1339020339eac00d Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Fri, 6 Nov 2009 09:30:56 -0800 Subject: [PATCH 06/12] Properly handle STT_GNU_IFUNC symbols in do_sym. do_sym should use DL_FIXUP_VALUE_XXX macros to call IFUNC function. Otherwise, it won't compile on ia64. This patch fixes it and adds a test. --- ChangeLog | 5 +++++ elf/dl-sym.c | 9 +++++++-- elf/ifuncmain3.c | 9 +++++++++ 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 03efd6c504..a555225823 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2009-11-01 H.J. Lu + + * elf/dl-sym.c (do_sym): Properly handle STT_GNU_IFUNC symbols. + * elf/ifuncmain3.c (main): Test dlopen STT_GNU_IFUNC symbol. + 2009-11-03 Andreas Schwab * sysdeps/unix/sysv/linux/powerpc/powerpc32/syscalls.list: Add diff --git a/elf/dl-sym.c b/elf/dl-sym.c index 459729f0f2..0fa3b3ae47 100644 --- a/elf/dl-sym.c +++ b/elf/dl-sym.c @@ -193,8 +193,13 @@ RTLD_NEXT used in code not dynamically loaded")); /* Resolve indirect function address. */ if (__builtin_expect (ELFW(ST_TYPE) (ref->st_info) == STT_GNU_IFUNC, 0)) - value - = ((DL_FIXUP_VALUE_TYPE (*) (void)) DL_FIXUP_VALUE_ADDR (value)) (); + { + DL_FIXUP_VALUE_TYPE fixup + = DL_FIXUP_MAKE_VALUE (result, (ElfW(Addr)) value); + fixup = + ((DL_FIXUP_VALUE_TYPE (*) (void)) DL_FIXUP_VALUE_ADDR (fixup)) (); + value = (void *) DL_FIXUP_VALUE_CODE_ADDR (fixup); + } #ifdef SHARED /* Auditing checkpoint: we have a new binding. Provide the diff --git a/elf/ifuncmain3.c b/elf/ifuncmain3.c index 5d067cced9..1574dd5cbe 100644 --- a/elf/ifuncmain3.c +++ b/elf/ifuncmain3.c @@ -46,6 +46,15 @@ main (void) return 1; } + p = dlsym (h, "foo"); + if (p == NULL) + { + printf ("symbol not found: %s\n", dlerror ()); + return 1; + } + if ((*p) () != -1) + abort (); + f = dlsym (h, "get_foo_p"); if (f == NULL) { From 685cb08356bb9408c50970711ba3f4726e95b638 Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Fri, 6 Nov 2009 09:32:06 -0800 Subject: [PATCH 07/12] Fix spelling in memusagestat.c --- ChangeLog | 4 ++++ malloc/memusagestat.c | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index a555225823..97bd4533b3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2009-10-30 Holger Hans Peter Freyther + + * malloc/memusagestat.c (main): Fix spelling in an error message. + 2009-11-01 H.J. Lu * elf/dl-sym.c (do_sym): Properly handle STT_GNU_IFUNC symbols. diff --git a/malloc/memusagestat.c b/malloc/memusagestat.c index 4d57f2cc23..a5a315056b 100644 --- a/malloc/memusagestat.c +++ b/malloc/memusagestat.c @@ -181,7 +181,7 @@ main (int argc, char *argv[]) || st.st_size < 2 * sizeof (struct entry)) { close (fd); - error (EXIT_FAILURE, 0, "input file as incorrect size"); + error (EXIT_FAILURE, 0, "input file has incorrect size"); } /* Compute number of data entries. */ total = st.st_size / sizeof (struct entry) - 2; From 868f7a4053502783ab0348736230f093a78f3d46 Mon Sep 17 00:00:00 2001 From: Philippe De Muyter Date: Fri, 6 Nov 2009 09:33:27 -0800 Subject: [PATCH 08/12] Fix spelling of (Newton-)Raphson --- ChangeLog | 5 +++++ sysdeps/powerpc/fpu/e_sqrt.c | 6 +++--- sysdeps/powerpc/fpu/e_sqrtf.c | 6 +++--- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 97bd4533b3..705e83f4b4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2009-11-04 Philippe De Muyter + + * sysdeps/powerpc/fpu/e_sqrt.c: Fix spelling of (Newton-)Raphson. + * sysdeps/powerpc/fpu/e_sqrtf.c: Likewise. + 2009-10-30 Holger Hans Peter Freyther * malloc/memusagestat.c (main): Fix spelling in an error message. diff --git a/sysdeps/powerpc/fpu/e_sqrt.c b/sysdeps/powerpc/fpu/e_sqrt.c index 24e0dd3523..e95b786a00 100644 --- a/sysdeps/powerpc/fpu/e_sqrt.c +++ b/sysdeps/powerpc/fpu/e_sqrt.c @@ -35,7 +35,7 @@ extern const float __t_sqrt[1024]; /* The method is based on a description in Computation of elementary functions on the IBM RISC System/6000 processor, P. W. Markstein, IBM J. Res. Develop, 34(1) 1990. - Basically, it consists of two interleaved Newton-Rhapson approximations, + Basically, it consists of two interleaved Newton-Raphson approximations, one to find the actual square root, and one to find its reciprocal without the expense of a division operation. The tricky bit here is the use of the POWER/PowerPC multiply-add operation to get the @@ -44,7 +44,7 @@ extern const float __t_sqrt[1024]; The argument reduction works by a combination of table lookup to obtain the initial guesses, and some careful modification of the generated guesses (which mostly runs on the integer unit, while the - Newton-Rhapson is running on the FPU). */ + Newton-Raphson is running on the FPU). */ #ifdef __STDC__ double @@ -102,7 +102,7 @@ __slow_ieee754_sqrt (x) /* complete the INSERT_WORDS (sx, sxi, xi1) operation. */ sx = iw_u.value; - /* Here we have three Newton-Rhapson iterations each of a + /* Here we have three Newton-Raphson iterations each of a division and a square root and the remainder of the argument reduction, all interleaved. */ sd = -(sg * sg - sx); diff --git a/sysdeps/powerpc/fpu/e_sqrtf.c b/sysdeps/powerpc/fpu/e_sqrtf.c index 8e8138a17d..ca44fac559 100644 --- a/sysdeps/powerpc/fpu/e_sqrtf.c +++ b/sysdeps/powerpc/fpu/e_sqrtf.c @@ -35,7 +35,7 @@ extern const float __t_sqrt[1024]; /* The method is based on a description in Computation of elementary functions on the IBM RISC System/6000 processor, P. W. Markstein, IBM J. Res. Develop, 34(1) 1990. - Basically, it consists of two interleaved Newton-Rhapson approximations, + Basically, it consists of two interleaved Newton-Raphson approximations, one to find the actual square root, and one to find its reciprocal without the expense of a division operation. The tricky bit here is the use of the POWER/PowerPC multiply-add operation to get the @@ -44,7 +44,7 @@ extern const float __t_sqrt[1024]; The argument reduction works by a combination of table lookup to obtain the initial guesses, and some careful modification of the generated guesses (which mostly runs on the integer unit, while the - Newton-Rhapson is running on the FPU). */ + Newton-Raphson is running on the FPU). */ #ifdef __STDC__ float @@ -90,7 +90,7 @@ __slow_ieee754_sqrtf (x) sg = t_sqrt[0]; sy = t_sqrt[1]; - /* Here we have three Newton-Rhapson iterations each of a + /* Here we have three Newton-Raphson iterations each of a division and a square root and the remainder of the argument reduction, all interleaved. */ sd = -(sg * sg - sx); From 639d6699e9943c393f5fb5a9b84ab24e20bb7a93 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Fri, 6 Nov 2009 09:34:23 -0800 Subject: [PATCH 09/12] Fix up whitespaces. --- elf/dl-sym.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/elf/dl-sym.c b/elf/dl-sym.c index 0fa3b3ae47..4faf05c00b 100644 --- a/elf/dl-sym.c +++ b/elf/dl-sym.c @@ -196,7 +196,7 @@ RTLD_NEXT used in code not dynamically loaded")); { DL_FIXUP_VALUE_TYPE fixup = DL_FIXUP_MAKE_VALUE (result, (ElfW(Addr)) value); - fixup = + fixup = ((DL_FIXUP_VALUE_TYPE (*) (void)) DL_FIXUP_VALUE_ADDR (fixup)) (); value = (void *) DL_FIXUP_VALUE_CODE_ADDR (fixup); } From 6515a01fc1d35d329886d5a45435537ee9115bc4 Mon Sep 17 00:00:00 2001 From: Caolan McNamara Date: Tue, 10 Nov 2009 06:29:13 -0800 Subject: [PATCH 10/12] Avoid memset warning in one case. --- ChangeLog | 5 +++++ string/bits/string3.h | 5 +++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 705e83f4b4..ac8baf13be 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2009-11-10 Ulrich Drepper + + * string/bits/string3.h (memset): If the second parameter is constant + and zero there is likely no transposition. + 2009-11-04 Philippe De Muyter * sysdeps/powerpc/fpu/e_sqrt.c: Fix spelling of (Newton-)Raphson. diff --git a/string/bits/string3.h b/string/bits/string3.h index a5593e3b89..1d759f181b 100644 --- a/string/bits/string3.h +++ b/string/bits/string3.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2004, 2005, 2007 Free Software Foundation, Inc. +/* Copyright (C) 2004, 2005, 2007, 2009 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 @@ -77,7 +77,8 @@ __NTH (mempcpy (void *__restrict __dest, __const void *__restrict __src, __extern_always_inline void * __NTH (memset (void *__dest, int __ch, size_t __len)) { - if (__builtin_constant_p (__len) && __len == 0) + if (__builtin_constant_p (__len) && __len == 0 + && (!__builtin_constant_p (__ch) || __ch != 0)) { __warn_memset_zero_len (); return __dest; From 51e4196f16a2d98377e3c481a44e133369dc7669 Mon Sep 17 00:00:00 2001 From: Andreas Schwab Date: Tue, 10 Nov 2009 07:36:50 -0800 Subject: [PATCH 11/12] Handle running out of buffer space with IPv6 mapping enabled. With big DNS answers like the one you get for goodtimesdot.com you can get a truncated address list if IPv6 mapping is enabled. Instead tell the caller to resize the buffer. --- ChangeLog | 8 ++++++++ resolv/mapv4v6hostent.h | 12 +++++------- resolv/nss_dns/dns-host.c | 6 ++++-- 3 files changed, 17 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index ac8baf13be..49c2e08a4a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,7 +1,15 @@ +2009-11-10 Andreas Schwab + + * resolv/mapv4v6hostent.h (map_v4v6_hostent): Return non-zero if + out of buffer space. + * resolv/nss_dns/dns-host.c (getanswer_r): Check for + map_v4v6_hostent running out of space. + 2009-11-10 Ulrich Drepper * string/bits/string3.h (memset): If the second parameter is constant and zero there is likely no transposition. + Patch by Caolan McNamara diff --git a/resolv/mapv4v6hostent.h b/resolv/mapv4v6hostent.h index 4151ce3639..c11038adf3 100644 --- a/resolv/mapv4v6hostent.h +++ b/resolv/mapv4v6hostent.h @@ -57,13 +57,13 @@ typedef union { char ac; } align; -static void +static int map_v4v6_hostent (struct hostent *hp, char **bpp, int *lenp) { char **ap; if (hp->h_addrtype != AF_INET || hp->h_length != INADDRSZ) - return; + return 0; hp->h_addrtype = AF_INET6; hp->h_length = IN6ADDRSZ; for (ap = hp->h_addr_list; *ap; ap++) @@ -71,11 +71,8 @@ map_v4v6_hostent (struct hostent *hp, char **bpp, int *lenp) int i = sizeof (align) - ((u_long) *bpp % sizeof (align)); if (*lenp < (i + IN6ADDRSZ)) - { - /* Out of memory. Truncate address list here. XXX */ - *ap = NULL; - return; - } + /* Out of memory. */ + return 1; *bpp += i; *lenp -= i; map_v4v6_address (*ap, *bpp); @@ -83,4 +80,5 @@ map_v4v6_hostent (struct hostent *hp, char **bpp, int *lenp) *bpp += IN6ADDRSZ; *lenp -= IN6ADDRSZ; } + return 0; } diff --git a/resolv/nss_dns/dns-host.c b/resolv/nss_dns/dns-host.c index 62e67e8b01..818a40a898 100644 --- a/resolv/nss_dns/dns-host.c +++ b/resolv/nss_dns/dns-host.c @@ -878,7 +878,8 @@ getanswer_r (const querybuf *answer, int anslen, const char *qname, int qtype, } bp += n; linebuflen -= n; - map_v4v6_hostent (result, &bp, &linebuflen); + if (map_v4v6_hostent (result, &bp, &linebuflen)) + goto too_small; } *h_errnop = NETDB_SUCCESS; return NSS_STATUS_SUCCESS; @@ -953,7 +954,8 @@ getanswer_r (const querybuf *answer, int anslen, const char *qname, int qtype, } if (have_to_map) - map_v4v6_hostent (result, &bp, &linebuflen); + if (map_v4v6_hostent (result, &bp, &linebuflen)) + goto too_small; *h_errnop = NETDB_SUCCESS; return NSS_STATUS_SUCCESS; } From 24c0bf7a76ecec65aca0dbce1f7ebb8f68425dc2 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Thu, 12 Nov 2009 08:46:19 -0800 Subject: [PATCH 12/12] Start 2.12 development. --- ChangeLog | 4 ++++ version.h | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 49c2e08a4a..743121f7ad 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2009-11-12 Ulrich Drepper + + * version.h: Bump for 2.12 development. + 2009-11-10 Andreas Schwab * resolv/mapv4v6hostent.h (map_v4v6_hostent): Return non-zero if diff --git a/version.h b/version.h index e44ecd4a19..db60a0c44e 100644 --- a/version.h +++ b/version.h @@ -1,4 +1,4 @@ /* This file just defines the current version number of libc. */ -#define RELEASE "stable" -#define VERSION "2.11" +#define RELEASE "development" +#define VERSION "2.11.90"