diff options
author | Ulrich Drepper <drepper@redhat.com> | 2005-11-06 17:08:48 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2005-11-06 17:08:48 +0000 |
commit | 8e635611c9fef3d78e7f24f34999e122e1017217 (patch) | |
tree | e4c7a00f433bc88250aae118e43a62ace943c6dd | |
parent | d0b2cbf837d6e45476a1300a1e6469233e6dd8ff (diff) | |
download | glibc-8e635611c9fef3d78e7f24f34999e122e1017217.tar glibc-8e635611c9fef3d78e7f24f34999e122e1017217.tar.gz glibc-8e635611c9fef3d78e7f24f34999e122e1017217.tar.bz2 glibc-8e635611c9fef3d78e7f24f34999e122e1017217.zip |
* malloc/malloc.c (munmap_chunk): Add sanity checks.
* sysdeps/pthread/configure: Fix comment.
-rw-r--r-- | ChangeLog | 6 | ||||
-rwxr-xr-x | configure | 33 | ||||
-rw-r--r-- | malloc/malloc.c | 20 | ||||
-rw-r--r-- | nptl/ChangeLog | 4 | ||||
-rw-r--r-- | nptl/sysdeps/unix/sysv/linux/configure | 3 | ||||
-rw-r--r-- | sysdeps/pthread/configure | 2 |
6 files changed, 31 insertions, 37 deletions
@@ -1,3 +1,9 @@ +2005-11-06 Ulrich Drepper <drepper@redhat.com> + + * malloc/malloc.c (munmap_chunk): Add sanity checks. + + * sysdeps/pthread/configure: Fix comment. + 2005-11-05 Ulrich Drepper <drepper@redhat.com> * configure.in: Remove gnu_as definition and everything using it. @@ -313,7 +313,7 @@ ac_includes_default="\ # include <unistd.h> #endif" -ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS with_fp with_cvs enable_check_abi oldest_abi bindnow force_install all_warnings build build_cpu build_vendor build_os host host_cpu host_vendor host_os subdirs add_ons base_machine sysnames INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA LN_S CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC OBJEXT BUILD_CC cross_compiling CPP CXX CXXFLAGS ac_ct_CXX AR OBJDUMP RANLIB ac_ct_RANLIB MIG AS LD PWD_P MAKE MSGFMT MAKEINFO SED AUTOCONF SYSINCLUDES libc_cv_gcc_static_libgcc BASH libc_cv_have_bash2 KSH libc_cv_have_ksh AWK PERL INSTALL_INFO BISON VERSIONING libc_cv_asm_protected_directive libc_cv_cc_with_libunwind libc_cv_z_nodelete libc_cv_z_nodlopen libc_cv_z_initfirst libc_cv_z_relro libc_cv_Bgroup libc_cv_libgcc_s_suffix libc_cv_as_needed ASFLAGS_config libc_cv_z_combreloc libc_cv_z_execstack libc_cv_fpie fno_unit_at_a_time libc_cv_ssp libc_cv_have_initfini no_whole_archive exceptions LIBGD have_libaudit have_selinux EGREP sizeof_long_double libc_cv_gcc_unwind_find_fde uname_sysname uname_release uname_version old_glibc_headers libc_cv_slibdir libc_cv_localedir libc_cv_sysconfdir libc_cv_rootsbindir libc_cv_forced_unwind use_ldconfig ldd_rewrite_script gnu_ld gnu_as elf xcoff static shared pic_default profile omitfp bounded static_nss nopic_initfini DEFINES mach_interface_list VERSION RELEASE LIBOBJS LTLIBOBJS' +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS with_fp with_cvs enable_check_abi oldest_abi bindnow force_install all_warnings build build_cpu build_vendor build_os host host_cpu host_vendor host_os subdirs add_ons base_machine sysnames INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA LN_S CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC OBJEXT BUILD_CC cross_compiling CPP CXX CXXFLAGS ac_ct_CXX AR OBJDUMP RANLIB ac_ct_RANLIB MIG AS LD PWD_P MAKE MSGFMT MAKEINFO SED AUTOCONF SYSINCLUDES libc_cv_gcc_static_libgcc BASH libc_cv_have_bash2 KSH libc_cv_have_ksh AWK PERL INSTALL_INFO BISON VERSIONING libc_cv_asm_protected_directive libc_cv_cc_with_libunwind libc_cv_z_nodelete libc_cv_z_nodlopen libc_cv_z_initfirst libc_cv_z_relro libc_cv_Bgroup libc_cv_libgcc_s_suffix libc_cv_as_needed ASFLAGS_config libc_cv_z_combreloc libc_cv_z_execstack libc_cv_fpie fno_unit_at_a_time libc_cv_ssp libc_cv_have_initfini no_whole_archive exceptions LIBGD have_libaudit have_selinux EGREP sizeof_long_double libc_cv_gcc_unwind_find_fde uname_sysname uname_release uname_version old_glibc_headers libc_cv_slibdir libc_cv_localedir libc_cv_sysconfdir libc_cv_rootsbindir libc_cv_forced_unwind use_ldconfig ldd_rewrite_script elf xcoff static shared pic_default profile omitfp bounded static_nss nopic_initfini DEFINES mach_interface_list VERSION RELEASE LIBOBJS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. @@ -1793,11 +1793,6 @@ config_os="`echo $config_os | sed 's/^unknown-//'`" # Some configurations imply other options. case "$host_os" in -gnu* | linux* | bsd4.4* | netbsd* | freebsd*) - # These systems always use GNU tools. - gnu_ld=yes gnu_as=yes ;; -esac -case "$host_os" in # i586-linuxaout is mangled into i586-pc-linux-gnuaout linux*ecoff* | linux*aout* | gnu*aout* | gnu*ecoff*) ;; @@ -5360,7 +5355,7 @@ _ACEOF fi - if test $libc_cv_visibility_attribute = yes -a $gnu_ld = yes; then + if test $libc_cv_visibility_attribute = yes; then echo "$as_me:$LINENO: checking whether to put _rtld_local into .sdata section" >&5 echo $ECHO_N "checking whether to put _rtld_local into .sdata section... $ECHO_C" >&6 if test "${libc_cv_have_sdata_section+set}" = set; then @@ -5895,7 +5890,7 @@ _ACEOF fi fi -if test $elf = yes -a $gnu_ld = yes; then +if test $elf = yes; then echo "$as_me:$LINENO: checking whether cc puts quotes around section names" >&5 echo $ECHO_N "checking whether cc puts quotes around section names... $ECHO_C" >&6 if test "${libc_cv_have_section_quotes+set}" = set; then @@ -7638,18 +7633,6 @@ fi -if test $gnu_ld = yes; then - cat >>confdefs.h <<\_ACEOF -#define HAVE_GNU_LD 1 -_ACEOF - -fi -if test $gnu_as = yes; then - cat >>confdefs.h <<\_ACEOF -#define HAVE_GNU_AS 1 -_ACEOF - -fi if test $elf = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_ELF 1 @@ -7666,13 +7649,7 @@ fi if test $shared = default; then - if test $gnu_ld = yes; then - shared=$elf - else - # For now we do not assume shared libs are available. In future more - # tests might become available. - shared=no - fi + shared=$elf fi if test x"$libc_cv_idn" = xyes; then @@ -8446,8 +8423,6 @@ s,@libc_cv_rootsbindir@,$libc_cv_rootsbindir,;t t s,@libc_cv_forced_unwind@,$libc_cv_forced_unwind,;t t s,@use_ldconfig@,$use_ldconfig,;t t s,@ldd_rewrite_script@,$ldd_rewrite_script,;t t -s,@gnu_ld@,$gnu_ld,;t t -s,@gnu_as@,$gnu_as,;t t s,@elf@,$elf,;t t s,@xcoff@,$xcoff,;t t s,@static@,$static,;t t diff --git a/malloc/malloc.c b/malloc/malloc.c index 4ea35254bb..e315b21759 100644 --- a/malloc/malloc.c +++ b/malloc/malloc.c @@ -3268,19 +3268,31 @@ munmap_chunk(p) mchunkptr p; #endif { INTERNAL_SIZE_T size = chunksize(p); - int ret; assert (chunk_is_mmapped(p)); #if 0 assert(! ((char*)p >= mp_.sbrk_base && (char*)p < mp_.sbrk_base + mp_.sbrked_mem)); assert((mp_.n_mmaps > 0)); #endif - assert(((p->prev_size + size) & (mp_.pagesize-1)) == 0); + + uintptr_t block = (uintptr_t) p - p->prev_size; + size_t total_size = p->prev_size + size; + /* Unfortunately we have to do the compilers job by hand here. Normally + we would test BLOCK and TOTAL-SIZE separately for compliance with the + page size. But gcc does not recognize the optimization possibility + (in the moment at least) so we combine the two values into one before + the bit test. */ + if (__builtin_expect (((block | total_size) & (mp_.pagesize - 1)) != 0, 0)) + { + malloc_printerr (check_action, "munmap_chunk(): invalid pointer", + chunk2mem (p)); + return; + } mp_.n_mmaps--; - mp_.mmapped_mem -= (size + p->prev_size); + mp_.mmapped_mem -= total_size; - ret = munmap((char *)p - p->prev_size, size + p->prev_size); + int ret = munmap(block, total_size); /* munmap returns non-zero on failure */ assert(ret == 0); diff --git a/nptl/ChangeLog b/nptl/ChangeLog index c42be9ae7a..db084dfcc2 100644 --- a/nptl/ChangeLog +++ b/nptl/ChangeLog @@ -1,3 +1,7 @@ +2005-11-06 Ulrich Drepper <drepper@redhat.com> + + * sysdeps/unix/sysv/linux/configure: Removed. + 2005-11-05 Ulrich Drepper <drepper@redhat.com> * sysdeps/unix/sysv/linux/ia64/pt-initfini.c: Remove trace of diff --git a/nptl/sysdeps/unix/sysv/linux/configure b/nptl/sysdeps/unix/sysv/linux/configure deleted file mode 100644 index 229414dd74..0000000000 --- a/nptl/sysdeps/unix/sysv/linux/configure +++ /dev/null @@ -1,3 +0,0 @@ -# Local configure fragment for sysdeps/unix/sysv/linux. - -DEFINES="$DEFINES -D_LIBC_REENTRANT" diff --git a/sysdeps/pthread/configure b/sysdeps/pthread/configure index 229414dd74..e39d31138d 100644 --- a/sysdeps/pthread/configure +++ b/sysdeps/pthread/configure @@ -1,3 +1,3 @@ -# Local configure fragment for sysdeps/unix/sysv/linux. +# Local configure fragment for sysdeps/pthread. DEFINES="$DEFINES -D_LIBC_REENTRANT" |