dlclose problem

Michael Nottebrock michaelnottebrock at gmx.net
Sat Jun 19 16:20:50 GMT 2004

Attached is a small testcase made by Frerich Raabe (cc'd) which segfaults on 
-STABLE and 5.2.1-R but not on -CURRENT as of June 17th - I can't find what's 
changed in libc that prevents the segfault though. Any clues?

Frerich had this to say about the problem and testcase (it originally surfaced 
in KDE/Qt):

> I think this is a flaw in the dlclose() code of the C library. The KDE
> styles are implemented as plugins (read: shared libraries) and allocate
> memory on the free store, and initialize static variables.
> The problem is that dlclose() does not seem to destruct those statics
> properly though, but silently succeeds. Then the main program triggers a
> segmentation fault as it tries to call __tfc_0 (an internal g++ function
> AFAICS) in the plugin - but the plugin has been unloaded already.
> IMHO the true fix would be to fix the C library.
> I attached a simple testcase which demonstrates the problem using nothing
> standard C and C++ library calls, so you don't have to install KDE to 
> reproduce this crash. Note that making "s" (in plugin.cc) a normal (auto) 
> variable and not static does not trigger the crash.

   ,_,   | Michael Nottebrock               | lofi at freebsd.org
 (/^ ^\) | FreeBSD - The Power to Serve     | http://www.freebsd.org
   \u/   | K Desktop Environment on FreeBSD | http://freebsd.kde.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: signature
Url : http://lists.freebsd.org/pipermail/freebsd-current/attachments/20040619/f1e53328/attachment.bin

More information about the freebsd-current mailing list