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

bus error branching to dynamic library



I built this library:

-rw-r--r--  1 root  phil  257918 Mar  2 00:25 /usr/local/lib/libh.so.0.2.0

When I try to run programs to test it, most of them die with segmentation
fault or bus error and core dump.  Inserting fprintf(stderr,...) calls
in various places shows the failures always occur calling one of the
functions in the library.  An fprintf right before the call gets its
data displayed.  An fprintf which is the first thing in the function
never does.  I did some ktrace to see what might be happening and I found
this part that looks funny:

  8326 linesort CALL  open(0x8020b52,0,0)
  8326 linesort NAMI  "/usr/local/lib/libh.so.0.2.0"
  8326 linesort RET   open 5
  8326 linesort CALL  read(0x5,0xf7fff408,0x20)
  8326 linesort GIO   fd 5 read 32 bytes
       "\M-_(_at_)_\M^J\^A\v\0\^B\M-@\0\0\0 \0\0\0\0\0\0\0Xt\0\0\0 \0\0\0\0\0\0\0\0"
  8326 linesort RET   read 32/0x20
  8326 linesort CALL  mmap(0,0x2e000,0x5,0x4,0x5,0,0,0)
  8326 linesort RET   mmap 134365184/0x8024000
  8326 linesort CALL  mprotect(0x8050000,0x2000,0x7)
  8326 linesort RET   mprotect 0
  8326 linesort CALL  mmap(0x8052000,0,0x7,0x1014,0xffffffff,0,0,0)
  8326 linesort RET   mmap 134553600/0x8052000
  8326 linesort CALL  close(0x5)
  8326 linesort RET   close 0

The call to mmap() uses a size of 188416 instead of mapping the whole
library.  I just want to confirm that this is mapping right amount
since the problem seems like the library isn't even loaded or the
functions are linked or relocated wrong (but surely such an error
would be more catastrophic well beyond my use, so I'm ruling that
out).

What could be tested next?  Are there any debuggers besides gdb?
Is there anything to simply run an untrapped instruction trace?

-- 
-----------------------------------------------------------------
| Phil Howard - KA9WGN |   Dallas   | http://linuxhomepage.com/ |
| phil-nospam_(_at_)_ipal_(_dot_)_net | Texas, USA | http://phil.ipal.org/     |
-----------------------------------------------------------------



Visit your host, monkey.org