[omniNotify] 64 bit notifd on Solaris 2.8 core dumps immediately
Mark Zimmerman
markzimm at frii.com
Wed Jun 15 11:46:10 BST 2005
Greetings:
I have tracked down the root cause of the error and I am pondering the
correct solution. Here is what is happening:
In RDINotifServer.cc, we have the declaration:
CosNA::ChannelID channID;
CosNA::ChannelID is a typedef that means CORBA::Long so it is a 32 bit
value even if you are building 64 bit code. This value is passed by
reference from RDINotifServer.cc:385 into EventChannel_i.cc (lines 1827,
1814). Everything is fine up to now.
>From EventChannel_i.cc:1814, it goes into RDIHash.h:217, which sets us
up for failure. The problem is that when this reference to a 32 bit
value gets here, it becomes (inappropriately) a reference to a Class and
references to Class are 64 bits wide. From here, it gets passed further
down (RDIHash.h:366, 375) into RDIHashFuncs.h:97 where it uses this
pointer to a 32 bit value to attempt to read a 64 bit value. On the
Sparc platform this results in a Bus Error half of the time due to
address misalignment.
To test this out, I changed RDIHashFuncs.h as follows:
Old Code:
inline unsigned int RDI_ULongHash(const void* K)
{ return *((unsigned long *) K); }
New Code:
inline unsigned int RDI_ULongHash(const void* K)
{
unsigned int *ptr = (unsigned int *) K;
unsigned int val = *ptr;
return val;
}
Multiple lines are used to help pinpoint memory faults.
notifd seems to run fine with this change but I am concerned that this
might break it in other ways I have not yet encountered.
Once again, any insights are appreciated.
-- Mark
More information about the omninotify-list
mailing list