mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Rich Felker <dalias@aerifal.cx>
To: musl@lists.openwall.com
Subject: Re: ldso: dlclose.
Date: Thu, 23 Aug 2012 14:01:38 -0400	[thread overview]
Message-ID: <20120823180138.GR27715@brightrain.aerifal.cx> (raw)
In-Reply-To: <20120824000209.74ab2a3b@sibserver.ru>

On Fri, Aug 24, 2012 at 12:02:09AM +0800, orc wrote:
> On Thu, 23 Aug 2012 08:48:16 -0400
> Rich Felker <dalias@aerifal.cx> wrote:
> 
> > Anyway, unless the issue is fixed in binutils so that the vast
> > majority of libraries are marked non-unloadable, I don't see anything
> > we can do in musl. "glibc does it that way too" is not an excuse for
> > adding unsafe/non-robust behavior to musl.
> > 
> > Rich
> 
> The whole dlopen/dlclose/dlsym functions family are 'harmful': even if
> we want static linking, application will still rely on them and fail
> invisibly, creating more headaches.
> I think better leave dlclose() in it's current state now. It will always
> 'success', nobody will care.

In my view, there are only two downsides to the current behavior:

1. Some buggy plugin-based applications may expect dlclose(plugin) to
call the destructors in the plugin. This is of course an invalid
expectation per POSIX, but it may be the reality for some apps.

2. In an extremely long-lived app that loads and unloads plugins which
may be upgraded multiple times during the application's lifetime, each
new version of the plugin will consume additional virtual memory space
and commit charge, i.e. you have a memory leak. In the real world the
leak should be very slow, but it could become significant if the
plugins are very large and get reinstalled many times, perhaps if
someone is experimenting and running "make install" each time...

In my view #2 is a very low-priority problem that's not worth caring
about on its own, but #1 may be relevant. If does become an important
issue that we can't get fixed at the application level, I think the
solution would be to add unloading, but have it only take effect for
the actual argument to dlopen/dlclose, never any libraries implicitly
loaded as dependencies (and of course to honor the flag that prevents
unloading).

Rich


  reply	other threads:[~2012-08-23 18:01 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-19 16:26 musl
2012-08-20  0:48 ` Rich Felker
2012-08-22 22:41   ` Rich Felker
2012-08-23 12:39   ` Arvid E. Picciani
2012-08-23 12:48     ` Rich Felker
2012-08-23 16:02       ` orc
2012-08-23 18:01         ` Rich Felker [this message]
2012-08-24  7:52           ` musl
2012-08-24 12:27             ` Rich Felker
2012-08-24 13:54               ` musl
2012-08-24 17:46                 ` Rich Felker
2012-08-25  7:54                   ` boris brezillon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120823180138.GR27715@brightrain.aerifal.cx \
    --to=dalias@aerifal.cx \
    --cc=musl@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).