mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Szabolcs Nagy <nsz@port70.net>
To: musl@lists.openwall.com
Subject: Re: dlopen'ing glibc linked libraries
Date: Thu, 23 Jan 2014 11:07:55 +0100	[thread overview]
Message-ID: <20140123100755.GM1685@port70.net> (raw)
In-Reply-To: <20140121181726.GL1685@port70.net>

* Szabolcs Nagy <nsz@port70.net> [2014-01-21 19:17:27 +0100]:
> it may be possible to solve a lot of compatibility issues with
> preloading an extra lib next to musl, i experimented with running
> applications with
> 
> export LD_LIBRARY_PATH=/usr/lib:/usr/lib/i386-linux-gnu:/lib/i386-linux-gnu
> export LD_PRELOAD=./libcompat.so
> /lib/ld-musl-i386.so /usr/bin/something

i did further experiments, the issues i found so far:

- brk pointer is sometimes at the wrong place at start up
so malloc fails (kernel bug, rarely happens here)

- some applications read /proc/self/exe to determine the
path to their binary (to start other instances with
different arguments) but that will point to the loader

- some applications use gcc's closure extension so they
need executable stack (the kernel maps the loader with
non-executable stack)

these are all rare and can be worked around by modifying
the interpreter in the binary using patchelf (or setting
up a namespace where /lib/ld-linux.so.2 points to musl)

- binaries compiled without _FILE_OFFSET_BITS=64 are not
compatible with musl on i386 (on my debian stable system
there are more than 200 binaries and libraries which use
readdir, __[fl]xstat instead of readdir64, __[fl]xstat64)
(this is probably the biggest obstacle for compatibility)

- programs using sbrk fail (affects programs that try to
implement their own malloc (eg bash) or programs using the
boehm gc) (this will go away when musl's alloc is updated)

- i had to add many symbols (>300) most of them are trivial
wrappers, but some of them would be hard to do correctly
(the implementation internals like __pthread_register_cancel
and the messy nss/nscd/rpc apis are the most painful ones)


  reply	other threads:[~2014-01-23 10:07 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-21 13:57 Gabriel Jacobo
2014-01-21 14:31 ` John Spencer
2014-01-21 14:44   ` Gabriel Jacobo
2014-01-21 16:28     ` John Spencer
2014-01-21 18:17     ` Szabolcs Nagy
2014-01-23 10:07       ` Szabolcs Nagy [this message]
2014-01-24 10:07         ` Justin Cormack
2014-01-24 13:41           ` Szabolcs Nagy

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=20140123100755.GM1685@port70.net \
    --to=nsz@port70.net \
    --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).