dlclose problem

From: Michael Nottebrock <michaelnottebrock_at_gmx.net>
Date: Sat, 19 Jun 2004 18:20:26 +0200
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

Received on Sat Jun 19 2004 - 14:20:50 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:37:58 UTC