* malloc/malloc.c (sYSMALLOc): Only call grow_heap if
(long) (MINSIZE + nb - old_size) is positive.
* malloc/arena.c (grow_heap): When growing bail even if new_size
is negative.
ld.so.
* malloc/malloc.c (_int_malloc): Use full list insert and not
shortcut which assumes the list is empty for large requests
too.
* elf/tst-addr1.c (do_test): Allow i.dli_sname "_IO_printf".
2006-08-27 Ulrich Drepper <drepper@redhat.com>
[BZ #2684]
* malloc/malloc.c (public_rEALLOc): Try harder by using other
arenas if allocation failed.
Patch mostly by Jan Edler <jan.edler@indexengines.com>.
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.
platforms define as 1MB. For 64-bit platforms as 32MB. The lower
limit is needed to avoid the exploding of the address space
requirement for secondary heaps.
* malloc/arena.c (HEAP_MAX_SIZE): Define using
DEFAULT_MMAP_THRESHOLD_MAX if it is defined.
* sysdeps/mach/hurd/fchmodat.c: New file.
* sysdeps/mach/hurd/fchownat.c: New file.
* sysdeps/mach/hurd/fxstatat.c: New file.
* sysdeps/mach/hurd/fxstatat64.c: New file.
* sysdeps/mach/hurd/linkat.c: New file.
* sysdeps/mach/hurd/mkdirat.c: New file.
* sysdeps/mach/hurd/openat.c: New file.
* sysdeps/mach/hurd/openat64.c: New file.
* sysdeps/mach/hurd/symlinkat.c: New file.
* sysdeps/mach/hurd/unlinkat.c: New file.
* sysdeps/mach/hurd/xmknod.c (__xmknod): Just call __xmknodat.
Guts move to ...
* sysdeps/mach/hurd/xmknodat.c: ... here, new file.
* hurd/lookup-at.c: New file.
* hurd/Makefile (routines): Add it.
* hurd/hurd/fd.h: Declare __file_name_lookup_at,
__file_name_split_at and __directory_name_split_at.
* hurd/hurd/lookup.h: Declare {,__}hurd_directory_name_split.
* hurd/hurdlookup.c (__hurd_directory_name_split): Use __memrchr
unconditionally.
* sysdeps/mach/hurd/open.c: Define {,__,__libc_,}open64 as aliases.
* sysdeps/mach/hurd/open64.c: New file.
The correct value differs only on powerpc32, and for now changing it
there is causing more trouble than it's worth.
* malloc/arena.c: Add compile-time sanity check on padding calculation.
2006-03-05 Jakub Jelinek <jakub@redhat.com>
* malloc/arena.c (heap_info): Adjust the padding size if
MALLOC_ALIGNMENT > 2 * SIZE_SZ.
2005-10-14 Paul Eggert <eggert@cs.ucla.edu>
* malloc/obstack.c: Fix old comments. Update FSF snail mail address.
* malloc/obstack.h: Likewise.
[BZ #321]
Fix portability bugs encountered when porting to Itanium.
* malloc/obstack.h (obstack_empty_p, obstack_finish): Do not
assume that the "contents" member is suitably aligned. It is
not, for some hosts and alignments: e.g., Itanium, long-double.
* malloc/obstack.c (_obstack_begin, _obstack_begin_1,
_obstack_newchunk): Likewise.
* malloc/obstack.c: Include <stddef.h>, for size_t.
Include <inttypes.h>, <stdint.h> if needed and available.
(DEFAULT_ALIGNMENT): Now an enum constant, not a macro.
Use C89 offsetof rather than K&R trick.
Use the maximum alignment of uintmax_t, long double, void *
rather than the alignment of double.
(union fooround): Use uintmax_t, long double, void * members
rather than just long and double.
[BZ #321]
Fix portability bugs encountered when porting to the IBM iSeries,
where pointers are 256 bits wide and no integers are that wide.
* malloc/obstack.h (__PTR_TO_INT, __INT_TO_PTR): Remove.
All uses changed to:
(__BPTR_ALIGN, __PTR_ALIGN): New macros.
(struct _obstack_chunk.temp): Change from int to a union
of pointer and int. All uses changed.
[BZ #321]
* malloc/obstack.c (print_and_abort) [!_LIBC]:
Call fprintf (stderr, ...), not __fxprintf (NULL, ...).
[_LIBC && USE_IN_LIBIO]: Don't include <wchar.h>; no longer needed.
__alloc_dir.
(__alloc_dir): Only close descriptor on error if new parameter is true.
* sysdeps/unix/fdopendir.c (fdopendir): Pass extra argument to
__alloc_dir. Don't close fd on error.
* include/dirent.h (__alloc_dir): Adjust prototype.
* include/sys/mman.h (__mremap): Add ellipsis.
* malloc/memusage.c: Adjust mremap wrapper for optional additional
parameter.
* malloc/malloc.c (struct malloc_state): Replace max_fast with flags
fields.
(global_max_fast): New variable.
(set_max_fast): Change to not require arena parameter and to modify
global_max_fast. Change all callers.
(get_max_fast): New macro. Use this instead of directly accessing
now removed max_fast arena member.
(have_fastchunks): Use flags instead of max_fast.
(clear_fastchunks): Likewise.
(set_fastchunks): Likewise.
(contiguous): Likewise.
(noncontiguous): Likewise.
(set_noncontiguous): Likewise.
(set_contiguous): Likewise.
(malloc_init_state): Explicitly set FASTCHUNKS_BIT. Call set_max_fast
only for main arena.
* malloc/hooks.c (public_sET_STATe): Adjust set_max_fast use.
check_arrival_add_next_nodes): Avoid using uninitialized variable.
* malloc/memusage.c (dest): Fix a bunch of warnings on 32-bit arches.
* sysdeps/i386/fpu/libm-test-ulps: Update for GCC 4.0.x.
* malloc/arena.c (ptmalloc_lock_all): If global lock already taken
by the same thread, just bump the counter.
(ptmalloc_unlock_all): If counter for recursive locks hasn't reached
zero, don't do anything else.
* malloc/Makefile (tests): Add tst-mallocfork.
* malloc/tst-mallocfork.c: New file.
2005-08-17 Robert Love <rml@novell.com>
* sysdeps/unix/sysv/linux/sys/inotify.h: Add IN_MOVE_SELF event.
2005-08-19 Bruno Haible <bruno@clisp.org>
* intl/localealias.c (read_alias_file): In case of failure, close the
file descriptor and sort the array before returning.
2005-08-19 Ulrich Drepper <drepper@redhat.com>
* malloc/Makefile: Link libmemusage.so with ld.so.
* malloc/memusage.c: Use atomic operations for all counter and size
computations. Handle thread stacks.
* sysdeps/generic/memusage.h: Define memusage_cntr_t and
memusage_size_t.
* sysdeps/i386/i686/memusage.h: New file.
* include/atomic.h: Define atomic_max and atomic_min.
* debug/tst-chk1.c: Add tests for mbstowcs and wcstombs.
(_dl_close): If called recursively, just remember GC needs to be rerun
and decrease l_direct_opencount. Avoid GC if l_direct_opencount
decreased to 1. Rerun GC at the end if any destructor unloaded some
additional libraries.
* elf/Makefile: Add rules to build and run unload6 test.
* elf/unload6.c: New test.
* elf/unload6mod1.c: New file.
* elf/unload6mod2.c: New file.
* elf/unload6mod3.c: New file.
* malloc/hooks.c (mem2chunk_check): Add magic_p argument, set *magic_p
if magic_p is not NULL.
(top_check): Invoke MALLOC_FAILURE_ACTION if MORECORE failed.
(malloc_check): Fail if sz == -1.
(free_check): Adjust mem2chunk_check caller.
(realloc_check): Likewise. Fail if bytes == -1. If bytes == 0 and
oldmem != NULL, call free_check and return NULL. If reallocating
and returning NULL, invert magic byte again to make oldmem valid
region for further checking.
(memalign_check): Fail if bytes == -1.
* malloc/Makefile: Add rules to build and run tst-mcheck.
* malloc/tst-mcheck.c: New test.
mallopt appropriately.
* malloc/malloc.h: Define M_PERTURB.
* malloc/malloc.c (perturb_byte): New variable.
(alloc_perturb, free_perturb): New macros.
(_int_malloc): Before returning, overwrite the memory if this is
requested.
(_int_free): Overwrite freed memory if requested.
(mALLOPt): Handle M_PERTURB.
* test-skeleton.c: Add call to mallopt with M_PERTURB command.
map if requested.
* debug/chk_fail.c: Request backtrace and memory map dump.
* Versions.def: Add GLIBC_2.4 for libc.
* debug/fgets_chk.c: New file.
* debug/fgets_u_chk.c: New file.
* debug/getcwd_chk.c: New file.
* debug/getwd_chk.c: New file.
* debug/readlink_chk.c: New file.
* debug/read_chk.c: New file.
* debug/pread_chk.c: New file.
* debug/pread64_chk.c: New file.
* debug/recv_chk.c: New file.
* debug/recvfrom_chk.c: New file.
* debug/Versions: Add all new functions with version GLIBC_2.4.
* debug/Makefile (routines): Add fgets_chk, fgets_u_chk, read_chk,
pread_chk, pread64_chk, recv_chk, recvfrom_chk, readlink_chk,
getwd_chk, and getcwd_chk. Plus appropriate CFLAGS definitions.
* debug/tst-chk1.c: Add more tests.
* libio/bits/stdio2.h: Add macros for fgets and fgets_unlocked.
* include/stdio.h: Declare __fgets_chk and __fgets_unlocked_chk.
* posix/unistd.h: Include <bits/unistd.h> for fortification.
* posix/bits/unistd.h: New file.
* posix/Makefile (headers): Add bits/unistd.h.
* socket/sys/socket.h: Include <bits/socket2.h> for fortification.
* socket/bits/socket2.h: New file.
* socket/Makefile (headers): Add bits/socket2.h.
* string/bits/string3.h: Extend memset macro to check for zero 3rd
parameter and use __memset_zero_constant_len_parameter in that case.
* sysdeps/generic/memset_chk.c: Add
__memset_zero_constant_len_parameter alias and linker warning.
* debug/Versions: Add __memset_zero_constant_len_parameter to libc
with version GLIBC_2.4.
* sysdeps/generic/bits/types.h: Don't unnecessarily use __extension__
in __STD_TYPE definition.
2005-02-21 Jakub Jelinek <jakub@redhat.com>
* malloc/malloc.c (malloc_printerr): If MALLOC_CHECK_={5,7}, print
the error message rather than program name.
2005-02-21 Ulrich Drepper <drepper@redhat.com>
* misc/sys/cdefs.h (__attribute_warn_unused_result__): Define.
* stdlib/stdlib.h: Make realloc with
__attribute_warn_unused_result__ instead of __wur.
* malloc/malloc.h: Add __wur and __attribute_warn_unused_result__
markers as in <stdlib.h>.
Update.
2004-10-19 Wolfram Gloger <wg@malloc.de>
* malloc/hooks.c (mem2chunk_check, top_check): Handle
non-contiguous arena. Reported by Michael Dalton
<mwdalton@stanford.edu> [BZ #457]. Add further checks for top chunk.
2004-12-11 Ulrich Drepper <drepper@redhat.com>
* malloc/malloc.c (_int_realloc): Add checks for corrupted memory.
(_int_free): Make clear message are result of free() calls.
* malloc/malloc.c (_int_realloc): Remove unnecessary tests for
oldmem and size == 0.
2004-11-19 Ulrich Drepper <drepper@redhat.com>
* malloc/malloc.c (_int_free): Add a few more cheap tests for
corruption.
* debug/fprintf_chk.c: Adjust all users.
2004-11-13 Ulrich Drepper <drepper@redhat.com>
* malloc/malloc.c (malloc_state): stat_lock_* elements need only
be defined if THREAD_STATS is defined. Remove pad0_ since it does
not align with cache line sizes in general anyway.
2004-11-13 Jakub Jelinek <jakub@redhat.com>
* elf/rtld.c (print_statistics): Avoid segfaults if not all namespaces
are used. Fix computation of num_relative_relocations on RELA
architectures other than IA-64 and Alpha.
2004-11-13 Ulrich Drepper <drepper@redhat.com>
* malloc/malloc.c (_int_free): Use munmap_chunk for handling
mmaped memory.
2004-11-12 Ulrich Drepper <drepper@redhat.com>
* sysdeps/unix/sysv/linux/libc_fatal.c: Add new function __libc_message
which performs the printing and simple format string handling. The
string is written to tty, stderr, syslog in this order, stopping after
the first successful output.
(__libc_fatal): Call __libc_message.
* include/stdio.h: Declare __libc_message.
* malloc/malloc.c (malloc_printerr): Use __libc_message.
* debug/chk_fail.c: Also print message with __libc_message.
* debug/test-strcpy_chk.c: Ensure that debug messages are not printed
to the terminal or stderr.
* debug/tst-chk1.c: Likewise.
* posix/Makefile: Remove gpl2lgpl variable.
2004-10-30 Andreas Schwab <schwab@suse.de>
* sysdeps/unix/sysv/linux/waitid.c: Include <stddef.h> for NULL.
2004-10-30 Ulrich Drepper <drepper@redhat.com>
* malloc/malloc.c (_int_free): Use unique comments for the error
cases.
2004-10-18 Jakub Jelinek <jakub@redhat.com>
* elf/dl-libc.c (__libc_dlsym_private, __libc_register_dl_open_hook):
New functions.
(__libc_dlopen_mode): Call __libc_register_dl_open_hook and
__libc_register_dlfcn_hook.
* dlfcn/Makefile (routines, elide-routines.os): Set.
Add rules to build and test tststatic2.
* dlfcn/tststatic2.c: New test.
* dlfcn/modstatic2.c: New test module.
* dlfcn/dladdr.c: Call _dlfcn_hook from libdl.so if not NULL.
Define __ prefixed routine in libc.a and in libdl.a just call it.
* dlfcn/dladdr1.c: Likewise.
* dlfcn/dlclose.c: Likewise.
* dlfcn/dlerror.c: Likewise.
* dlfcn/dlinfo.c: Likewise.
* dlfcn/dlmopen.c: Likewise.
* dlfcn/dlopen.c: Likewise.
* dlfcn/dlopenold.c: Likewise.
* dlfcn/dlsym.c: Likewise.
* dlfcn/dlvsym.c: Likewise.
* dlfcn/sdladdr.c: New file.
* dlfcn/sdladdr1.c: New file.
* dlfcn/sdlclose.c: New file.
* dlfcn/sdlerror.c: New file.
* dlfcn/sdlinfo.c: New file.
* dlfcn/sdlopen.c: New file.
* dlfcn/sdlsym.c: New file.
* dlfcn/sdlvsym.c: New file.
* dlfcn/Versions (libdl): Export _dlfcn_hook@GLIBC_PRIVATE.
* include/dlfcn.h (DL_CALLER_DECL, DL_CALLER RETURN_ADDRESS): Define.
(struct dlfcn_hook): New type.
(_dlfcn_hook): New extern decl.
(__dlopen, __dlclose, __dlsym, __dlerror, __dladdr, __dladdr1,
__dlinfo, __dlmopen, __libc_dlsym_private,
__libc_register_dl_open_hook, __libc_register_dlfcn_hook): New
prototypes.
(__dlvsym): Use DL_CALLER_DECL.
* include/libc-symbols.h: Define libdl_hidden_proto and friends.
* malloc/arena.c (_dl_open_hook): Extern decl.
(ptmalloc_init): Don't call _dl_addr when dlopened from statically
linked programs but don't use brk for them either.
Update.
Add support for namespaces in the dynamic linker.
* dlfcn/Makefile (libdl-routines): Add dlmopen.
* dlfcn/Versions [libdl, GLIBC_2.3.4]: Add dlmopen.
* dlfcn/dlfcn.h: Define Lmid_t, LM_ID_BASE, and LM_ID_NEWLM.
Declare dlmopen. Document RTLD_DI_LMID.
* dlfcn/dlinfo.c: Handle RTLD_DI_LMID.
* dlfcn/dlmopen.c: New file.
* dlfcn/dlopen.c: Pass new parameter to _dl_open.
* dlfcn/dlopenold.c: Likewise.
* elf/dl-addr.c: Adjust for removal of GL(dl_loaded).
* elf/dl-caller.c: Likewise.
* elf/dl-close.c: Likewise.
* elf/dl-conflict.c: Likewise.
* elf/dl-debug.c: Likewise.
* elf/dl-lookup.c: Likewise.
* elf/dl-sym.c: Likewise.
* elf/dl-version.c: Likewise.
* elf/do-lookup.h: Likewise.
* elf/rtld.c: Likewise.
* sysdeps/unix/sysv/linux/i386/dl-librecon.h: Likewise.
* elf/dl-depsc: Likewise. Add new parameter to _dl_map_object.
* elf/dl-fini.c: Call destructors in all namespaces.
* elf/dl-iteratephdr.c: Compute total nloaded. Adjust for removal of
GL(dl_loaded).
* elf/dl-libc.c: Pass new parameter to _dl_open. Adjust for removal
of GL(dl_loaded).
* elf/dl-load.c (_dl_map_object_from_fd): Don't load ld.so a second
time. Reuse the one from the main namespace in all others.
Pass new parameter to _dl_new_object.
Adjust for removal of GL(dl_loaded).
* elf/dl-object.c: Take new parameter. Use it to initialize l_ns.
Adjust for removal of GL(dl_loaded).
* elf/dl-open.c (_dl_open): Take new parameter.
Adjust for removal of GL(dl_loaded).
* elf/dl-support.c: Replace global _dl_loaded etc variables with
_dl_ns variable.
* include/dlfcn.h: Adjust prototype of _dl_open.
Define __LM_ID_CALLER.
* include/link.h: Add l_real, l_ns, and l_direct_opencount elements.
* sysdeps/generic/dl-tls.c: Bump TLS_STATIC_SURPLUS. Since libc is
using TLS we need memory appropriate to the number of namespaces.
* sysdeps/generic/ldsodefs.h (struct rtld_global): Replace _dl_loaded,
_dl_nloaded, _dl_global_scope, _dl_main_searchlist, and
_dl_global_scope_alloc with _dl_ns element. Define DL_NNS.
Adjust prototypes of _dl_map_object and member in rtld_global_ro.
* malloc/malloc.c: Include <dlfcn.h>.
* malloc/arena.c (ptmalloc_init): If libc is not in primary namespace,
never use brk.
* elf/Makefile: Add rules to build and run tst-dlmopen1 and
tst-dlmopen2.
* elf/tst-dlmopen1.c: New file.
* elf/tst-dlmopen1mod.c: New file.
* elf/tst-dlmopen2.c: New file.
* elf/dl-close.c: Improve reference counting by tracking direct loads.
* elf/dl-lookup.c (add_dependency): Likewise.
* elf/dl-open.c (dl_open_worker): Likewise.
* elf/rtld.c (dl_main): Likewise.
2004-09-09 GOTO Masanori <gotom@debian.or.jp>
[BZ #77]
* elf/dl-close.c: Count down l_opencount to check not only for
l_reldeps, but also l_initfini.
2004-10-13 Ulrich Drepper <drepper@redhat.com>
* posix/tst-getaddrinfo2.c: Include stdlib.h and string.h.
(do_test): Use %p instead of 0x%08X to print a pointer.
* malloc/malloc.c: Include stdio-common/_itoa.h.
2004-10-04 Ulrich Drepper <drepper@redhat.com>
* malloc/mtrace.pl: Avoid calling location unless it is needed for
output. Patch by Edward Bishop <binutils@gmail.com>.
* nscd/Makefile (CFLAGS-gai.c): Add -fpie.
2004-03-18 Jakub Jelinek <jakub@redhat.com>
* malloc/arena.c (aligned_heap_area): New variable.
(new_heap): If aligned_heap_area != NULL, attempt to use that
first. If HEAP_MAX_SIZE << 1 area is already HEAP_MAX_SIZE bytes
aligned, remember the second half in aligned_heap_area.
(delete_heap): Clear aligned_heap_area if deleting the area right
before aligned_heap_area.
* malloc/malloc.c (_int_free): Add inexpensive double free and
memory corruption tests.
(malloc_printf_nc): Renamed to malloc_printerr. Second parameter
is no format string anymore. Don't use stdio. Adjust all callers.
* malloc/hooks.c: Adjust malloc_printf_nc callers.
* malloc/hooks.c (DEFAULT_CHECK_ACTION): Moved to malloc.c.
(check_action): Likewise.
When printing error messages, use malloc_printf_nc now instead of
fiddling with the streams cancellation flag in every place.
* malloc/malloc.c (DEFAULT_CHECK_ACTION): New definition. Change
default to 3.
(check_action): New variable.
(unlink): Print error message and eventually terminate in case list
is corrupted.
(malloc_printf_nc): New function. Use it in _int_free.
Change proposed by Arjan van de Ven.
2004-08-13 Ulrich Drepper <drepper@redhat.com>
* elf/sprof.c (read_symbols): When comparing aliases, prefer
strong over weak symbols if both don't start with '_'.
* malloc/malloc.c: Use strong_alias instead of weak_alias wherever
possible.
Update.
* malloc/memusage.c (me): Use creat64, not creat.
* malloc/memusagestat.c: Fix handling of very large sizes. [BZ #285]
Patch by Guy Maor <guymaor@yahoo.com>.
2004-05-25 Ulrich Drepper <drepper@redhat.com>
* nss/digits_dots.c (__nss_hostname_digits_dots): Remove typep and
flags parameter, convert afp to simple int parameter. Adjust code.
typep was never != NULL and flags therefore also unused. *afp is
never modified.
* nss/nsswitch.h: Adjust __nss_hostname_digits_dots prototype.
* nss/getXXbyYY.c: Remove HAVE_TYPE handling. Adjust af parameter
handling for __nss_hostname_digits_dots calls.
* nss/getXXbyYY_r.c: Likewise.
* elf/dl-load.c (_dl_map_object_from_fd): Map DSOs with MAP_DENYWRITE.
2004-05-20 Paul Eggert <eggert@cs.ucla.edu>
* malloc/obstack.c (_obstack) [!defined _LIBC]: Remove; not used.
Add comment explaining why libc still defines it.
Update.
2004-05-18 Petter Reinholdtsen <pere@hungry.com>
* locales/sl_SI [LC_TIME]: Correct d_fmt date format from
'22.06.2003' to '22. 06. 2003'. Change requested from Aleks
Reinhardt, and approved by the locale author Borka
Jerman-Blazic. [BZ #163]
2003-12-17 Jakub Jelinek <jakub@redhat.com>
* malloc/mtrace.c (tr_old_memalign_hook): New variable.
(tr_memalignhook): New function.
(mtrace): Register tr_memalignhook.
(muntrace): Deregister tr_memalignhook.
* malloc/malloc.c (__posix_memalign): If __memalign_hook != NULL,
call it directly instead of memalign_internal.
2003-12-17 Ulrich Drepper <drepper@redhat.com>
* misc/mntent_r.c: Change encoding to match recently change decoder.
Patch by Alexander Achenbach <xela@slit.de>.
2003-12-16 Steven Munroe <sjmunroe@us.ibm.com>
* sysdeps/unix/sysv/linux/powerpc/sys/ucontext.h: Correct definition of
vrregset_t.
2003-12-16 Steven Munroe <sjmunroe@us.ibm.com>
* sysdeps/unix/sysv/linux/powerpc/sys/procfs.h [!__PPC64_ELF_H]: Extent
conditional to include typedef elf_vrreg_t.
2002-12-17 Paolo Bonzini <bonzini@gnu.org>
* posix/regexec.c (re_search_internal): Limit search to the
beginning of the buffer if the initial states are empty for
contexts that do not include CONTEXT_BEGBUF or, if
!preg->newline_anchor, that do not include any one of
CONTEXT_BEGBUF and CONTEXT_NEWLINE.
2003-09-27 Wolfram Gloger <wg@malloc.de>
* malloc/malloc.c: Include <malloc-machine.h> earlier instead of
"thread-m.h", so that default parameters can be overridden in a
system-specific malloc-machine.h. Remove extra ; from extern "C"
closing brace.
* sysdeps/generic/malloc-machine.h: New file.
* sysdeps/mach/hurd/malloc-machine.h: New file.
* malloc/thread-m.h: Removed.
* malloc/Makefile: Remove CFLAGS-malloc.c parameter addition, it
is in sysdeps/generic/malloc-machine.h now.
* elf/dl-reloc.c (_dl_allocate_static_tls): Move definition of
variables only used if TLS_TCB_AT_TP is defined into the #if
branch.