Commit Graph

456 Commits

Author SHA1 Message Date
Holger Hans Peter Freyther
685cb08356 Fix spelling in memusagestat.c 2009-11-06 09:32:06 -08:00
Ulrich Drepper
cc49a5a883 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.
2009-11-01 07:27:00 -08:00
John Sullivan
ee6f35389c Fix typos in format strings of malloc_info. 2009-10-29 21:50:35 -07:00
Ulrich Drepper
67854c131c Fix repairing of memusage trace files. 2009-10-29 14:19:33 -07:00
Andreas Schwab
22bc5239e1 Fix wrap-around in memusage. 2009-10-29 11:25:20 -07:00
Ulrich Drepper
72f9026327 Add local assert function to avoid problems with memory allocation in
the real one.
2009-08-31 04:55:10 -07:00
Jakub Jelinek
1877ea16ca Fix obstack* on i?86
obstack calls several callbacks, so on i?86 it'd better be compiled
without -mpreferred-stack-boundary=2, otherwise the callbacks are called
with misaligned stack.
2009-07-31 07:26:36 -07:00
Ulrich Drepper
bec466d922 Fix race in corruption check.
With atomic fastbins the checks performed can race with concurrent
modifications of the arena.  If we detect a problem re-do the test
after getting the lock.
2009-07-16 09:54:34 -07:00
Jakub Jelinek
bea0ac1d87 Use rel semantics of cas instead of acq semantics with full barrier before it in _int_free
The following patch fixes catomic_compare_and_exchange_*_rel definitions
(which were never used and weren't correct) and uses
catomic_compare_and_exchange_val_rel in _int_free.  Comparing to the
pre-2009-07-02 --enable-experimental-malloc state the generated code should
be identical on all arches other than ppc/ppc64 and on ppc/ppc64 should use
lwsync instead of isync barrier.
2009-07-16 07:24:50 -07:00
Ulrich Drepper
6cbbaa50aa Fix possible race when freeing object in fast bin list. 2009-07-02 03:30:55 -07:00
Ulrich Drepper
f6887a0d9a Add some more tests to malloc to detect corruptions. 2009-06-18 22:37:31 -07:00
Andreas Schwab
f60ddf9bf7 Don't treat bug reporting message as a format string. 2009-06-16 20:34:55 -07:00
Ulrich Drepper
0588a9cb62 * malloc/malloc.c (malloc_info): Output address space information. 2009-04-18 08:44:10 +00:00
Ulrich Drepper
da2d2fb68d * malloc/malloc.c (malloc_info): Also output system memory information. 2009-04-18 05:14:52 +00:00
Ulrich Drepper
acdf23097f (top_check): Force hook value into register. 2009-04-17 17:55:06 +00:00
Ulrich Drepper
df77455c4b [BZ #9957]
2009-04-16  Ulrich Drepper  <drepper@redhat.com>
	[BZ #9957]
	* malloc/malloc.c (force_reg): Define.
	(sYSMALLOc): Load hook variable into variable
	before test and force into register.
	(sYSTRIm): Likewise.
	(public_mALLOc): Force hook value into register.
	(public_fREe): Likewise.
	(public_rEALLOc): Likewise.
	(public_mEMALIGn): Likewise.
	(public_vALLOc): Likewise.
	(public_pVALLOc): Likewise.
	(public_cALLOc): Likewise.
	(__posix_memalign): Likewise.
	* malloc/arena.c (ptmalloc_init): Load hook variable into variable
	before test and force into register.
	* malloc/hooks.c (top_check): Likewise.
	(public_s_ET_STATe): Pretty printing.

	* resolv/res_send.c (send_dg): Don't just ignore the result we got
	in case we only receive one reply in single-request mode.
2009-04-16 21:22:16 +00:00
Ulrich Drepper
bb06654506 * malloc/malloc.c (malloc_info): New function.
* malloc/malloc.h: Declare it.
	* malloc/Versions: Export malloc_info for GLIBC_2.10.

	* resolv/nss_dns/dns-host.c (getanswer_r): Use strcasecmp
2009-04-09 05:45:42 +00:00
Ulrich Drepper
4c8b8cc332 * malloc/malloc.c (_int_realloc): Add parameter with old block
size.  Remove duplicated test.  Don't handle mmap'ed blocks here.
	Adjust all callers.
	* malloc/hooks.c (realloc_check): Adjust _int_realloc call.
2009-04-08 18:00:34 +00:00
Ulrich Drepper
425ce2edb9 * config.h.in (USE_MULTIARCH): Define.
* configure.in: Handle --enable-multi-arch.
	* elf/dl-runtime.c (_dl_fixup): Handle STT_GNU_IFUNC.
	(_dl_fixup_profile): Likewise.
	* elf/do-lookup.c (dl_lookup_x): Likewise.
	* sysdeps/x86_64/dl-machine.h: Handle STT_GNU_IFUNC.
	* elf/elf.h (STT_GNU_IFUNC): Define.
	* include/libc-symbols.h (libc_ifunc): Define.
	* sysdeps/x86_64/cacheinfo.c: If USE_MULTIARCH is defined, use the
	framework in init-arch.h to get CPUID values.
	* sysdeps/x86_64/multiarch/Makefile: New file.
	* sysdeps/x86_64/multiarch/init-arch.c: New file.
	* sysdeps/x86_64/multiarch/init-arch.h: New file.
	* sysdeps/x86_64/multiarch/sched_cpucount.c: New file.

	* config.make.in (experimental-malloc): Define.
	* configure.in: Handle --enable-experimental-malloc.
	* malloc/Makefile: Handle experimental-malloc flag.
	* malloc/malloc.c: Implement PER_THREAD and ATOMIC_FASTBINS features.
	* malloc/arena.c: Likewise.
	* malloc/hooks.c: Likewise.
	* malloc/malloc.h: Define M_ARENA_TEST and M_ARENA_MAX.
2009-03-13 23:53:18 +00:00
Jakub Jelinek
d82a27f841 * stdlib/monetary.h: Uglify function parameter names.
* sunrpc/rpc/pmap_clnt.h: Likewise. 
* sunrpc/rpc/svc.h: Likewise. 
* sunrpc/rpc/xdr.h: Likewise. 
* sunrpc/rpc/clnt.h: Likewise. 
* resolv/netdb.h: Likewise. 
* resolv/arpa/nameser.h: Likewise. 
* resolv/resolv.h: Likewise. 
* argp/argp.h: Likewise. 
* locale/langinfo.h: Likewise. 
* io/sys/stat.h: Likewise. 
* posix/spawn.h: Likewise. 
* nis/rpcsvc/nislib.h: Likewise. 
* malloc/obstack.h: Likewise. 
* sysdeps/ia64/bits/link.h: Likewise. 
* sysdeps/i386/bits/link.h: Likewise. 
* sysdeps/s390/bits/link.h: Likewise. 
* sysdeps/powerpc/bits/link.h: Likewise. 
* sysdeps/x86_64/bits/link.h: Likewise. 
* sysdeps/sparc/bits/link.h: Likewise. 
* sysdeps/sh/bits/link.h: Likewise. 
* sysdeps/unix/sysv/linux/i386/sys/io.h: Likewise. 
* sysdeps/unix/sysv/linux/x86_64/sys/io.h: Likewise. 
* sysdeps/unix/sysv/linux/sparc/sys/eventfd.h: Likewise. 
* sysdeps/unix/sysv/linux/sys/eventfd.h: Likewise.
2009-02-16  Jakub Jelinek  <jakub@redhat.com>

	* stdlib/monetary.h: Uglify function parameter names.
	* sunrpc/rpc/pmap_clnt.h: Likewise.
	* sunrpc/rpc/svc.h: Likewise.
	* sunrpc/rpc/xdr.h: Likewise.
	* sunrpc/rpc/clnt.h: Likewise.
	* resolv/netdb.h: Likewise.
	* resolv/arpa/nameser.h: Likewise.
	* resolv/resolv.h: Likewise.
	* argp/argp.h: Likewise.
	* locale/langinfo.h: Likewise.
	* io/sys/stat.h: Likewise.
	* posix/spawn.h: Likewise.
	* nis/rpcsvc/nislib.h: Likewise.
	* malloc/obstack.h: Likewise.
	* sysdeps/ia64/bits/link.h: Likewise.
	* sysdeps/i386/bits/link.h: Likewise.
	* sysdeps/s390/bits/link.h: Likewise.
	* sysdeps/powerpc/bits/link.h: Likewise.
	* sysdeps/x86_64/bits/link.h: Likewise.
	* sysdeps/sparc/bits/link.h: Likewise.
	* sysdeps/sh/bits/link.h: Likewise.
	* sysdeps/unix/sysv/linux/i386/sys/io.h: Likewise.
	* sysdeps/unix/sysv/linux/x86_64/sys/io.h: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sys/eventfd.h: Likewise.
	* sysdeps/unix/sysv/linux/sys/eventfd.h: Likewise.
2009-02-16 21:00:15 +00:00
Ulrich Drepper
6dd6a580df (_int_realloc): Likewise. Third argument is now padded size 2009-02-07 22:49:34 +00:00
Ulrich Drepper
78ac92ad8d * malloc/malloc.c (_int_free): Second argument is now mchunkptr.
Change all callers.
	(_int_realloc): Likewise.
	All _int_* functions are now static.
	* malloc/hooks.c: Change all callers to _int_free and _int_realloc.
	* malloc/arena.c: Likewise.
	* include/malloc.h: Remove now unnecessary declarations of the _int_*
	functions.
2009-02-07 22:01:49 +00:00
Ulrich Drepper
bfacf1af1a * malloc/malloc.c: Add branch prediction for use of the hooks. 2009-02-07 19:05:28 +00:00
Ulrich Drepper
cbbcaf2369 * debug/xtrace.sh: Unify translatable messages.
* elf/ldd.bash.in: Likewise.
	* elf/sprof.c: Likewise.
	* locale/programs/locale.c: Likewise.
	* malloc/memusage.sh: Likewise.
	* nss/getent.c: Likewise.

2009-02-06  Joseph Myers  <joseph@codesourcery.com>

	* debug/pcprofiledump.c (print_version,
	argp_program_version_hook): New function.
	* elf/ldconfig.c (more_help): New function.
	(argp): Use it.
	* elf/sln.c (usage): New function.
	(main): Support --help and --version.
	* malloc/memusagestat.c (print_version): New function.
	(argp_program_version_hook): New variable.
	* nscd/nscd.c (more_help): New function.
	(argp): Use it.
	* posix/getconf.c (main): Send --version output to stdout.
	Support --help.
	* sunrpc/rpc_main.c (usage, options_usage): Take STREAM and STATUS
	arguments.  All callers changed.
	(print_version): New function.
	(parseargs): Support --help and --version.
	* sunrpc/rpcinfo.c (usage): Take STREAM argument.  All callers
	changed.
	(print_version): New function.
	(main): Use getopt_long.  Support --help and --version.
	* sysdeps/unix/sysv/linux/lddlibc4.c (main): Support --help and
	--version.

2009-02-06  Ulrich Drepper  <drepper@redhat.com>
2009-02-06 20:13:07 +00:00
Ulrich Drepper
e2e390fad8 * malloc/memusage.c (DEFAULT_BUFFER_SIZE): Change to 32768.
(update_data): Fix handling of wrapping back
2009-02-06 18:27:08 +00:00
Ulrich Drepper
c3ab42a82d * malloc/memusage.c (update_data): Fix handling of wrapping back
to the beginning of the buffer.
2009-02-06 18:24:23 +00:00
Ulrich Drepper
1fdd89a78d * malloc/malloc.c (sYSMALLOc): Don't use assert when detecting
manipulated brk, use malloc_printerr.
	* misc/sbrk.c (__sbrk): Better error handling for nonsense
	requests.
2009-01-30 17:47:23 +00:00
Ulrich Drepper
d36ad87147 * posix/getconf.c: Update copyright year.
* nss/getent.c: Likewise.
	* iconv/iconvconfig.c: Likewise.
	* iconv/iconv_prog.c: Likewise.
	* elf/ldconfig.c: Likewise.
	* catgets/gencat.c: Likewise.
	* csu/version.c: Likewise.
	* elf/ldd.bash.in: Likewise.
	* elf/sprof.c (print_version): Likewise.
	* locale/programs/locale.c: Likewise.
	* locale/programs/localedef.c: Likewise.
	* nscd/nscd.c (print_version): Likewise.
	* debug/xtrace.sh: Likewise.
	* malloc/memusage.sh: Likewise.
	* malloc/mtrace.pl: Likewise.
	* debug/catchsegv.sh: Likewise.
2009-01-02 08:47:18 +00:00
Ulrich Drepper
486bdb8863 * malloc/malloc.c (public_rEALLOc): When new arena is used, copy
really all bytes.  Patch by Denys Vlasenko <dvlasenk@redhat.com>.
2008-11-03 08:07:39 +00:00
Ulrich Drepper
dba385512d (public_vALLOc): Try other arenas in case _int_valloc fails. (public_pVALLOc): Likewise. 2008-09-12 18:18:25 +00:00
Ulrich Drepper
72112b0cb4 * malloc/mtrace.c (mtrace): Use 'e' flag in fopen call. Drop
F_SETFD use if we know fopen set the flag.
2008-07-26 22:43:16 +00:00
Ulrich Drepper
231e783524 (__malloc_check_init): Remove printf. 2008-07-15 17:16:07 +00:00
Jakub Jelinek
ae39e102cb * malloc/mtrace.pl: Use $@ instead of $* to keep perl 5.10 quiet.
2008-04-07  Jakub Jelinek  <jakub@redhat.com>

	* malloc/mtrace.pl: Use $@ instead of $* to keep perl 5.10 quiet.
2008-04-07 14:45:18 +00:00
Ulrich Drepper
c958a6a4e5 [BZ #5736]
* malloc/malloc.c: Fix typo in comment.
2008-03-04 18:36:27 +00:00
Ulrich Drepper
ab355d9aa5 * pthread-errnos.sym: Add EOVERFLOW.
* sysdeps/unix/sysv/linux/structsem.sym: Add SEM_VALUE_MAX.
	* sysdeps/unix/sysv/linux/sem_post.c: Don't overflow value field.
	* sysdeps/unix/sysv/linux/i386/i486/sem_post.S: Likewise.
	* sysdeps/unix/sysv/linux/x86_64/sem_post.S: Likewise.
2008-01-10 18:34:43 +00:00
Ulrich Drepper
f6bacb8ef4 [BZ #5541]
* sunrpc/rpc_thread.c (__rpc_thread_destroy): Also free xports and
	pollfd structures.
	Patch by André Cruz.
2008-01-09 21:52:40 +00:00
Ulrich Drepper
b34437015b [BZ #5553]
2008-01-09  Ulrich Drepper  <drepper@redhat.com>
	[BZ #5553]
	* malloc/malloc.c (public_mALLOc): Set ar_ptr when trying main_arena.
	(public_mEMALIGn): Likewise.
	Patch mostly by Daniel Jacobowitz.
2008-01-09 20:35:03 +00:00
Ulrich Drepper
f4a1363eb3 * posix/getconf.c: Update copyright year.
* nss/getent.c: Likewise.
	* iconv/iconvconfig.c: Likewise.
	* iconv/iconv_prog.c: Likewise.
	* elf/ldconfig.c: Likewise.
	* catgets/gencat.c: Likewise.
	* csu/version.c: Likewise.
	* elf/ldd.bash.in: Likewise.
	* elf/sprof.c (print_version): Likewise.
	* locale/programs/locale.c: Likewise.
	* locale/programs/localedef.c: Likewise.
	* nscd/nscd.c (print_version): Likewise.
	* debug/xtrace.sh: Likewise.
	* malloc/memusage.sh: Likewise.
	* malloc/mtrace.pl: Likewise.
	* debug/catchsegv.sh: Likewise.
2008-01-02 19:26:03 +00:00
Ulrich Drepper
4cd4c5d6a2 * malloc/malloc.c (public_cALLOc): For arena other than
main_arena, count all bytes inside the mprotect_size range of the
	heap as uninitialized.
2007-12-17 18:44:04 +00:00
Ulrich Drepper
be8c1500c7 * malloc/tst-trim1.c: New file.
* malloc/Makefile (tests): Add tst-trim1.
2007-12-16 22:57:57 +00:00
Ulrich Drepper
68631c8eb9 * malloc/malloc.c (public_mTRIm): Iterate over all arenas and call
mTRIm for all of them.
	(mTRIm): Additionally iterate over all free blocks and use madvise
	to free memory for all those blocks which contain at least one
	memory page.

	* malloc/malloc.c (do_check_malloc_state): Minimal cleanups.
2007-12-16 22:53:08 +00:00
Ulrich Drepper
cbf5760e62 * malloc/arena.c (grow_heap): Split out code to shrink heap into...
(shrink_heap): ... this new function.
	(heap_trim): Call shrink_heap instead of grow_heap.
2007-12-12 00:11:49 +00:00
Ulrich Drepper
17edb30c62 * malloc/malloc.c (_int_malloc): sYSMALLOc might fail, in this
case don't call alloc_perturb.
2007-12-11 23:46:43 +00:00
Ulrich Drepper
666aa0201b * malloc/arena.c [!NO_THREADS]: Use ATFORK_MEM if defined. 2007-10-28 00:59:34 +00:00
Ulrich Drepper
68f3802dfa [BZ #4941]
* locales/oc_FR: Fix Thursday abday and August mon and abmon data.
2007-10-02 04:19:37 +00:00
Ulrich Drepper
1c3e748ef3 [BZ #4792]
* stdlib/stdlib.h (realloc): Remove __attribute_malloc__.
	* malloc/malloc.h (realloc): Likewise.

2007-07-16  Jakub Jelinek  <jakub@redhat.com>
2007-07-19 17:05:14 +00:00
Roland McGrath
2e2efe652a * elf/ldconfig.c: Allow GPLv2 or any later version.
* elf/readlib.c: Likewise.
	* elf/chroot_canon.c: Likewise.
	* elf/cache.c: Likewise.
	* nscd/mem.c: Likewise.
	* nscd/getpwuid_r.c: Likewise.
	* nscd/grpcache.c: Likewise.
	* nscd/aicache.c: Likewise.
	* nscd/getsrvbynm_r.c: Likewise.
	* nscd/nscd.c: Likewise.
	* nscd/servicescache.c: Likewise.
	* nscd/getsrvbypt_r.c: Likewise.
	* nscd/initgrcache.c: Likewise.
	* nscd/gethstbyad_r.c: Likewise.
	* nscd/gethstbynm2_r.c: Likewise.
	* nscd/getgrnam_r.c: Likewise.
	* nscd/nscd_setup_thread.c: Likewise.
	* nscd/getpwnam_r.c: Likewise.
	* nscd/gai.c: Likewise.
	* nscd/connections.c: Likewise.
	* nscd/dbg_log.c: Likewise.
	* nscd/cache.c: Likewise.
	* nscd/hstcache.c: Likewise.
	* nscd/nscd_conf.c: Likewise.
	* nscd/getgrgid_r.c: Likewise.
	* nscd/pwdcache.c: Likewise.
	* catgets/gencat.c: Likewise.
	* locale/programs/linereader.h: Likewise.
	* locale/programs/locarchive.c: Likewise.
	* locale/programs/ld-paper.c: Likewise.
	* locale/programs/locfile-kw.h: Likewise.
	* locale/programs/ld-address.c: Likewise.
	* locale/programs/xmalloc.c: Likewise.
	* locale/programs/ld-time.c: Likewise.
	* locale/programs/localedef.c: Likewise.
	* locale/programs/simple-hash.c: Likewise.
	* locale/programs/xstrdup.c: Likewise.
	* locale/programs/ld-numeric.c: Likewise.
	* locale/programs/locfile-kw.gperf: Likewise.
	* locale/programs/ld-collate.c: Likewise.
	* locale/programs/charmap-kw.gperf: Likewise.
	* locale/programs/charmap.h: Likewise.
	* locale/programs/charmap-kw.h: Likewise.
	* locale/programs/config.h: Likewise.
	* locale/programs/locfile.c: Likewise.
	* locale/programs/ld-ctype.c: Likewise.
	* locale/programs/charmap.c: Likewise.
	* locale/programs/ld-messages.c: Likewise.
	* locale/programs/repertoire.h: Likewise.
	* locale/programs/locale.c: Likewise.
	* locale/programs/ld-name.c: Likewise.
	* locale/programs/linereader.c: Likewise.
	* locale/programs/locfile.h: Likewise.
	* locale/programs/3level.h: Likewise.
	* locale/programs/ld-monetary.c: Likewise.
	* locale/programs/ld-measurement.c: Likewise.
	* locale/programs/charmap-dir.c: Likewise.
	* locale/programs/ld-identification.c: Likewise.
	* locale/programs/localedef.h: Likewise.
	* locale/programs/charmap-dir.h: Likewise.
	* locale/programs/repertoire.c: Likewise.
	* locale/programs/simple-hash.h: Likewise.
	* locale/programs/ld-telephone.c: Likewise.
	* locale/programs/locale-spec.c: Likewise.
	* locale/programs/locfile-token.h: Likewise.
	* posix/getconf.c: Likewise.
	* iconv/dummy-repertoire.c: Likewise.
	* iconv/iconv_charmap.c: Likewise.
	* iconv/iconvconfig.c: Likewise.
	* iconv/iconv_prog.c: Likewise.
	* malloc/memusagestat.c: Likewise.
	* sysdeps/unix/sysv/linux/nscd_setup_thread.c: Likewise.
2007-07-16 00:56:07 +00:00
Ulrich Drepper
1f4843fbff * 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-21 16:13:18 +00:00
Ulrich Drepper
2acd01acb1 * malloc/malloc.c (do_check_chunk): Correct check for mmaped block
not overlapping with arena.
2007-05-19 04:42:52 +00:00
Ulrich Drepper
129abdd3ee * malloc/mcheck.c (reallochook): If size==0, free the block. 2007-05-19 04:26:03 +00:00