dlopen(), atexit() crash on FreeBSD (testcase included)

Markus Hoenicka markus.hoenicka at mhoenicka.de
Tue Jan 1 07:44:46 PST 2008


Tim Kientzle writes:
 > I would be curious to see the results of running your
 > sample program (with lots of extra fprint(stderr...)
 > calls, of course) on Linux to see whether it calls the
 > registered exit function at dlclose time or never.
 > 
 > I suspect the answer is "never."  If I'm right, the
 > Firebird folks might be easier to convince (since it
 > means that their atexit() registration isn't really
 > reliable anywhere).
 > 

I've opened a Firebird bug report, so please don't misread me as
"please fix it on the FreeBSD end". But interestingly, I get the
following output of my test program on Linux (note that you have to
link against libdl on Linux as their libc does not contain the dl*
functions):

markus at ocean:~/prog/datest$ ./datest
hello driver
now exiting

So the installed handler is called and runs ok. I'm wondering if this
just so happens to work, or if Linux uses some weird mechanism to keep
the installed routines accessible. But again, there is no need to
investigate this any further, I'm just curious by design.

regards,
Markus

-- 
Markus Hoenicka
markus.hoenicka at cats.de
(Spam-protected email: replace the quadrupeds with "mhoenicka")
http://www.mhoenicka.de



More information about the freebsd-hackers mailing list