mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Paul Sokolovsky <pmiscml@gmail.com>
To: musl@lists.openwall.com
Subject: [musl] foreign-dlopen: dlopen() from static binary, again (and not the way you think!)
Date: Thu, 23 Apr 2020 02:25:31 +0300	[thread overview]
Message-ID: <20200423022531.502e9d26@zenbook> (raw)

Hello,

Just as many (well, few) people I was surprised by the inability to
dlopen() from a static binary
(https://www.openwall.com/lists/musl/2012/12/08/4 , etc.). I started to
hack into musl's dynamic linker, just to find it a bit ... tangled.
That of course was nothing compared to taking a standalone ELF loader
and trying to deal with glibc's dynamic loader, that was total mess
(just look at https://github.com/robgjansen/elf-loader, which tried to
do that; tried, because it doesn't work with recent glibc versions,
and need constant patching).

Oh, forgot to say that I'm not looking for a way to load a
particular musl-dynlinked shared library into musl-staticlinked binary.
So, arguments like "but you'll need to carry around musl's libc.so"
don't apply. What I'm looking for is a way to have a static closed-world
application, but let it, at the user's request, to interface with
whatever system may be outside.

So, seeing what a mess is doing "honest" dynamic loading for real
world, and given my usecase, which is about wanting to touch that mess
as little as possible with bare hands, I came to a cute blackbox'ish
solution to an issue. The rest of the story and proof of concept code
is at https://github.com/pfalcon/foreign-dlopen .


(Sorry for somewhat tangled message, I made that proof of concept a
month ago and it was justing sitting in my github account, so posting
mostly for search engines' use, to help people who may come up to
similar needs, whenever that may happen.)

-- 
Best regards,
 Paul                          mailto:pmiscml@gmail.com

             reply	other threads:[~2020-04-22 23:25 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-22 23:25 Paul Sokolovsky [this message]
2020-04-23  2:39 ` Rich Felker
2020-04-23  9:16   ` Paul Sokolovsky
2020-04-23 12:22     ` Szabolcs Nagy
2020-04-23 16:24       ` Rich Felker

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=20200423022531.502e9d26@zenbook \
    --to=pmiscml@gmail.com \
    --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).