Skip to content

Commit

Permalink
Merge remote branch 'origin/master' into fedora/master
Browse files Browse the repository at this point in the history
  • Loading branch information
Andreas Schwab committed Nov 12, 2009
2 parents dcdbf85 + 24c0bf7 commit b975c92
Show file tree
Hide file tree
Showing 26 changed files with 163 additions and 62 deletions.
66 changes: 66 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,69 @@
2009-11-12 Ulrich Drepper <drepper@redhat.com>

* version.h: Bump for 2.12 development.

2009-11-10 Andreas Schwab <schwab@redhat.com>

* 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 <drepper@redhat.com>

* string/bits/string3.h (memset): If the second parameter is constant
and zero there is likely no transposition.
Patch by Caolan McNamara <caolanm@redhat.com.

2009-11-04 Philippe De Muyter <phdm@macqel.be>

* 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 <zecke@selfish.org>

* malloc/memusagestat.c (main): Fix spelling in an error message.

2009-11-01 H.J. Lu <hongjiu.lu@intel.com>

* 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 <schwab@redhat.com>

* sysdeps/unix/sysv/linux/powerpc/powerpc32/syscalls.list: Add
readahead.

2009-11-03 Jakub Jelinek <jakub@redhat.com>

* sysdeps/powerpc/powerpc64/dl-machine.h (resolve_ifunc): Don't
relocate opd entry when resolving prelink conflicts.

2009-11-04 Jakub Jelinek <jakub@redhat.com>

* 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 <schwab@linux-m68k.org>

[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 <drepper@redhat.com>

* malloc/hooks.c (free_check): Restore locking and call _int_free
appropriately.

2009-10-30 Ulrich Drepper <drepper@redhat.com>

* version.h (VERSION): Bump for 2.11 release.
Expand Down
9 changes: 7 additions & 2 deletions elf/dl-sym.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 9 additions & 0 deletions elf/ifuncmain3.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
37 changes: 20 additions & 17 deletions malloc/hooks.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) )) ||
sz<MINSIZE || sz&MALLOC_ALIGN_MASK || !inuse(p) ||
( !prev_inuse(p) && (p->prev_size&MALLOC_ALIGN_MASK ||
(contig && (char*)prev_chunk(p)<mp_.sbrk_base) ||
next_chunk(prev_chunk(p))!=p) ))
(contig && (char*)prev_chunk(p)<mp_.sbrk_base) ||
next_chunk(prev_chunk(p))!=p) ))
return NULL;
magic = MAGICBYTE(p);
for(sz += SIZE_SZ-1; (c = ((unsigned char*)p)[sz]) != magic; sz -= c) {
Expand All @@ -177,9 +177,9 @@ mem2chunk_check(mem, magic_p) Void_t* mem; unsigned char **magic_p;
first. */
offset = (unsigned long)mem & page_mask;
if((offset!=MALLOC_ALIGNMENT && offset!=0 && offset!=0x10 &&
offset!=0x20 && offset!=0x40 && offset!=0x80 && offset!=0x100 &&
offset!=0x200 && offset!=0x400 && offset!=0x800 && offset!=0x1000 &&
offset<0x2000) ||
offset!=0x20 && offset!=0x40 && offset!=0x80 && offset!=0x100 &&
offset!=0x200 && offset!=0x400 && offset!=0x800 && offset!=0x1000 &&
offset<0x2000) ||
!chunk_is_mmapped(p) || (p->size & PREV_INUSE) ||
( (((unsigned long)p - p->prev_size) & page_mask) != 0 ) ||
( (sz = chunksize(p)), ((p->prev_size + sz) & page_mask) != 0 ) )
Expand Down Expand Up @@ -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;
}
Expand All @@ -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*
Expand Down Expand Up @@ -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 {
Expand All @@ -367,7 +370,7 @@ realloc_check(oldmem, bytes, caller)
nb = chunksize(newp);
if(oldp<newp || 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));
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion malloc/memusagestat.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions misc/sys/uio.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 7 additions & 0 deletions nptl/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
2009-11-03 Andreas Schwab <schwab@linux-m68k.org>

[BZ #4457]
* sysdeps/pthread/unwind-resume.c: Include <libgcc_s.h> and use
LIBGCC_S_SO.
* sysdeps/pthread/unwind-forcedunwind.c: Likewise.

2009-10-30 Ulrich Drepper <drepper@redhat.com>

* tst-sem11.c (main): Rewrite to avoid aliasing problems.
Expand Down
5 changes: 3 additions & 2 deletions nptl/sysdeps/pthread/unwind-forcedunwind.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include <unwind.h>
#include <pthreadP.h>
#include <sysdep.h>
#include <libgcc_s.h>

static void *libgcc_s_handle;
static void (*libgcc_s_resume) (struct _Unwind_Exception *exc);
Expand Down Expand Up @@ -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
Expand All @@ -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;
Expand Down
5 changes: 3 additions & 2 deletions nptl/sysdeps/pthread/unwind-resume.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include <dlfcn.h>
#include <stdio.h>
#include <unwind.h>
#include <libgcc_s.h>

static void (*libgcc_s_resume) (struct _Unwind_Exception *exc);
static _Unwind_Reason_Code (*libgcc_s_personality)
Expand All @@ -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;
Expand Down
12 changes: 5 additions & 7 deletions resolv/mapv4v6hostent.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,30 +57,28 @@ 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++)
{
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);
*ap = *bpp;
*bpp += IN6ADDRSZ;
*lenp -= IN6ADDRSZ;
}
return 0;
}
6 changes: 4 additions & 2 deletions resolv/nss_dns/dns-host.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
Expand Down
5 changes: 3 additions & 2 deletions string/bits/string3.h
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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;
Expand Down
3 changes: 2 additions & 1 deletion sysdeps/generic/framestate.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#define __frame_state_for fallback_frame_state_for
#include <unwind-dw2.c>
#undef __frame_state_for
#include <libgcc_s.h>

typedef struct frame_state * (*framesf)(void *pc, struct frame_state *);
struct frame_state *__frame_state_for (void *pc,
Expand All @@ -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
Expand Down
2 changes: 2 additions & 0 deletions sysdeps/generic/libgcc_s.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/* Name of libgcc_s library provided by gcc. */
#define LIBGCC_S_SO "libgcc_s.so.1"
Loading

0 comments on commit b975c92

Please sign in to comment.