> scenario 2: not working
> library X --uses--> cryptopp
> libraries A, B --use--> X
> library C --uses--> cryptopp (directly!)
> also C --uses--> X
> Apache --loads--> A, B, C
I was not able to duplicate the issue. My setup had a traditional EXE
using cryptopp.so directly, with 3 SOs (loaded by the EXE) that each
used cryptopp.so. I guess mine looked more like:
EXE -> cryptopp.so
SO1 -> cryptopp.so
SO2 -> cryptopp.so
SO3 -> cryptopp.so
The EXE linked directly against cryptopp.so (-lcryptopp), but it
dynamically loaded the three test SOs (dlopen(), dlsym(), dlclose()).
The three SOs linked directly against cryptopp.so (-lcryptopp). The
EXE had 16 threads which round-robined one of the DSOs. The EXE and
SOs used the X917 generator, AES, and SHA. In each case, I was able to
verify that cryptopp.so was mapped in once, and the EXE and DSO all
claimed the same load address for Crypto++.
> We get an error (crash) on something with
> name-value pairs.
Two questions: (1) was the debug info stripped? (2) if not stripped,
what was the call stack?
> My hunch is that, even though the OS should load
> a shared lib only once, some initialization occurs twice
> and fails on some static or global update. Is there
> some implicit initialization of cryptopp that should
> happen only once?
Maybe Wei can correct me here, but most likely not. Crypto++ objects
were written to be re-entrant. But a call stack would be needed so the
object in question (AES, SHA1, etc) can be examined more closely.
I took the default library setup from Fedora for the tests. The test
setup above may (or may not be) different than what Zooko describes in
his notes, and what you're using for CentOS. For example, my
RTLD_GLOBAL setting is what ever the package maintainer made it.