Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Mon, 6 Jul 2015 13:32:59 -0400
From: Rich Felker <dalias@...c.org>
To: musl@...ts.openwall.com
Subject: Re: Making a shared library that intercepts call to main work
 with musl compiled binary

On Mon, Jul 06, 2015 at 01:00:52PM -0400, Riyad Parvez wrote:
> Hi All,
> 
> I've shared library [1] which intercepts loading of a binary and does some
> pre-processing with the command-line arguments via "LD_PRELOAD" technique.
> The shared library works fine with glibc compiled binary i.e., it can
> intercept the call to main and does some preprocessing. But it can't
> intercept call to "main" in musl-compiled binary. I've compiled my binary
> in static mode with musl "CC=/musl-gcc -static". How can I make the shared
> library work with musl-compiled binary?
> 
> Thanks
> Riyad
> 
> [1]: https://github.com/dslab-epfl/s2e/blob/master/guest/init_env/init_env.c

I haven't read this code in detail, so I don't have any advice on
whether there are other problems, but the basic issue seems to be that
you're static linking. The same would happen if you use glibc and
static link. If you want the ability to use LD_PRELOAD you need to
link dynamically.

Rich

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.