[<prev] [next>] [day] [month] [year] [list]
Message-ID: <CAOtvUMdQApbRCd-+kK8LPiVE6+uk=ERnM76z8UNoapCqV=jP6Q@mail.gmail.com>
Date: Mon, 21 Nov 2011 16:28:59 +0200
From: Gilad Ben-Yossef <gilad@...yossef.com>
To: Xin Tong <xerox.time.tech@...il.com>
Cc: linux-kernel <linux-kernel@...r.kernel.org>
Subject: Re: Running Application Inside Application
On Mon, Nov 21, 2011 at 2:54 PM, Xin Tong <xerox.time.tech@...il.com> wrote:
>
> Your method looks interesting and neat. I have another question, is there a way for me to preload a .so and hijack the startup32 function so that it does not call main, instead it calls some functions within the preloaded .so ?
>
Donno, on your constructor, locate the symbol for main and plant a
jump or call instruction there to your function in the .so? this gets
real hairy real quick...
At any rate, it is not Linux kernel mailing list stuff. Try StackOverflow... :-)
Gilad
> Thanks
>
>
> Xin
>
> On Mon, Nov 21, 2011 at 1:41 AM, Gilad Ben-Yossef <gilad@...yossef.com> wrote:
>>
>> On Mon, Nov 21, 2011 at 4:18 AM, Xin Tong <xerox.time.tech@...il.com> wrote:
>>>
>>> I have applications that do not install signal handlers I need it to
>>> install. Therefore, I am thinking about having a light-weight run-time
>>> to load the application ELF file and install the needed signal handler
>>> in the run-time ? Is this doable ? What if it is not ELF-encoded ?
>>
>> There is a much easier way: create a dynamically linked library (let's call it libsig.so) with code like so:
>> int install_sig_handlers __attribute__((constructor)) {
>> // Do what you need here
>> }
>> Then run your app like so:
>> LD_PRELOAD=/path/to/libsig.so /path/to/your/app
>> Unless your application is static and/or SUID the dynamic linker will load libsig.so into your app memory space and will run the constructor function where you can install signal handler at will
>> Gilad
>>
>>>
>>> Thanks
>>>
>>> Xin
>>> --
>>> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
>>> the body of a message to majordomo@...r.kernel.org
>>> More majordomo info at http://vger.kernel.org/majordomo-info.html
>>> Please read the FAQ at http://www.tux.org/lkml/
>>
>>
>>
>> --
>> Gilad Ben-Yossef
>> Chief Coffee Drinker
>> gilad@...yossef.com
>> Israel Cell: +972-52-8260388
>> US Cell: +1-973-8260388
>> http://benyossef.com
>>
>> "Unfortunately, cache misses are an equal opportunity pain provider."
>> -- Mike Galbraith, LKML
>
--
Gilad Ben-Yossef
Chief Coffee Drinker
gilad@...yossef.com
Israel Cell: +972-52-8260388
US Cell: +1-973-8260388
http://benyossef.com
"Unfortunately, cache misses are an equal opportunity pain provider."
-- Mike Galbraith, LKML
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists