NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: lib/38408 (bug in ld_elf.so, dlopen fails with abort trap on libcairo.so)



The following reply was made to PR lib/38408; it has been noted by GNATS.

From: "Matthew Mondor" <mm_lists%pulsar-zone.net@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc: 
Subject: Re: lib/38408 (bug in ld_elf.so, dlopen fails with abort trap on 
libcairo.so)
Date: Fri, 11 Apr 2008 22:49:13 -0400 (EDT)

 I also tested it and can confirm assertions occuring on a recently
 updated netbsd-4 branch i386 32-bit uniprocessor system:
 
 #include <assert.h>
 #include <dlfcn.h>
 #include <time.h>
 #include <stdio.h>
 #include <stdlib.h>
 
 int
 main(void)
 {
         void    *ret;
 
         ret = dlopen("/usr/pkg/lib/libcairo.so.2", DL_LAZY);
         assert(ret != NULL);
 
 #ifdef PRINT
         (void) printf("Loaded\n");
 #endif
         (void) sleep(5);
         (void) dlclose(ret);
         (void) printf("Unoaded\n");
 
         return EXIT_SUCCESS;
 }
 
 
  --- (pts/2) mmondor%hal.xisop@localhost $ cc -DPRINT -g -o tmp tmp.c
  --- (pts/2) mmondor%hal.xisop@localhost $ time ./tmp
 time: Command terminated abnormally.
         0.01 real         0.00 user         0.01 sys
  --- (pts/2) mmondor%hal.xisop@localhost $ cc -g -o tmp tmp.c
  --- (pts/2) mmondor%hal.xisop@localhost $ time ./tmp
 time: Command terminated abnormally.
         5.01 real         0.01 user         0.00 sys
  --- (pts/2) mmondor%hal.xisop@localhost $ gdb ./tmp
 GNU gdb 6.5
 Copyright (C) 2006 Free Software Foundation, Inc.
 GDB is free software, covered by the GNU General Public License, and
 you are
 welcome to change it and/or distribute copies of it under certain
 conditions.
 Type "show copying" to see the conditions.
 There is absolutely no warranty for GDB.  Type "show warranty" for
 details.
 This GDB was configured as "i386--netbsdelf"...
 (gdb) run
 Starting program: /tmp/tmp
 
 Program received signal SIGABRT, Aborted.
 0xbbb1d3af in kill () from /usr/lib/libc.so.12
 (gdb) bt
 #0  0xbbb1d3af in kill () from /usr/lib/libc.so.12
 #1  0xbbb1f6e4 in __libc_mutex_unlock () from /usr/lib/libc.so.12
 #2  0xbbba3ff5 in __cxa_finalize () from /usr/lib/libc.so.12
 #3  0xbba89fd4 in __do_global_dtors_aux () from
 /usr/pkg/lib/libcairo.so.2
 #4  0xbbaf0fb8 in _fini () from /usr/pkg/lib/libcairo.so.2
 #5  0xbbbf6fb3 in _rtld_unload_object () from /usr/libexec/ld.elf_so
 #6  0x01bf6f6b in ?? ()
 #7  0xbbbfea9c in ?? () from /usr/libexec/ld.elf_so
 #8  0xbbbff514 in _rtld_pagesz () from /usr/libexec/ld.elf_so
 #9  0xbbbed600 in ?? ()
 #10 0xbfbfe548 in ?? ()
 #11 0xbbbf71de in dlclose () from /usr/libexec/ld.elf_so
 #12 0x08049a48 in ?? ()
 #13 0x08049a7c in _GLOBAL_OFFSET_TABLE_ ()
 #14 0xbfbfe590 in ?? ()
 #15 0x0804886d in main () at tmp.c:19
 (gdb) quit
 The program is running.  Exit anyway? (y or n) y
  --- (pts/2) mmondor%hal.xisop@localhost $ cc -DPRINT -g -o tmp tmp.c
  --- (pts/2) mmondor%hal.xisop@localhost $ gdb ./tmp
 GNU gdb 6.5
 Copyright (C) 2006 Free Software Foundation, Inc.
 GDB is free software, covered by the GNU General Public License, and
 you are
 welcome to change it and/or distribute copies of it under certain
 conditions.
 Type "show copying" to see the conditions.
 There is absolutely no warranty for GDB.  Type "show warranty" for
 details.
 This GDB was configured as "i386--netbsdelf"...
 (gdb) run
 Starting program: /tmp/tmp
 
 Program received signal SIGABRT, Aborted.
 0xbbb1d3af in kill () from /usr/lib/libc.so.12
 (gdb) bt
 #0  0xbbb1d3af in kill () from /usr/lib/libc.so.12
 #1  0xbbb1f6e4 in __libc_mutex_unlock () from /usr/lib/libc.so.12
 #2  0xbbbc4700 in __flockfile_internal () from /usr/lib/libc.so.12
 #3  0xbbb8f9c6 in puts () from /usr/lib/libc.so.12
 #4  0x08048862 in main () at tmp.c:16
 (gdb) quit
 
 Interestingly it appears to initially load fine (the next code like
 sleep(5) can run), but initialization of stdio or unloading the
 library then fails.
 
 I'm wondering if it could be related to usage of free() which were
 replaced by a custom xfree() on -current on which this works fine. 
 Another possibility would be init/fini hooks order calling which also
 were changed.
 
 Since -current migrated to another libc allocator, I'm unsure if
 pulling up changes as-is will work.  I think it also would be
 interesting to have an ld_elf.so built with DEBUG and RTLD_DEBUG
 defined to obtain more information, which I couldn't do tonight.
 -- 
 Matthew Mondor
 


Home | Main Index | Thread Index | Old Index