how does ld.so call ELF's entry?
For an ELF ,which needs a interpreter , how is it been called by the interpreter ?
As I know the interpreter is loaded first and do something essential ,then call the main routine of ELF . How is this procedure implemented ?
Thanks!
Hello,
The interpreter is specified during linking process and the program header of your binary is filled with good values.
Then when the operating system load your binary, he finds next the interpreter to use.
The linker ld sets the good values by default but you can overwrite it or specify other values if you want.
The steps are:
1)The operating system loads your binary
2)The program loader system execute the Interpreter specifiy in the binary 3)The interpreter gather all the dynamic libraries needed in memory 4)The Control is passed to the entry point of your program
The entry point is specified in your code source as a "global". And could be find in your object file by the linker.
In theory there are some defaults tag to specify entry point, like "..start" for nasm, but you can also passed yours to the linker (ld -e).
regards,
Sofiane Akermoun
[email protected]
2013/4/7 ishare <[email protected]>:
Quoted 11 lines
For an ELF ,which needs a interpreter , how is it been called by the interpreter ?
As I know the interpreter is loaded first and do something essential ,then call the main routine of ELF . How is this procedure implemented ?
Thanks!
--
To unsubscribe from this list: send the line "unsubscribe linux-assembly" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Signature · 2 lines
Sofiane AKERMOUN [email protected]
A message that is not in the archive (sent off-list or not yet received): CAN0_x-Je1=2mtN8tY2mvBa-X7_P0dBoG9KRh0P63uW91eE5H2Q@mail.gmail.com
Quoted 15 lines · Sofiane Akermoun
Hello,
The interpreter is specified during linking process and the program header of your binary is filled with good values.
Then when the operating system load your binary, he finds next the interpreter to use.
The linker ld sets the good values by default but you can overwrite it or specify other values if you want.
The steps are:
1)The operating system loads your binary
2)The program loader system execute the Interpreter specifiy in the binary 3)The interpreter gather all the dynamic libraries needed in memory
Quoted 1 line
4)The Control is passed to the entry point of your program
How does the step 4 been done ?
thanks!
Quoted 38 lines
The entry point is specified in your code source as a "global". And could be find in your object file by the linker.
In theory there are some default tag to specify entry point, like "..start" for nasm, but you can also passed it to the linker.regards,
Sofiane Akermoun
[email protected]2013/4/7 ishare <[email protected]>
Quoted 15 lines
For an ELF ,which needs a interpreter , how is it been called by the
interpreter ?As I know the interpreter is loaded first and do something essential
,then call the main routine of ELF .
How is this procedure implemented ?Thanks!
--
To unsubscribe from this list: send the line "unsubscribe linux-assembly" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.htmlSignature · 2 lines
Sofiane AKERMOUN [email protected]
With a far jump to entry offset
Sent from my iPad
Quoted 62 lines · ishare
Quoted 15 lines · Sofiane Akermoun
Hello,
The interpreter is specified during linking process and the program header of your binary is filled with good values.
Then when the operating system load your binary, he finds next the interpreter to use.
The linker ld sets the good values by default but you can overwrite it or specify other values if you want.
The steps are:
1)The operating system loads your binary
2)The program loader system execute the Interpreter specifiy in the binary 3)The interpreter gather all the dynamic libraries needed in memoryQuoted 1 line
4)The Control is passed to the entry point of your program
How does the step 4 been done ?
thanks!
Quoted 25 lines
The entry point is specified in your code source as a "global". And could be find in your object file by the linker.
In theory there are some default tag to specify entry point, like "..start" for nasm, but you can also passed it to the linker.regards,
Sofiane Akermoun
[email protected]2013/4/7 ishare <[email protected]>
Quoted 8 lines
For an ELF ,which needs a interpreter , how is it been called by the
interpreter ?As I know the interpreter is loaded first and do something essential
,then call the main routine of ELF .
How is this procedure implemented ?Quoted 12 lines
Quoted 6 lines
Thanks!
--
To unsubscribe from this list: send the line "unsubscribe linux-assembly" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.htmlSignature · 2 lines
Sofiane AKERMOUN [email protected]--
To unsubscribe from this list: send the line "unsubscribe linux-assembly" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 1 line · Chris Evans
With a far jump to entry offset
How does it know the entry point's address?
Quoted 68 lines
Sent from my iPad
Quoted 62 lines · ishare
Quoted 15 lines · Sofiane Akermoun
Hello,
The interpreter is specified during linking process and the program header of your binary is filled with good values.
Then when the operating system load your binary, he finds next the interpreter to use.
The linker ld sets the good values by default but you can overwrite it or specify other values if you want.
The steps are:
1)The operating system loads your binary
2)The program loader system execute the Interpreter specifiy in the binary 3)The interpreter gather all the dynamic libraries needed in memoryQuoted 1 line
4)The Control is passed to the entry point of your program
How does the step 4 been done ?
thanks!
Quoted 25 lines
The entry point is specified in your code source as a "global". And could be find in your object file by the linker.
In theory there are some default tag to specify entry point, like "..start" for nasm, but you can also passed it to the linker.regards,
Sofiane Akermoun
[email protected]2013/4/7 ishare <[email protected]>
Quoted 8 lines
For an ELF ,which needs a interpreter , how is it been called by the
interpreter ?As I know the interpreter is loaded first and do something essential
,then call the main routine of ELF .
How is this procedure implemented ?Quoted 12 lines
Quoted 6 lines
Thanks!
--
To unsubscribe from this list: send the line "unsubscribe linux-assembly" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.htmlSignature · 2 lines
Sofiane AKERMOUN [email protected]--
To unsubscribe from this list: send the line "unsubscribe linux-assembly" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
EntryPoint is set in the ELF Header at assembling/linking time.
2013/4/7 ishare <[email protected]>:
Quoted 77 lines · Chris Evans
Quoted 1 line
With a far jump to entry offset
How does it know the entry point's address?
Quoted 68 lines
Sent from my iPad
Quoted 62 lines · ishare
Quoted 15 lines · Sofiane Akermoun
Hello,
The interpreter is specified during linking process and the program header of your binary is filled with good values.
Then when the operating system load your binary, he finds next the interpreter to use.
The linker ld sets the good values by default but you can overwrite it or specify other values if you want.
The steps are:
1)The operating system loads your binary
2)The program loader system execute the Interpreter specifiy in the binary 3)The interpreter gather all the dynamic libraries needed in memoryQuoted 1 line
4)The Control is passed to the entry point of your program
How does the step 4 been done ?
thanks!
Quoted 34 lines
The entry point is specified in your code source as a "global". And could be find in your object file by the linker.
In theory there are some default tag to specify entry point, like "..start" for nasm, but you can also passed it to the linker.regards,
Sofiane Akermoun
[email protected]2013/4/7 ishare <[email protected]>
Quoted 8 lines
For an ELF ,which needs a interpreter , how is it been called by the
interpreter ?As I know the interpreter is loaded first and do something essential
,then call the main routine of ELF .
How is this procedure implemented ?Quoted 6 lines
Thanks!
--
To unsubscribe from this list: send the line "unsubscribe linux-assembly" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.htmlQuoted 3 lines
--
Sofiane AKERMOUN
[email protected]--
To unsubscribe from this list: send the line "unsubscribe linux-assembly" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html--
To unsubscribe from this list: send the line "unsubscribe linux-assembly" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Signature · 2 lines
Sofiane AKERMOUN [email protected]
Quoted 1 line · Sofiane Akermoun
EntryPoint is set in the ELF Header at assembling/linking time.
how does the interpreter know this address?
Quoted 85 lines
2013/4/7 ishare <[email protected]>:
Quoted 77 lines · Chris Evans
Quoted 1 line
With a far jump to entry offset
How does it know the entry point's address?
Quoted 68 lines
Sent from my iPad
Quoted 62 lines · ishare
Quoted 15 lines · Sofiane Akermoun
Hello,
The interpreter is specified during linking process and the program header of your binary is filled with good values.
Then when the operating system load your binary, he finds next the interpreter to use.
The linker ld sets the good values by default but you can overwrite it or specify other values if you want.
The steps are:
1)The operating system loads your binary
2)The program loader system execute the Interpreter specifiy in the binary 3)The interpreter gather all the dynamic libraries needed in memoryQuoted 1 line
4)The Control is passed to the entry point of your program
How does the step 4 been done ?
thanks!
Quoted 34 lines
The entry point is specified in your code source as a "global". And could be find in your object file by the linker.
In theory there are some default tag to specify entry point, like "..start" for nasm, but you can also passed it to the linker.regards,
Sofiane Akermoun
[email protected]2013/4/7 ishare <[email protected]>
Quoted 8 lines
For an ELF ,which needs a interpreter , how is it been called by the
interpreter ?As I know the interpreter is loaded first and do something essential
,then call the main routine of ELF .
How is this procedure implemented ?Quoted 6 lines
Thanks!
--
To unsubscribe from this list: send the line "unsubscribe linux-assembly" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.htmlQuoted 3 lines
--
Sofiane AKERMOUN
[email protected]--
To unsubscribe from this list: send the line "unsubscribe linux-assembly" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html--
To unsubscribe from this list: send the line "unsubscribe linux-assembly" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.htmlSignature · 2 lines
Sofiane AKERMOUN [email protected]
The address is passed by the elf loader in something called "auxillary vectors" structure.
In elf.h you can investigate on a_type/entry type and find that there is defininition of AT_ENTRY.
As i wrote previsouly if you check in
http://lxr.linux.no/#linux+v3.8.6/fs/binfmt_elf.c you will find how the elf loader prepare the execution of the interpreter.
To describe the step 4) i mentioned previously, with more accuracy... the interpreter is executed
by the elf loader as a program loader with known parameters passed on the stack through Elf32_auxv_t structure. For an easy to understand explanation you can read an article from phrack 58:
http://www.phrack.org/issues.html?issue=58&id=5#article
regards,
Sofiane Akermoun
[email protected]
2013/4/7 ishare <[email protected]>:
Quoted 90 lines · Sofiane Akermoun
Quoted 1 line
EntryPoint is set in the ELF Header at assembling/linking time.
how does the interpreter know this address?
Quoted 85 lines
2013/4/7 ishare <[email protected]>:
Quoted 69 lines · Chris Evans
Quoted 1 line
With a far jump to entry offset
How does it know the entry point's address?
Quoted 64 lines
Sent from my iPad
Quoted 58 lines · ishare
Quoted 15 lines · Sofiane Akermoun
Hello,
The interpreter is specified during linking process and the program header of your binary is filled with good values.
Then when the operating system load your binary, he finds next the interpreter to use.
The linker ld sets the good values by default but you can overwrite it or specify other values if you want.
The steps are:
1)The operating system loads your binary
2)The program loader system execute the Interpreter specifiy in the binary 3)The interpreter gather all the dynamic libraries needed in memoryQuoted 1 line
4)The Control is passed to the entry point of your program
How does the step 4 been done ?
thanks!
Quoted 37 lines
The entry point is specified in your code source as a "global". And could be find in your object file by the linker.
In theory there are some default tag to specify entry point, like "..start" for nasm, but you can also passed it to the linker.regards,
Sofiane Akermoun
[email protected]2013/4/7 ishare <[email protected]>
Quoted 8 lines
For an ELF ,which needs a interpreter , how is it been called by the
interpreter ?As I know the interpreter is loaded first and do something essential
,then call the main routine of ELF .
How is this procedure implemented ?Quoted 6 lines
Thanks!
--
To unsubscribe from this list: send the line "unsubscribe linux-assembly" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html--
Sofiane AKERMOUN
[email protected]Quoted 8 lines
Quoted 4 lines
Quoted 4 lines
--
To unsubscribe from this list: send the line "unsubscribe linux-assembly" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html--
To unsubscribe from this list: send the line "unsubscribe linux-assembly" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html--
Sofiane AKERMOUN
[email protected]
Signature · 2 lines
Sofiane AKERMOUN [email protected]
yeah!
I have found the work is done through create_elf_tables() function.
at early time kernel copy args to bprm structure , then copy it to user stack.
I am dealing with one problem .
When kernel execute "/bin/sh" , it load ld.so successfully , but without jumping to the elf's entry point ,it exit ,which cause kernel panic .
how can I debug for this problem ? how to catch more information for resolving it?
thanks!
I don't know what you are doing. if you are writing your proper assembler, or whatever. But the standard tools are gdb, printing on screen information like addresses. if it is kernel related then kdb and an emulator like bochs, qemu or virtualbox to avoid kernel freezing in performing remote debugging.
Although it is interesting, without asm code not sure it is the best place to talk about inner operating system mechanism.
regards.
Sofiane Akermoun
[email protected]
2013/4/7 ishare <[email protected]>:
Quoted 15 lines
yeah!
I have found the work is done through
create_elf_tables()function.at early time kernel copy args to bprm structure , then copy it to user stack.
I am dealing with one problem .
When kernel execute "
/bin/sh" , it load ld.so successfully , but without jumping to the elf's entry point ,it exit ,which cause kernel panic .how can I debug for this problem ? how to catch more information for resolving it?
thanks!
Signature · 2 lines
Sofiane AKERMOUN [email protected]
from 'man exeve':
if the executable is a dynamically linked ELF executable, the interpreter named in the PT_INTERP segment is used to load the needed shared libraries. This interpreter is typically /lib/ld-linux.so.1 for binaries linked with the Linux libc 5, or /lib/ld-linux.so.2 for binaries linked with the glibc 2.
If you really want to know what really happens then go to dig the exec.c source of linux:
http://lxr.linux.no/#linux+v3.8.6/fs/exec.c and binfmt*.c. If you follow the process you will find how the loader find, parse, and handle the interpretor.
regards,
Sofiane Akermoun
2013/4/7 ishare <[email protected]>:
Quoted 59 lines · Sofiane Akermoun
Quoted 15 lines
Hello,
The interpreter is specified during linking process and the program header of your binary is filled with good values.
Then when the operating system load your binary, he finds next the interpreter to use.
The linker ld sets the good values by default but you can overwrite it or specify other values if you want.
The steps are:
1)The operating system loads your binary
2)The program loader system execute the Interpreter specifiy in the binary 3)The interpreter gather all the dynamic libraries needed in memoryQuoted 1 line
4)The Control is passed to the entry point of your program
How does the step 4 been done ?
thanks!
Quoted 38 lines
The entry point is specified in your code source as a "global". And could be find in your object file by the linker.
In theory there are some default tag to specify entry point, like "..start" for nasm, but you can also passed it to the linker.regards,
Sofiane Akermoun
[email protected]2013/4/7 ishare <[email protected]>
Quoted 8 lines
For an ELF ,which needs a interpreter , how is it been called by the
interpreter ?As I know the interpreter is loaded first and do something essential
,then call the main routine of ELF .
How is this procedure implemented ?Quoted 7 lines
Thanks!
--
To unsubscribe from this list: send the line "unsubscribe linux-assembly" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html--
Sofiane AKERMOUN
[email protected]
Signature · 2 lines
Sofiane AKERMOUN [email protected]