From 997a416551a7d5ceb91978674cb8c70b443329d0 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Fri, 28 Aug 1998 09:29:49 +0000 Subject: [PATCH] Update. 1998-08-28 09:22 Ulrich Drepper * elf/rtld.c (process_envvars): Fix copy&paste error. * malloc/malloc.c (malloc_hook_ini): Don't overwrite realloc and memalign hook. (realloc_hook_ini): Don't overwrite memalign hook. (memalign_hook_ini): Don't overwrite malloc and memalign hooks. Reported by Philippe Troin . * malloc/mcheck.c (mprobe): Call checkhdr with adjusted pointer. Patch by Philippe Troin . 1998-08-26 Andreas Schwab * sysdeps/generic/segfault.c (install_handler): Protect the non-POSIX signals with #ifdef. (catch_segfault): Add missing mode parameter for open. * debug/catchsegv.sh: Avoid termination message from shell. Allow other termination signals. 1998-08-27 Andreas Schwab * debug/Makefile (distribute): Add register-dump.h. 1998-08-28 10:41 Andreas Schwab --- ChangeLog | 27 ++++++++++++++++++++++++++- debug/catchsegv.sh | 10 ++++++---- elf/rtld.c | 2 +- malloc/malloc.c | 5 ----- malloc/mcheck.c | 2 +- sysdeps/generic/segfault.c | 6 +++++- 6 files changed, 39 insertions(+), 13 deletions(-) diff --git a/ChangeLog b/ChangeLog index f101b68c8a..a628944885 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,29 @@ -Fri Aug 28 10:41:38 1998 Andreas Schwab +1998-08-28 09:22 Ulrich Drepper + + * elf/rtld.c (process_envvars): Fix copy&paste error. + + * malloc/malloc.c (malloc_hook_ini): Don't overwrite realloc and + memalign hook. + (realloc_hook_ini): Don't overwrite memalign hook. + (memalign_hook_ini): Don't overwrite malloc and memalign hooks. + Reported by Philippe Troin . + + * malloc/mcheck.c (mprobe): Call checkhdr with adjusted pointer. + Patch by Philippe Troin . + +1998-08-26 Andreas Schwab + + * sysdeps/generic/segfault.c (install_handler): Protect the + non-POSIX signals with #ifdef. + (catch_segfault): Add missing mode parameter for open. + * debug/catchsegv.sh: Avoid termination message from shell. Allow + other termination signals. + +1998-08-27 Andreas Schwab + + * debug/Makefile (distribute): Add register-dump.h. + +1998-08-28 10:41 Andreas Schwab * sysdeps/unix/sysv/linux/m68k/register-dump.h: New file. diff --git a/debug/catchsegv.sh b/debug/catchsegv.sh index b949352eee..a813b6d614 100755 --- a/debug/catchsegv.sh +++ b/debug/catchsegv.sh @@ -52,15 +52,17 @@ fi segv_output=`basename "$prog"`.segv.$$ +# Redirect stderr to avoid termination message from shell. +(exec 3>&2 2>/dev/null LD_PRELOAD=${LD_PRELOAD:+${LD_PRELOAD}:}@SLIB@/libSegFault.so \ SEGFAULT_USE_ALTSTACK=1 \ SEGFAULT_OUTPUT_NAME=$segv_output \ -"$prog" ${1+"$@"} +"$prog" ${1+"$@"} 2>&3 3>&-) exval=$? -# Check for a segmentation error. -if test $exval -eq 139 && test -f "$segv_output"; then - # We caught a segmentation error. The output is in the file with the +# Check for signal termination. +if test $exval -gt 128 && test -f "$segv_output"; then + # The program caught a signal. The output is in the file with the # name we have in SEGFAULT_OUTPUT_NAME. In the output the names of # functions in shared objects are available, but names in the static # part of the program are not. We use addr2line to get this information. diff --git a/elf/rtld.c b/elf/rtld.c index 283ea7e2a7..3ae51e68ab 100644 --- a/elf/rtld.c +++ b/elf/rtld.c @@ -1169,7 +1169,7 @@ process_envvars (enum mode *modep, int *lazyp) /* Path where the binary is found. */ if (!__libc_enable_secure && memcmp (&envline[3], "ORIGIN_PATH", 11) == 0) - _dl_hwcap_mask = strtoul (&envline[15], NULL, 0); + _dl_origin_path = &envline[15]; break; case 12: diff --git a/malloc/malloc.c b/malloc/malloc.c index 3bf4910651..ba32992999 100644 --- a/malloc/malloc.c +++ b/malloc/malloc.c @@ -1702,8 +1702,6 @@ malloc_hook_ini(sz) size_t sz; #endif { __malloc_hook = NULL; - __realloc_hook = NULL; - __memalign_hook = NULL; ptmalloc_init(); return mALLOc(sz); } @@ -1718,7 +1716,6 @@ realloc_hook_ini(ptr, sz, caller) { __malloc_hook = NULL; __realloc_hook = NULL; - __memalign_hook = NULL; ptmalloc_init(); return rEALLOc(ptr, sz); } @@ -1731,8 +1728,6 @@ memalign_hook_ini(sz, alignment, caller) size_t sz; size_t alignment; const __malloc_ptr_t caller; #endif { - __malloc_hook = NULL; - __realloc_hook = NULL; __memalign_hook = NULL; ptmalloc_init(); return mEMALIGn(sz, alignment); diff --git a/malloc/mcheck.c b/malloc/mcheck.c index 4547a31299..c5baa3d4a7 100644 --- a/malloc/mcheck.c +++ b/malloc/mcheck.c @@ -246,5 +246,5 @@ mcheck (func) enum mcheck_status mprobe (__ptr_t ptr) { - return mcheck_used ? checkhdr (ptr) : MCHECK_DISABLED; + return mcheck_used ? checkhdr (((struct hdr *) ptr) - 1) : MCHECK_DISABLED; } diff --git a/sysdeps/generic/segfault.c b/sysdeps/generic/segfault.c index 0d4be93837..5a9e64a105 100644 --- a/sysdeps/generic/segfault.c +++ b/sysdeps/generic/segfault.c @@ -90,7 +90,7 @@ catch_segfault (int signal, SIGCONTEXT ctx) fname = getenv ("SEGFAULT_OUTPUT_NAME"); if (fname != NULL && fname[0] != '\0') { - fd = open (fname, O_TRUNC | O_WRONLY | O_CREAT); + fd = open (fname, O_TRUNC | O_WRONLY | O_CREAT, 0666); if (fd == -1) fd = 2; } @@ -182,8 +182,12 @@ install_handler (void) INSTALL_FOR_SIG (SIGSEGV, "segv"); INSTALL_FOR_SIG (SIGILL, "ill"); +#ifdef SIGBUS INSTALL_FOR_SIG (SIGBUS, "bus"); +#endif +#ifdef SIGSTKFLT INSTALL_FOR_SIG (SIGSTKFLT, "stkflt"); +#endif INSTALL_FOR_SIG (SIGABRT, "abrt"); INSTALL_FOR_SIG (SIGFPE, "fpe"); }