From 9596d0ddf067b6f819ab16916ae9337132cf721c Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Wed, 19 Sep 2001 03:25:37 +0000 Subject: [PATCH] Update. 2001-09-18 Ulrich Drepper * malloc/malloc.c (ptmalloc_init): Handle _environ==NULL. Reported by B. D. Elliott [PR libc/2541]. 2001-09-18 Andreas Schwab * elf/dl-load.c (_dl_map_object_from_fd): Update handling of scope list, now that l_scope is a pointer. * elf/dl-open.c (dl_open_worker): Fix thinko when enlarging the scope list. 2001-09-18 kaz Kojima * sysdeps/sh/dl-machine.h (elf_machine_rela): Fix reverse condition. (elf_machine_rela_relative): Add a missing declaration. 2001-09-18 Jakub Jelinek * sysdeps/unix/sysv/linux/ia64/ldd-rewrite.sed: New. * sysdeps/unix/sysv/linux/s390/ldd-rewrite.sed: New. * sysdeps/unix/sysv/linux/configure.in: Add ia64 and s390 ldd-rewrite scripts. 2001-09-18 Ulrich Drepper * elf/ldd.bash.in: Update copyright message. 2001-09-17 H.J. Lu * hurd/hurdmalloc.c (bcopy): Removed. (realloc): Replace bcopy with memcpy. * hurd/path-lookup.c (file_name_path_scan): Likewise. * resolv/gethnamaddr.c (map_v4v6_address): Likewise. * sunrpc/rpcinfo.c (pmapdump): Likewise. * resolv/gethnamaddr.c (getanswer): Replace bcopy with memmove. (gethostbyaddr): Likewise. * sunrpc/rpcinfo.c (get_inet_address): Likewise. 2001-09-18 Ulrich Drepper * sysdeps/gnu/eval.c: Removed. --- ChangeLog | 45 +++++++++++++++ elf/dl-load.c | 2 +- elf/dl-open.c | 10 ++-- elf/ldd.bash.in | 2 +- hurd/hurdmalloc.c | 10 ++-- hurd/path-lookup.c | 4 +- malloc/malloc.c | 84 ++++++++++++++-------------- resolv/gethnamaddr.c | 8 +-- sunrpc/rpcinfo.c | 6 +- sysdeps/sh/dl-machine.h | 4 +- sysdeps/unix/sysv/linux/configure | 6 ++ sysdeps/unix/sysv/linux/configure.in | 6 ++ sysdeps/unix/sysv/linux/ia64/ldd-rewrite.sed | 1 + sysdeps/unix/sysv/linux/s390/ldd-rewrite.sed | 1 + 14 files changed, 126 insertions(+), 63 deletions(-) create mode 100644 sysdeps/unix/sysv/linux/ia64/ldd-rewrite.sed create mode 100644 sysdeps/unix/sysv/linux/s390/ldd-rewrite.sed diff --git a/ChangeLog b/ChangeLog index 619fde2..3b4a87e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,48 @@ +2001-09-18 Ulrich Drepper + + * malloc/malloc.c (ptmalloc_init): Handle _environ==NULL. + Reported by B. D. Elliott [PR libc/2541]. + +2001-09-18 Andreas Schwab + + * elf/dl-load.c (_dl_map_object_from_fd): Update handling of scope + list, now that l_scope is a pointer. + + * elf/dl-open.c (dl_open_worker): Fix thinko when enlarging the + scope list. + +2001-09-18 kaz Kojima + + * sysdeps/sh/dl-machine.h (elf_machine_rela): Fix reverse condition. + (elf_machine_rela_relative): Add a missing declaration. + +2001-09-18 Jakub Jelinek + + * sysdeps/unix/sysv/linux/ia64/ldd-rewrite.sed: New. + * sysdeps/unix/sysv/linux/s390/ldd-rewrite.sed: New. + * sysdeps/unix/sysv/linux/configure.in: Add ia64 and s390 + ldd-rewrite scripts. + +2001-09-18 Ulrich Drepper + + * elf/ldd.bash.in: Update copyright message. + +2001-09-17 H.J. Lu + + * hurd/hurdmalloc.c (bcopy): Removed. + (realloc): Replace bcopy with memcpy. + * hurd/path-lookup.c (file_name_path_scan): Likewise. + * resolv/gethnamaddr.c (map_v4v6_address): Likewise. + * sunrpc/rpcinfo.c (pmapdump): Likewise. + + * resolv/gethnamaddr.c (getanswer): Replace bcopy with memmove. + (gethostbyaddr): Likewise. + * sunrpc/rpcinfo.c (get_inet_address): Likewise. + +2001-09-18 Ulrich Drepper + + * sysdeps/gnu/eval.c: Removed. + 2001-09-18 Andreas Jaeger * sysdeps/i386/fpu/s_logbl.S: Move to ... diff --git a/elf/dl-load.c b/elf/dl-load.c index 48c78c3..3e5ddc0 100644 --- a/elf/dl-load.c +++ b/elf/dl-load.c @@ -1136,7 +1136,7 @@ _dl_map_object_from_fd (const char *name, int fd, struct filebuf *fbp, /* Now move the existing entries one back. */ memmove (&l->l_scope[1], &l->l_scope[0], - sizeof (l->l_scope) - sizeof (l->l_scope[0])); + (l->l_scope_max - 1) * sizeof (l->l_scope[0])); /* Now add the new entry. */ l->l_scope[0] = &l->l_symbolic_searchlist; diff --git a/elf/dl-open.c b/elf/dl-open.c index f79c317..d10ab8a 100644 --- a/elf/dl-open.c +++ b/elf/dl-open.c @@ -312,7 +312,7 @@ dl_open_worker (void *a) ++runp; } - if (__builtin_expect (cnt + 1 < imap->l_scope_max, 0)) + if (__builtin_expect (cnt + 1 >= imap->l_scope_max, 0)) { /* The 'r_scope' array is too small. Allocate a new one dynamically. */ @@ -327,7 +327,7 @@ dl_open_worker (void *a) _dl_signal_error (ENOMEM, "dlopen", NULL, N_("cannot create scope list")); imap->l_scope = memcpy (newp, imap->l_scope, - cnt * imap->l_scope_max); + cnt * sizeof (imap->l_scope[0])); } else { @@ -339,10 +339,10 @@ dl_open_worker (void *a) N_("cannot create scope list")); imap->l_scope = newp; } - - imap->l_scope[cnt++] = &new->l_searchlist; - imap->l_scope[cnt] = NULL; } + + imap->l_scope[cnt++] = &new->l_searchlist; + imap->l_scope[cnt] = NULL; } /* Run the initializer functions of new objects. */ diff --git a/elf/ldd.bash.in b/elf/ldd.bash.in index b50ee42..0d2a9e7 100644 --- a/elf/ldd.bash.in +++ b/elf/ldd.bash.in @@ -36,7 +36,7 @@ while test $# -gt 0; do case "$1" in --vers | --versi | --versio | --version) echo 'ldd (GNU libc) @VERSION@' - echo $"Copyright (C) 1999 Free Software Foundation, Inc. + echo $"Copyright (C) 2001 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Written by Roland McGrath and Ulrich Drepper." diff --git a/hurd/hurdmalloc.c b/hurd/hurdmalloc.c index 25bf876..4839d98 100644 --- a/hurd/hurdmalloc.c +++ b/hurd/hurdmalloc.c @@ -1,8 +1,6 @@ #include #include -#define bcopy(s,d,n) memcpy ((d), (s), (n)) /* No overlap handling. */ - #include "hurdmalloc.h" /* XXX see that file */ #include @@ -37,6 +35,10 @@ /* * HISTORY * $Log$ + * Revision 1.15 2001/09/19 03:04:09 drepper + * (bcopy): Removed. + * (realloc): Replace bcopy with memcpy. + * * Revision 1.14 2001/04/01 05:03:14 roland * 2001-03-11 Roland McGrath * @@ -422,8 +424,8 @@ realloc(old_base, new_size) */ new_base = malloc(new_size); if (new_base) - bcopy(old_base, new_base, - (int) (old_size < new_size ? old_size : new_size)); + memcpy (new_base, old_base, + (int) (old_size < new_size ? old_size : new_size)); if (new_base || new_size == 0) /* Free OLD_BASE, but only if the malloc didn't fail. */ diff --git a/hurd/path-lookup.c b/hurd/path-lookup.c index 19434b6..5c51d39 100644 --- a/hurd/path-lookup.c +++ b/hurd/path-lookup.c @@ -55,10 +55,10 @@ file_name_path_scan (const char *file_name, const char *path, if (pfx_len == 0) pfxed_name[pfx_len++] = '.'; else - bcopy (path, pfxed_name, pfx_len); + memcpy (pfxed_name, path, pfx_len); if (pfxed_name[pfx_len - 1] != '/') pfxed_name[pfx_len++] = '/'; - bcopy (file_name, pfxed_name + pfx_len, file_name_len + 1); + memcpy (pfxed_name + pfx_len, file_name, file_name_len + 1); err = (*fun)(pfxed_name); if (err == 0) diff --git a/malloc/malloc.c b/malloc/malloc.c index 6722ac4..8279dda 100644 --- a/malloc/malloc.c +++ b/malloc/malloc.c @@ -1766,49 +1766,49 @@ ptmalloc_init __MALLOC_P((void)) secure = __libc_enable_secure; #ifdef _LIBC s = NULL; - { - char **runp = _environ; - char *envline; + if (_environ != NULL) + { + char **runp = _environ; + char *envline; - while (__builtin_expect ((envline = next_env_entry (&runp)) != NULL, - 0)) - { - size_t len = strcspn (envline, "="); - - if (envline[len] != '=') - /* This is a "MALLOC_" variable at the end of the string - without a '=' character. Ignore it since otherwise we - will access invalid memory below. */ - continue; - - switch (len) - { - case 6: - if (memcmp (envline, "CHECK_", 6) == 0) - s = &envline[7]; - break; - case 8: - if (! secure && memcmp (envline, "TOP_PAD_", 8) == 0) - mALLOPt(M_TOP_PAD, atoi(&envline[9])); - break; - case 9: - if (! secure && memcmp (envline, "MMAP_MAX_", 9) == 0) - mALLOPt(M_MMAP_MAX, atoi(&envline[10])); - break; - case 15: - if (! secure) - { - if (memcmp (envline, "TRIM_THRESHOLD_", 15) == 0) - mALLOPt(M_TRIM_THRESHOLD, atoi(&envline[16])); - else if (memcmp (envline, "MMAP_THRESHOLD_", 15) == 0) - mALLOPt(M_MMAP_THRESHOLD, atoi(&envline[16])); - } - break; - default: - break; - } - } - } + while (__builtin_expect ((envline = next_env_entry (&runp)) != NULL, 0)) + { + size_t len = strcspn (envline, "="); + + if (envline[len] != '=') + /* This is a "MALLOC_" variable at the end of the string + without a '=' character. Ignore it since otherwise we + will access invalid memory below. */ + continue; + + switch (len) + { + case 6: + if (memcmp (envline, "CHECK_", 6) == 0) + s = &envline[7]; + break; + case 8: + if (! secure && memcmp (envline, "TOP_PAD_", 8) == 0) + mALLOPt(M_TOP_PAD, atoi(&envline[9])); + break; + case 9: + if (! secure && memcmp (envline, "MMAP_MAX_", 9) == 0) + mALLOPt(M_MMAP_MAX, atoi(&envline[10])); + break; + case 15: + if (! secure) + { + if (memcmp (envline, "TRIM_THRESHOLD_", 15) == 0) + mALLOPt(M_TRIM_THRESHOLD, atoi(&envline[16])); + else if (memcmp (envline, "MMAP_THRESHOLD_", 15) == 0) + mALLOPt(M_MMAP_THRESHOLD, atoi(&envline[16])); + } + break; + default: + break; + } + } + } #else if (! secure) { diff --git a/resolv/gethnamaddr.c b/resolv/gethnamaddr.c index 25ae119..c13b106 100644 --- a/resolv/gethnamaddr.c +++ b/resolv/gethnamaddr.c @@ -441,7 +441,7 @@ getanswer(answer, anslen, qname, qtype) cp += n; continue; } - bcopy(cp, *hap++ = bp, n); + memmove(*hap++ = bp, cp, n); bp += n; buflen -= n; cp += n; @@ -738,7 +738,7 @@ gethostbyaddr(addr, len, af) #endif /*SUNSECURITY*/ hp->h_addrtype = af; hp->h_length = len; - bcopy(addr, host_addr, len); + memmove(host_addr, addr, len); h_addr_ptrs[0] = (char *)host_addr; h_addr_ptrs[1] = NULL; if (af == AF_INET && (_res.options & RES_USE_INET6)) { @@ -899,14 +899,14 @@ map_v4v6_address(src, dst) int i; /* Stash a temporary copy so our caller can update in place. */ - bcopy(src, tmp, INADDRSZ); + memcpy(tmp, src, INADDRSZ); /* Mark this ipv6 addr as a mapped ipv4. */ for (i = 0; i < 10; i++) *p++ = 0x00; *p++ = 0xff; *p++ = 0xff; /* Retrieve the saved copy and we're done. */ - bcopy(tmp, (void*)p, INADDRSZ); + memcpy((void*)p, tmp, INADDRSZ); } static void diff --git a/sunrpc/rpcinfo.c b/sunrpc/rpcinfo.c index 7f99664..d9da989 100644 --- a/sunrpc/rpcinfo.c +++ b/sunrpc/rpcinfo.c @@ -542,8 +542,8 @@ pmapdump (argc, argv) bzero ((char *) &server_addr, sizeof server_addr); server_addr.sin_family = AF_INET; if ((hp = gethostbyname ("localhost")) != NULL) - bcopy (hp->h_addr, (caddr_t) & server_addr.sin_addr, - hp->h_length); + memcpy ((caddr_t) & server_addr.sin_addr, hp->h_addr, + hp->h_length); else server_addr.sin_addr.s_addr = inet_addr ("0.0.0.0"); } @@ -733,7 +733,7 @@ get_inet_address (addr, host) host); exit (1); } - bcopy (hp->h_addr, (char *) &addr->sin_addr, hp->h_length); + memmove ((char *) &addr->sin_addr, hp->h_addr, hp->h_length); } addr->sin_family = AF_INET; } diff --git a/sysdeps/sh/dl-machine.h b/sysdeps/sh/dl-machine.h index ee5bb9c..dc53c65 100644 --- a/sysdeps/sh/dl-machine.h +++ b/sysdeps/sh/dl-machine.h @@ -487,7 +487,7 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc, } } #ifndef RTLD_BOOTSTRAP - else if (__builtin_expect (r_type != R_SH_NONE, 0)) + else if (__builtin_expect (r_type == R_SH_NONE, 0)) return; #endif else @@ -561,6 +561,8 @@ static inline void elf_machine_rela_relative (Elf32_Addr l_addr, const Elf32_Rela *reloc, Elf32_Addr *const reloc_addr) { + Elf32_Addr value; + if (reloc->r_addend) value = l_addr + reloc->r_addend; else diff --git a/sysdeps/unix/sysv/linux/configure b/sysdeps/unix/sysv/linux/configure index b1a8df8..b1fb85f 100644 --- a/sysdeps/unix/sysv/linux/configure +++ b/sysdeps/unix/sysv/linux/configure @@ -189,6 +189,12 @@ case "$machine" in i[3456]86* | m68*) ldd_rewrite_script=../sysdeps/unix/sysv/linux/ldd-rewrite.sed ;; + ia64*) + ldd_rewrite_script=../sysdeps/unix/sysv/linux/ia64/ldd-rewrite.sed + ;; + s390*) + ldd_rewrite_script=../sysdeps/unix/sysv/linux/s390/ldd-rewrite.sed + ;; sparc*) ldd_rewrite_script=../sysdeps/unix/sysv/linux/sparc/ldd-rewrite.sed ;; diff --git a/sysdeps/unix/sysv/linux/configure.in b/sysdeps/unix/sysv/linux/configure.in index b112a0f..b522f3e 100644 --- a/sysdeps/unix/sysv/linux/configure.in +++ b/sysdeps/unix/sysv/linux/configure.in @@ -157,6 +157,12 @@ case "$machine" in i[3456]86* | m68*) ldd_rewrite_script=../sysdeps/unix/sysv/linux/ldd-rewrite.sed ;; + ia64*) + ldd_rewrite_script=../sysdeps/unix/sysv/linux/ia64/ldd-rewrite.sed + ;; + s390*) + ldd_rewrite_script=../sysdeps/unix/sysv/linux/s390/ldd-rewrite.sed + ;; sparc*) ldd_rewrite_script=../sysdeps/unix/sysv/linux/sparc/ldd-rewrite.sed ;; diff --git a/sysdeps/unix/sysv/linux/ia64/ldd-rewrite.sed b/sysdeps/unix/sysv/linux/ia64/ldd-rewrite.sed new file mode 100644 index 0000000..aed1556 --- /dev/null +++ b/sysdeps/unix/sysv/linux/ia64/ldd-rewrite.sed @@ -0,0 +1 @@ +s_^\(RTLDLIST=\)\([^ ]*\)\(\|-ia64\)\(\.so\.[0-9.]*\)[ ]*$_\1"\2-ia64\4 \2\4"_ diff --git a/sysdeps/unix/sysv/linux/s390/ldd-rewrite.sed b/sysdeps/unix/sysv/linux/s390/ldd-rewrite.sed new file mode 100644 index 0000000..28e46fe --- /dev/null +++ b/sysdeps/unix/sysv/linux/s390/ldd-rewrite.sed @@ -0,0 +1 @@ +s_^\(RTLDLIST=\)\([^ ]*\)\(\|64\)\(\.so\.[0-9.]*\)[ ]*$_\1"\2\4 \264\4"_ -- 2.7.4