Skip to content

Commit

Permalink
Backported selected fixes from 2007-05-{17,18,21}.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jakub Jelinek committed May 21, 2007
1 parent 473e6b3 commit 75831cc
Show file tree
Hide file tree
Showing 27 changed files with 422 additions and 70 deletions.
55 changes: 55 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,58 @@
2007-05-21 Ulrich Drepper <drepper@redhat.com>

* sysdeps/unix/sysv/linux/i386/epoll_pwait.S: New file.

2007-05-21 Jakub Jelinek <jakub@redhat.com>

[BZ #4525]
* sysdeps/unix/sysv/linux/Makefile (sysdep_routines): Add epoll_pwait.
* sysdeps/unix/sysv/linux/epoll_pwait.c: New file.
* sysdeps/unix/sysv/linux/syscalls.list (epoll_pwait): Remove.

* sysdeps/unix/sysv/linux/x86_64/sys/epoll.h (epoll_pwait): Declare.

[BZ #4514]
* stdio-common/vfprintf.c (vfprintf): Don't shadow workstart variable,
reinitialize workend at the start of each do_positional format spec
loop, free workstart before do_positional loops.
(printf_unknown): Fix size of work_buffer.
* stdio-common/tst-sprintf.c (main): Add 3 new testcases.

* malloc/hooks.c (MALLOC_STATE_VERSION): Bump.
(public_sET_STATe): If ms->version < 3, put all chunks into
unsorted chunks and clear {fd,bk}_nextsize fields of largebin
chunks.

* malloc/malloc.c [MALLOC_DEBUG]: Revert 2007-05-13 changes.
* malloc/hooks.c: Likewise.
* malloc/arena.c: Likewise.
* malloc/malloc.c (do_check_malloc_state): Don't assert
n_mmaps is not greater than n_mmaps_max. This removes the need
for the previous change.

* malloc/Makefile (CFLAGS-malloc.c): Revert accidental
2007-05-07 commit.

2007-05-18 Ulrich Drepper <drepper@redhat.com>

* malloc/malloc.c (do_check_chunk): Correct check for mmaped block
not overlapping with arena.

* malloc/mcheck.c (reallochook): If size==0, free the block.

* rt/tst-shm.c: Use fstat64 instead of fstat.

* sysdeps/unix/sysv/linux/i386/sync_file_range.S: Fix case where
__NR_sync_file_range is not defined.

2007-05-17 Ulrich Drepper <drepper@redhat.com>

Dummy files to prevent stub versions from being used.
* sysdeps/x86_64/fpu/k_cosl.c: New file.
* sysdeps/x86_64/fpu/k_rem_pio2l.c: New file.
* sysdeps/x86_64/fpu/k_sinl.c: New file.
* sysdeps/x86_64/fpu/k_tanl.c: New file.

2007-05-14 Ulrich Drepper <drepper@redhat.com>

* version.h (VERSION): Define to 6.
Expand Down
11 changes: 9 additions & 2 deletions fedora/glibc.spec.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
%define glibcrelease 1
%define glibcrelease 2
%define auxarches i586 i686 athlon sparcv9 alphaev6
%define xenarches i686 athlon
%ifarch %{xenarches}
Expand Down Expand Up @@ -1561,7 +1561,14 @@ rm -f *.filelist*
%endif

%changelog
* Tue May 15 2007 Roland McGrath <roland@redhat.com> - 2.6-1
* Mon May 21 2007 Jakub Jelinek <jakub@redhat.com> 2.6-2
- restore malloc_set_state backwards compatibility (#239344)
- fix epoll_pwait (BZ#4525)
- fix printf with unknown format spec or positional arguments
and large width and/or precision (BZ#4514)
- robust mutexes fix (BZ#4512)

* Tue May 15 2007 Roland McGrath <roland@redhat.com> 2.6-1
- glibc 2.6 release

* Fri May 11 2007 Jakub Jelinek <jakub@redhat.com> 2.5.90-24
Expand Down
1 change: 0 additions & 1 deletion malloc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ $(objpfx)memusagestat: $(memusagestat-modules:%=$(objpfx)%.o)
include ../Rules

CFLAGS-mcheck-init.c = $(PIC-ccflag)
CFLAGS-malloc.c += -DMALLOC_DEBUG

$(objpfx)libmcheck.a: $(objpfx)mcheck-init.o
-rm -f $@
Expand Down
3 changes: 0 additions & 3 deletions malloc/arena.c
Original file line number Diff line number Diff line change
Expand Up @@ -370,9 +370,6 @@ ptmalloc_init_minimal (void)
mp_.top_pad = DEFAULT_TOP_PAD;
#endif
mp_.n_mmaps_max = DEFAULT_MMAP_MAX;
#if MALLOC_DEBUG
mp_.n_mmaps_cmax = DEFAULT_MMAP_MAX;
#endif
mp_.mmap_threshold = DEFAULT_MMAP_THRESHOLD;
mp_.trim_threshold = DEFAULT_TRIM_THRESHOLD;
mp_.pagesize = malloc_getpagesize;
Expand Down
27 changes: 15 additions & 12 deletions malloc/hooks.c
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@ free_starter(mem, caller) Void_t* mem; const Void_t *caller;
then the hooks are reset to 0. */

#define MALLOC_STATE_MAGIC 0x444c4541l
#define MALLOC_STATE_VERSION (0*0x100l + 2l) /* major*0x100 + minor */
#define MALLOC_STATE_VERSION (0*0x100l + 3l) /* major*0x100 + minor */

struct malloc_save_state {
long magic;
Expand All @@ -507,9 +507,6 @@ struct malloc_save_state {
unsigned long trim_threshold;
unsigned long top_pad;
unsigned int n_mmaps_max;
#if MALLOC_DEBUG
unsigned int n_mmaps_cmax;
#endif
unsigned long mmap_threshold;
int check_action;
unsigned long max_sbrked_mem;
Expand Down Expand Up @@ -553,9 +550,6 @@ public_gET_STATe(void)
ms->trim_threshold = mp_.trim_threshold;
ms->top_pad = mp_.top_pad;
ms->n_mmaps_max = mp_.n_mmaps_max;
#if MALLOC_DEBUG
ms->n_mmaps_cmax = mp_.n_mmaps_cmax;
#endif
ms->mmap_threshold = mp_.mmap_threshold;
ms->check_action = check_action;
ms->max_sbrked_mem = main_arena.max_system_mem;
Expand Down Expand Up @@ -601,8 +595,9 @@ public_sET_STATe(Void_t* msptr)
assert(ms->av[2*i+3] == 0);
first(b) = last(b) = b;
} else {
if(i<NSMALLBINS || (largebin_index(chunksize(ms->av[2*i+2]))==i &&
largebin_index(chunksize(ms->av[2*i+3]))==i)) {
if(ms->version >= 3 &&
(i<NSMALLBINS || (largebin_index(chunksize(ms->av[2*i+2]))==i &&
largebin_index(chunksize(ms->av[2*i+3]))==i))) {
first(b) = ms->av[2*i+2];
last(b) = ms->av[2*i+3];
/* Make sure the links to the bins within the heap are correct. */
Expand All @@ -622,14 +617,22 @@ public_sET_STATe(Void_t* msptr)
}
}
}
if (ms->version < 3) {
/* Clear fd_nextsize and bk_nextsize fields. */
b = unsorted_chunks(&main_arena)->fd;
while (b != unsorted_chunks(&main_arena)) {
if (!in_smallbin_range(chunksize(b))) {
b->fd_nextsize = NULL;
b->bk_nextsize = NULL;
}
b = b->fd;
}
}
mp_.sbrk_base = ms->sbrk_base;
main_arena.system_mem = ms->sbrked_mem_bytes;
mp_.trim_threshold = ms->trim_threshold;
mp_.top_pad = ms->top_pad;
mp_.n_mmaps_max = ms->n_mmaps_max;
#if MALLOC_DEBUG
mp_.n_mmaps_cmax = ms->n_mmaps_cmax;
#endif
mp_.mmap_threshold = ms->mmap_threshold;
check_action = ms->check_action;
main_arena.max_system_mem = ms->max_sbrked_mem;
Expand Down
30 changes: 3 additions & 27 deletions malloc/malloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -2358,9 +2358,6 @@ struct malloc_par {
/* Memory map support */
int n_mmaps;
int n_mmaps_max;
#if MALLOC_DEBUG
int n_mmaps_cmax;
#endif
int max_n_mmaps;
/* the mmap_threshold is dynamic, until the user sets
it manually, at which point we need to disable any
Expand Down Expand Up @@ -2572,7 +2569,7 @@ static void do_check_chunk(av, p) mstate av; mchunkptr p;
#if HAVE_MMAP
/* address is outside main heap */
if (contiguous(av) && av->top != initial_top(av)) {
assert(((char*)p) < min_address || ((char*)p) > max_address);
assert(((char*)p) < min_address || ((char*)p) >= max_address);
}
/* chunk is page-aligned */
assert(((p->prev_size + sz) & (mp_.pagesize-1)) == 0);
Expand Down Expand Up @@ -2876,8 +2873,6 @@ static void do_check_malloc_state(mstate av)
assert(total <= (unsigned long)(mp_.max_total_mem));
assert(mp_.n_mmaps >= 0);
#endif
assert(mp_.n_mmaps <= mp_.n_mmaps_cmax);
assert(mp_.n_mmaps_max <= mp_.n_mmaps_cmax);
assert(mp_.n_mmaps <= mp_.max_n_mmaps);

assert((unsigned long)(av->system_mem) <=
Expand Down Expand Up @@ -3475,13 +3470,6 @@ munmap_chunk(p) mchunkptr p;
}

mp_.n_mmaps--;
#if MALLOC_DEBUG
if (mp_.n_mmaps_cmax > mp_.n_mmaps_max)
{
assert (mp_.n_mmaps_cmax == mp_.n_mmaps + 1);
mp_.n_mmaps_cmax = mp_.n_mmaps;
}
#endif
mp_.mmapped_mem -= total_size;

int ret __attribute__ ((unused)) = munmap((char *)block, total_size);
Expand Down Expand Up @@ -5397,9 +5385,6 @@ mstate av; size_t n_elements; size_t* sizes; int opts; Void_t* chunks[];
mp_.n_mmaps_max = 0;
mem = _int_malloc(av, size);
mp_.n_mmaps_max = mmx; /* reset mmap */
#if MALLOC_DEBUG
mp_.n_mmaps_cmax = mmx;
#endif
if (mem == 0)
return 0;

Expand Down Expand Up @@ -5725,17 +5710,8 @@ int mALLOPt(param_number, value) int param_number; int value;
res = 0;
else
#endif
{
#if MALLOC_DEBUG
if (mp_.n_mmaps <= value)
mp_.n_mmaps_cmax = value;
else
mp_.n_mmaps_cmax = mp_.n_mmaps;
#endif

mp_.n_mmaps_max = value;
mp_.no_dyn_threshold = 1;
}
mp_.n_mmaps_max = value;
mp_.no_dyn_threshold = 1;
break;

case M_CHECK_ACTION:
Expand Down
8 changes: 7 additions & 1 deletion malloc/mcheck.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* Standard debugging hooks for `malloc'.
Copyright (C) 1990-1997,99,2000,01,02 Free Software Foundation, Inc.
Copyright (C) 1990-1997,1999,2000-2002,2007 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written May 1989 by Mike Haertel.
Expand Down Expand Up @@ -280,6 +280,12 @@ memalignhook (__malloc_size_t alignment, __malloc_size_t size,
static __ptr_t
reallochook (__ptr_t ptr, __malloc_size_t size, const __ptr_t caller)
{
if (size == 0)
{
freehook (ptr, caller);
return NULL;
}

struct hdr *hdr;
__malloc_size_t osize;

Expand Down
13 changes: 13 additions & 0 deletions nptl/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
2007-05-17 Ulrich Drepper <drepper@redhat.com>

[BZ #4512]
* pthread_mutex_lock.c: Preserve FUTEX_WAITERS bit when dead owner
is detected.
* pthread_mutex_timedlock.c: Likewise.
* pthread_mutex_trylock.c: Likewise.
Patch in part by Atsushi Nemoto <anemo@mba.ocn.ne.jp>.

* Makefile (tests): Add tst-robust9 and tst-robustpi9.
* tst-robust9.c: New file.
* tst-robustpi9.c: New file.

2007-05-14 Ulrich Drepper <drepper@redhat.com>

* sysdeps/unix/sysv/linux/x86_64/sem_wait.S: Remove unnecessary
Expand Down
8 changes: 4 additions & 4 deletions nptl/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (C) 2002,2003,2004,2005,2006 Free Software Foundation, Inc.
# Copyright (C) 2002,2003,2004,2005,2006,2007 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 @@ -209,9 +209,9 @@ tests = tst-typesizes \
tst-cond14 tst-cond15 tst-cond16 tst-cond17 tst-cond18 tst-cond19 \
tst-cond20 tst-cond21 tst-cond22 \
tst-robust1 tst-robust2 tst-robust3 tst-robust4 tst-robust5 \
tst-robust6 tst-robust7 tst-robust8 \
tst-robustpi1 tst-robustpi2 tst-robustpi3 tst-robustpi4 \
tst-robustpi5 tst-robustpi6 tst-robustpi7 tst-robustpi8 \
tst-robust6 tst-robust7 tst-robust8 tst-robust9 \
tst-robustpi1 tst-robustpi2 tst-robustpi3 tst-robustpi4 tst-robustpi5 \
tst-robustpi6 tst-robustpi7 tst-robustpi8 tst-robustpi9 \
tst-rwlock1 tst-rwlock2 tst-rwlock3 tst-rwlock4 tst-rwlock5 \
tst-rwlock6 tst-rwlock7 tst-rwlock8 tst-rwlock9 tst-rwlock10 \
tst-rwlock11 tst-rwlock12 tst-rwlock13 tst-rwlock14 \
Expand Down
4 changes: 3 additions & 1 deletion nptl/pthread_mutex_lock.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
/* Copyright (C) 2002,2003,2004,2005,2006,2007 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
Expand Down Expand Up @@ -127,6 +127,8 @@ __pthread_mutex_lock (mutex)
int newval = id;
#ifdef NO_INCR
newval |= FUTEX_WAITERS;
#else
newval |= (oldval & FUTEX_WAITERS);
#endif

newval
Expand Down
8 changes: 5 additions & 3 deletions nptl/pthread_mutex_timedlock.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
/* Copyright (C) 2002,2003,2004,2005,2006,2007 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
Expand Down Expand Up @@ -119,9 +119,11 @@ pthread_mutex_timedlock (mutex, abstime)
if ((oldval & FUTEX_OWNER_DIED) != 0)
{
/* The previous owner died. Try locking the mutex. */
int newval
int newval = id | (oldval & FUTEX_WAITERS);

newval
= atomic_compare_and_exchange_val_acq (&mutex->__data.__lock,
id, oldval);
newval, oldval);
if (newval != oldval)
{
oldval = newval;
Expand Down
6 changes: 4 additions & 2 deletions nptl/pthread_mutex_trylock.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,11 @@ __pthread_mutex_trylock (mutex)
if ((oldval & FUTEX_OWNER_DIED) != 0)
{
/* The previous owner died. Try locking the mutex. */
int newval
int newval = id | (oldval & FUTEX_WAITERS);

newval
= atomic_compare_and_exchange_val_acq (&mutex->__data.__lock,
id, oldval);
newval, oldval);

if (newval != oldval)
{
Expand Down
Loading

0 comments on commit 75831cc

Please sign in to comment.