From: Alexander Monakov <amonakov@ispras.ru>
To: musl@lists.openwall.com
Subject: Re: Making a shared library that intercepts call to main work with musl compiled binary
Date: Mon, 6 Jul 2015 23:34:49 +0300 (MSK) [thread overview]
Message-ID: <alpine.LNX.2.11.1507062323490.2485@monopod.intra.ispras.ru> (raw)
In-Reply-To: <20150706190651.GY1173@brightrain.aerifal.cx>
> > Furthermore, even with dynamic linking you cannot interpose 'main' in the
> > executable via LD_PRELOAD. Even more baffling is that the linked code
> > interposes __libc_start_main; I'm lost for words that it happens to work with
> > glibc.
>
> Presumably it interposes __libc_start_main because it can't interpose
> main. As far as I can tell the only reason it does this is to inject
> fake argv. I'm skeptical as to whether it works correctly.
I was wrong about interposition on __libc_start_main being somehow surprising
-- I missed that it's called from the main executable's startup routine, not
from the dynamic linker (thanks to Rich for explaining that on IRC!). So as a
result I expect that original code should usually work in practice.
Alexander
prev parent reply other threads:[~2015-07-06 20:34 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-06 17:00 Riyad Parvez
2015-07-06 17:32 ` Rich Felker
2015-07-06 19:00 ` Alexander Monakov
2015-07-06 19:06 ` Rich Felker
2015-07-06 20:34 ` Alexander Monakov [this message]
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=alpine.LNX.2.11.1507062323490.2485@monopod.intra.ispras.ru \
--to=amonakov@ispras.ru \
--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).