LD_PRELOAD for 64bit binary but not 32binary which gets invoked

LD_PRELOAD for 64bit binary but not 32binary which gets invoked

am 19.10.2007 22:02:10 von Nikhil

I have a 64-bit binary which execs 32-bit binary. I am trying to use a
shared object(again 64-bit file) in LD_PRELOAD for some tests on the
64-bit binary, but unfortunately this LD_PRELOAD has effect on the
32-bit binary as well resulting in failure of its execution with wrong
ELF class.

my command line invocation is

env LD_PRELOAD="64-bit-shared-object.so" 64-bit-binary --arguments

this command would later(after some checks) invoke the 32-bit binary. My
problem is that the 64-bit-shared-object.so is not compatible for its
incompatible ELF structure with the 32-bit binary.

How can I make sure that this LD_PRELOAD effect is there with only the
64-bit-binary process execution, but not on the 32-bit binary?

Are there any other variables in the class of LD_PRELOAD? Can someone
please throw some light?

Thanks.

Re: LD_PRELOAD for 64bit binary but not 32binary which gets invoked

am 19.10.2007 23:30:57 von Frank Langelage

Nikhil wrote:
> I have a 64-bit binary which execs 32-bit binary. I am trying to use a
> shared object(again 64-bit file) in LD_PRELOAD for some tests on the
> 64-bit binary, but unfortunately this LD_PRELOAD has effect on the
> 32-bit binary as well resulting in failure of its execution with wrong
> ELF class.
>
> my command line invocation is
>
> env LD_PRELOAD="64-bit-shared-object.so" 64-bit-binary --arguments
>
> this command would later(after some checks) invoke the 32-bit binary. My
> problem is that the 64-bit-shared-object.so is not compatible for its
> incompatible ELF structure with the 32-bit binary.
>
> How can I make sure that this LD_PRELOAD effect is there with only the
> 64-bit-binary process execution, but not on the 32-bit binary?
>
> Are there any other variables in the class of LD_PRELOAD? Can someone
> please throw some light?
>
> Thanks.

Use LD_PRELOAD_64 instead in this case.

Re: LD_PRELOAD for 64bit binary but not 32binary which gets invoked

am 20.10.2007 00:59:39 von Nikhil

Frank Langelage wrote:
> Nikhil wrote:
>> I have a 64-bit binary which execs 32-bit binary. I am trying to use a
>> shared object(again 64-bit file) in LD_PRELOAD for some tests on the
>> 64-bit binary, but unfortunately this LD_PRELOAD has effect on the
>> 32-bit binary as well resulting in failure of its execution with wrong
>> ELF class.
>>
>> my command line invocation is
>>
>> env LD_PRELOAD="64-bit-shared-object.so" 64-bit-binary --arguments
>>
>> this command would later(after some checks) invoke the 32-bit binary.
>> My problem is that the 64-bit-shared-object.so is not compatible for
>> its incompatible ELF structure with the 32-bit binary.
>>
>> How can I make sure that this LD_PRELOAD effect is there with only the
>> 64-bit-binary process execution, but not on the 32-bit binary?
>>
>> Are there any other variables in the class of LD_PRELOAD? Can someone
>> please throw some light?
>>
>> Thanks.
>
> Use LD_PRELOAD_64 instead in this case.
Thanks Frank :)

I just happen to read an example from
http://docs.sun.com/app/docs/doc/819-3055/6n5a6lhf9?a=view

How do I know that this 64-bit-binary can be influenced by LD_PRELOAD_64
? without actually getting it executed.

Regards, Nikhil

Re: LD_PRELOAD for 64bit binary but not 32binary which gets invoked

am 20.10.2007 01:07:38 von Nikhil

