[omniORB] Using NJAMD with Omniorb
Mike Perry
mikepery@fscked.org
Mon, 17 Jul 2000 21:54:21 -0500
Hi, I'm the author of a malloc debugger (http://fscked.org/proj/njamd.shtml),
and it was recently brought to my attention that when used with omniorb v3,
my debugger crashes in its init function.
I investigated this, and its actually crashing in glibc (2.1.3 on RH6.2),
during a READ of errno (one of the save_errno assignments). This crash happens
for just about any call that uses errno. Now, I'm guessing that since this
happens REALLY early, the memory address errno resides in isn't mapped yet.
(OmniORB calls malloc from one of its global constructors during its thread
init function). My init function is called from this malloc, and then uses a
number of system calls.
Doing a mmap on &errno stops the crash, but screws up things when debugging
programs that don't have this behavior (because I remap errno and probably
some important info in the page adjacent to it).
Ok, so I know the problem. My question now is: Is there anything that can be
done about it? Can you guys map errno in earlier in the thread init proccess?
Do you even handle this? I'm surprised this doesn't happen in the init
function without my debugger. NJAMD works fine with pthreads, is there any way
to tell omniorb to use pthreads instead of omnithreads?
Any help you could give would be much appreciated by both me and at least one
of your users :)
--- example follows ---
cat > bad.cpp << EOF
#include <iostream.h>
#include <omniORB3/CORBA.h>
int main(int argc, char *argv[])
{
CORBA::ORB_ptr orb;
orb = CORBA::ORB_init(argc, argv, "omniORB3");
return 0;
}
EOF
cc bad.cpp -o bad -D__x86__ -g -Wall -I/usr/src/omni/include
-L/usr/src/omni/lib/i586_linux_2.0_glibc2.1
-lomnithread -lomniORB3 -lomniDynamic3 -ltcpwrapGK
gdb bad
(gdb) set env LD_PRELOAD=libnjamd.so
(gdb) run
Starting program: /home/mikepery/programming/bug/bad
Program received signal SIGSEGV, Segmentation fault.
0x402f4e98 in __gen_tempname (tmpl=0xbffff324 "/tmp/njamd-zeroXXXXXX",
openit=1, largefile=0) at ../sysdeps/posix/tempname.c:122
122 ../sysdeps/posix/tempname.c: No such file or directory.
Current language: auto; currently c
(gdb) bt
#0 0x402f4e98 in __gen_tempname (tmpl=0xbffff324 "/tmp/njamd-zeroXXXXXX",
openit=1, largefile=0) at ../sysdeps/posix/tempname.c:122
#1 0x40350684 in mkstemp (template=0xbffff324 "/tmp/njamd-zeroXXXXXX")
at mkstemp.c:30
#2 0x4001ed19 in __nj_primary_init () at setup.c:271
#3 0x4001f77b in malloc (size=24) at public.c:208
#4 0x804cc56 in __builtin_new (sz=24)
#5 0x4003a74d in omni_thread::init_t::init_t ()
from /usr/src/omni/lib/i586_linux_2.0_glibc2.1/libomnithread.so.2
#6 0x4029fbf8 in global constructors keyed to gateKeeper::version ()
from /usr/src/omni/lib/i586_linux_2.0_glibc2.1/libtcpwrapGK.so.1
#7 0x4029fc24 in __do_global_ctors_aux ()
from /usr/src/omni/lib/i586_linux_2.0_glibc2.1/libtcpwrapGK.so.1
#8 0x4029bfc6 in ?? ()
from /usr/src/omni/lib/i586_linux_2.0_glibc2.1/libtcpwrapGK.so.1
--
Mike Perry
http://got.fscked.org?