Unix Technical Forum

Change loader for programs

This is a discussion on Change loader for programs within the Debian Linux Users forum forums, part of the Debian Linux category; --> Hello world, I would like to ask a rookie question about the possibility to reassign by substitution a new ...


Go Back   Unix Technical Forum > Unix Operating Systems > Debian Linux > Debian Linux Users forum

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 01-25-2008, 09:36 PM
Emmanuel QUEMENER
 
Posts: n/a
Default Change loader for programs

Hello world,

I would like to ask a rookie question about the possibility to reassign
by substitution a new loader (/lib/ld-linux.so.2 or alike) to each program.

In fact, I know that it's possible to launch it for example echo by
using /new/path/lib/ld-2.3.2 /new/path/bin/echo but I would like to do
it without specifiing boot loader.

I've investigate in elf tools and I've found objdump and objcopy.

I discover by objdump that the loader is specified in .interp section.
So I try the following commands

cd /tmp
objcopy --remove-section=.interp /bin/echo /tmp/echo
echo -n "/lib/ld-linux.so.2" > foo
objcopy --add-section .interp=foo /tmp/echo /tmp/echo.new

and, unfortunately:

../echo.new
bash: ./echo.new: cannot execute binary file

With objdump, here are my output :

$ objdump -Sl -j .interp /tmp/echo.new

/tmp/echo.new: format de fichier elf32-i386

Déassemblage de la section .interp:

00000000 <opterr-0x804c460>:
0: 2f das
1: 6c insb (%dx),%es%edi)
2: 69 62 2f 6c 64 2d 6c imul $0x6c2d646c,0x2f(%edx),%esp
9: 69 6e 75 78 2e 73 6f imul $0x6f732e78,0x75(%esi),%ebp
10: 2e cs
11: 32 .byte 0x32

$ objdump -Sl -j .interp /bin/echo

/bin/echo: format de fichier elf32-i386

Déassemblage de la section .interp:

08048114 <.interp>:
8048114: 2f das
8048115: 6c insb (%dx),%es%edi)
8048116: 69 62 2f 6c 64 2d 6c imul $0x6c2d646c,0x2f(%edx),%esp
804811d: 69 6e 75 78 2e 73 6f imul $0x6f732e78,0x75(%esi),%ebp
8048124: 2e 32 00 xor %cs%eax),%al

This changing loader property would help me to have an operational
Debian system on a user (non chroot account).

Thanks for answer

EQ



--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 08:07 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
www.UnixAdminTalk.com