Nikhil wrote:
> Frank Langelage wrote:
>> Nikhil wrote:
>>> I have a 64-bit binary which execs 32-bit binary. I am trying to use
>>> a shared object(again 64-bit file) in LD_PRELOAD for some tests on
>>> the 64-bit binary, but unfortunately this LD_PRELOAD has effect on
>>> the 32-bit binary as well resulting in failure of its execution with
>>> wrong ELF class.
>>>
>>> my command line invocation is
>>>
>>> env LD_PRELOAD="64-bit-shared-object.so" 64-bit-binary --arguments
>>>
>>> this command would later(after some checks) invoke the 32-bit binary.
>>> My problem is that the 64-bit-shared-object.so is not compatible for
>>> its incompatible ELF structure with the 32-bit binary.
>>>
>>> How can I make sure that this LD_PRELOAD effect is there with only
>>> the 64-bit-binary process execution, but not on the 32-bit binary?
>>>
>>> Are there any other variables in the class of LD_PRELOAD? Can someone
>>> please throw some light?
>>>
>>> Thanks.
>>
>> Use LD_PRELOAD_64 instead in this case.
> Thanks Frank :)
>
> I just happen to read an example from
> http://docs.sun.com/app/docs/doc/819-3055/6n5a6lhf9?a=view
>
> How do I know that this 64-bit-binary can be influenced by LD_PRELOAD_64
> ? without actually getting it executed.
>
> Regards, Nikhil
BTW, is there any direct mechanism to know what are the libraries loaded
in the current process. Just to check LD_PRELOAD_32 effects only the
32-bit binary and LD_PRELOAD_64 is effecting the 64-bit. Anything to
read from the /proc filesystem or any tool such?

Thanks.

Re: LD_PRELOAD for 64bit binary but not 32binary which gets invoked

am 20.10.2007 01:11:22 von Nikhil

Nikhil wrote:
> Nikhil wrote:
>> Frank Langelage wrote:
>>> Nikhil wrote:
>>>> I have a 64-bit binary which execs 32-bit binary. I am trying to use
>>>> a shared object(again 64-bit file) in LD_PRELOAD for some tests on
>>>> the 64-bit binary, but unfortunately this LD_PRELOAD has effect on
>>>> the 32-bit binary as well resulting in failure of its execution with
>>>> wrong ELF class.
>>>>
>>>> my command line invocation is
>>>>
>>>> env LD_PRELOAD="64-bit-shared-object.so" 64-bit-binary --arguments
>>>>
>>>> this command would later(after some checks) invoke the 32-bit
>>>> binary. My problem is that the 64-bit-shared-object.so is not
>>>> compatible for its incompatible ELF structure with the 32-bit binary.
>>>>
>>>> How can I make sure that this LD_PRELOAD effect is there with only
>>>> the 64-bit-binary process execution, but not on the 32-bit binary?
>>>>
>>>> Are there any other variables in the class of LD_PRELOAD? Can
>>>> someone please throw some light?
>>>>
>>>> Thanks.
>>>
>>> Use LD_PRELOAD_64 instead in this case.
>> Thanks Frank :)
>>
>> I just happen to read an example from
>> http://docs.sun.com/app/docs/doc/819-3055/6n5a6lhf9?a=view
>>
>> How do I know that this 64-bit-binary can be influenced by
>> LD_PRELOAD_64 ? without actually getting it executed.
>>
>> Regards, Nikhil
> BTW, is there any direct mechanism to know what are the libraries loaded
> in the current process. Just to check LD_PRELOAD_32 effects only the
> 32-bit binary and LD_PRELOAD_64 is effecting the 64-bit. Anything to
> read from the /proc filesystem or any tool such?
>
> Thanks.
Seems like I do get it, by listing in /proc/processid/path/
atleast that was for Solaris. Thanks again.

Re: LD_PRELOAD for 64bit binary but not 32binary which gets invoked

am 20.10.2007 13:25:28 von Frank Langelage

