On Tue, Jun 30, 2009 at 9:09 AM, Thomas Maier<[email protected]> wrote:
> On Mon, Jun 29, 2009 at 10:09 PM, Roderich
> Schupp<[email protected]> wrote:
>> And that's very strange. This is before any Perl stuff (even
>> internally to the interpreter)
>> has had any chance to run, but libresolv.so.2 is being looked up
>> in /usr/lib/perl5/5.8.5/i386-linux-thread-multi/CORE.  Is
>> LD_LIBRARY_PATH set in the
> LD_LIBRARY_PATH is not set in this system. What it should be set to ?

Shouldn't be relevant, I was just wondering why this directory is
generally searched for shared libraries. In the meantime, I discovered
that pp-packed executables have RPATH set - on my machine

$ readelf -d hello.exe
# a pp-packed executable
File: hello.exe

Dynamic section at offset 0x169028 contains 26 entries:
  Tag        Type                         Name/Value
 0x0000000000000001 (NEEDED)             Shared library: [libm.so.6]
 0x0000000000000001 (NEEDED)             Shared library: [libdl.so.2]
 0x0000000000000001 (NEEDED)             Shared library: [libcrypt.so.1]
 0x0000000000000001 (NEEDED)             Shared library: [libpthread.so.0]
 0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]
 0x000000000000000f (RPATH)              Library rpath:
[/usr/lib/perl5/5.8.8/x86_64-linux-thread-multi/CORE]
 0x000000000000001d (RUNPATH)            Library runpath:
[/usr/lib/perl5/5.8.8/x86_64-linux-thread-multi/CORE]

Hmm, got time for a little experiment?

# binary patch your test executable "hello", replacing the offending
path with garbage
perl -e '$/=undef; my $r="/usr/lib/perl5/5.8.5/i386-linux-thread-multi/CORE";
   my $x="/foo/bar"; $x .= "\0" x (length($r) - length($x));
   $_ = <>; my $n = s#\Q$r\E#$x#g; print;'  hello > hello2

# check with readelf, that "hello2" is still a legal ELF executable,
but RPATH etc has changed
$ readelf -d hello2
...
 0x000000000000000f (RPATH)              Library rpath: [/foo/bar]
 0x000000000000001d (RUNPATH)            Library runpath: [/foo/bar]

# make it executable
$ chmod 755 hello2

# clean out PAR's cache to exclude interference from you previously
running "hello"
$ rm -rf /tmp/par-*

$ ./hello2

Does it work?

Cheers, Roderich

Reply via email to