improper handling of dlpened's C++/atexit() code?

Konstantin Belousov kostikbel at gmail.com
Tue May 16 00:30:07 PDT 2006


On Mon, May 15, 2006 at 11:58:32PM -0400, m m wrote:
> On 5/14/06, Alexander Kabaev <kabaev at gmail.com> wrote:
> >On Thu, 11 May 2006 20:57:20 -0400
> >"m m" <needacoder at gmail.com> wrote:
> >
> >>  I am writing in regard to PR at
> >> http://www.freebsd.org/cgi/query-pr.cgi?pr=bin%2F59552 .  I am
> >> experiencing behavior on 6.1-PRERELEASE FreeBSD 6.1-PRERELEASE #11:
> >> Sun Mar 26 00:03:52 EST 2006 which looks a lot like something that
> >> would be caused by this PR. This happens when apache-1.3 processes
> >> that run with Mason code receive a SIGUSR1 (when newsyslog does log
> >> rotation) and apache gracefully kills off all processes when
> >> restarting.  The following is the stack trace that lead me to this PR:
> >You'll need to build ld-elf.so.1 and libc.so.6 to get a sensible
> >backtrace.
> 
> Please find the new stack trace below.  If there is more information I
> can provide, just ask.  (This is 6.1-STABLE, cvsup very shortly before
> May 11 23:14 EDT)
> 
> Program received signal SIGSEGV, Segmentation fault.
> 0x00000000 in ?? ()
> (gdb) bt
> #0  0x00000000 in ?? ()
> #1  0x294c0ad8 in __do_global_dtors_aux () from
> /usr/local/lib/perl5/5.8.8/mach/auto/Sys/Syslog/Syslog.so
> #2  0x294c1d4c in _fini () from
> /usr/local/lib/perl5/5.8.8/mach/auto/Sys/Syslog/Syslog.so
> #3  0x280b4c80 in ?? ()
> #4  0x280aaab8 in ?? () from /libexec/ld-elf.so.1
> #5  0xbfbfe6e8 in ?? ()
> #6  0x2808dca6 in objlist_call_fini (list=0x280a96d8) at
> /usr/src/libexec/rtld-elf/rtld.c:1336
> #7  0x2808e1d4 in rtld_exit () at /usr/src/libexec/rtld-elf/rtld.c:1528
> #8  0x281d58ea in __cxa_finalize (dso=0x0) at
> /usr/src/lib/libc/stdlib/atexit.c:184
> #9  0x281d55ba in exit (status=0) at /usr/src/lib/libc/stdlib/exit.c:69
> #10 0x0805d0cb in clean_child_exit ()
> #11 0x0805ea77 in just_die ()
> #12 0x0805ea9a in usr1_handler ()
> #13 0xbfbfffb4 in ?? ()
> #14 0x0000001e in ?? ()
> #15 0x00000000 in ?? ()
> #16 0xbfbfe7c0 in ?? ()
> #17 0x00000002 in ?? ()
> #18 0x0805ea80 in just_die ()
> #19 0x0806011e in child_main ()
> #20 0x080607de in make_child ()
> #21 0x08060868 in startup_children ()
> #22 0x08060e81 in standalone_main ()
> #23 0x08061702 in main ()

The simplest way to get rtld and libc with debug symbols installed is
as follows, assuming you have sources in /usr/src and complete buildworld
result in /usr/obj:

# cd /usr/src
# make buildenv
# CFLAGS=-g; export CFLAGS
# STRIP=""; export STRIP
# cd libexec/rtld-elf
# make clean depend all install
# cd ../../lib/libc
# make clean depend all install

After that the file command shall show that the libc and rtld are
unstripped:

# file ../p/libexec/ld-elf.so.1
../p/libexec/ld-elf.so.1: ELF 32-bit LSB shared object, Intel 80386, version 1 (FreeBSD), not stripped

The compiled binaries are be identical to currently installed, except symbols
shall be present.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-stable/attachments/20060516/98d1b746/attachment.pgp


More information about the freebsd-stable mailing list