Nikhil wrote:
> Nikhil wrote:
>> Frank Langelage wrote:
>>> Nikhil wrote:
>>>> I have a 64-bit binary which execs 32-bit binary. I am trying to use
>>>> a shared object(again 64-bit file) in LD_PRELOAD for some tests on
>>>> the 64-bit binary, but unfortunately this LD_PRELOAD has effect on
>>>> the 32-bit binary as well resulting in failure of its execution with
>>>> wrong ELF class.
>>>>
>>>> my command line invocation is
>>>>
>>>> env LD_PRELOAD="64-bit-shared-object.so" 64-bit-binary --arguments
>>>>
>>>> this command would later(after some checks) invoke the 32-bit
>>>> binary. My problem is that the 64-bit-shared-object.so is not
>>>> compatible for its incompatible ELF structure with the 32-bit binary.
>>>>
>>>> How can I make sure that this LD_PRELOAD effect is there with only
>>>> the 64-bit-binary process execution, but not on the 32-bit binary?
>>>>
>>>> Are there any other variables in the class of LD_PRELOAD? Can
>>>> someone please throw some light?
>>>>
>>>> Thanks.
>>>
>>> Use LD_PRELOAD_64 instead in this case.
>> Thanks Frank :)
>>
>> I just happen to read an example from
>> http://docs.sun.com/app/docs/doc/819-3055/6n5a6lhf9?a=view
>>
>> How do I know that this 64-bit-binary can be influenced by
>> LD_PRELOAD_64 ? without actually getting it executed.
>>
>> Regards, Nikhil
> BTW, is there any direct mechanism to know what are the libraries loaded
> in the current process. Just to check LD_PRELOAD_32 effects only the
> 32-bit binary and LD_PRELOAD_64 is effecting the 64-bit. Anything to
> read from the /proc filesystem or any tool such?
>
> Thanks.

man pldd.

Re: LD_PRELOAD for 64bit binary but not 32binary which gets invoked

am 20.10.2007 13:38:15 von Nikhil

Frank Langelage wrote:
> Nikhil wrote:
>> Nikhil wrote:
>>> Frank Langelage wrote:
>>>> Nikhil wrote:
>>>>> I have a 64-bit binary which execs 32-bit binary. I am trying to
>>>>> use a shared object(again 64-bit file) in LD_PRELOAD for some tests
>>>>> on the 64-bit binary, but unfortunately this LD_PRELOAD has effect
>>>>> on the 32-bit binary as well resulting in failure of its execution
>>>>> with wrong ELF class.
>>>>>
>>>>> my command line invocation is
>>>>>
>>>>> env LD_PRELOAD="64-bit-shared-object.so" 64-bit-binary --arguments
>>>>>
>>>>> this command would later(after some checks) invoke the 32-bit
>>>>> binary. My problem is that the 64-bit-shared-object.so is not
>>>>> compatible for its incompatible ELF structure with the 32-bit binary.
>>>>>
>>>>> How can I make sure that this LD_PRELOAD effect is there with only
>>>>> the 64-bit-binary process execution, but not on the 32-bit binary?
>>>>>
>>>>> Are there any other variables in the class of LD_PRELOAD? Can
>>>>> someone please throw some light?
>>>>>
>>>>> Thanks.
>>>>
>>>> Use LD_PRELOAD_64 instead in this case.
>>> Thanks Frank :)
>>>
>>> I just happen to read an example from
>>> http://docs.sun.com/app/docs/doc/819-3055/6n5a6lhf9?a=view
>>>
>>> How do I know that this 64-bit-binary can be influenced by
>>> LD_PRELOAD_64 ? without actually getting it executed.
>>>
>>> Regards, Nikhil
>> BTW, is there any direct mechanism to know what are the libraries
>> loaded in the current process. Just to check LD_PRELOAD_32 effects
>> only the 32-bit binary and LD_PRELOAD_64 is effecting the 64-bit.
>> Anything to read from the /proc filesystem or any tool such?
>>
>> Thanks.
>
> man pldd.
Thanks again Frank :). This was helpful (something new to learn today)

It does some to be checking the /proc/pid/object/* files.