Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <alpine.LNX.2.11.1507062323490.2485@monopod.intra.ispras.ru>
Date: Mon, 6 Jul 2015 23:34:49 +0300 (MSK)
From: Alexander Monakov <amonakov@...ras.ru>
To: musl@...ts.openwall.com
Subject: Re: Making a shared library that intercepts call to main work
 with musl compiled binary

> > 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

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.