How the Linux kernel loads and launches an executable program

Source: Internet
Author: User

Qin Dingtao "Linux kernel Analysis" MOOC course http://mooc.study.163.com/course/USTC-1000029000

First, video learning

Second, using the GDB trace analysis of a EXECVE system call kernel processing function Sys_execve
Add Execve system invoke command:
to find the boot kernel command in makefile:
after booting the kernel, locate the additional EXEC command:
exec--The newly loaded execution program to output the "Hello World" After you freeze the GDB trace, set the breakpoint:executed to the Sys_execve: Enter do_execve interior go on , load_elf_binary .
list, you can see that the elf_interp is empty when the static link
re-execute, trace to Start_thread
Iii. Summary
The new executable is executed from NEW_IP, Start_thread is actually the next instruction that returns to the user state from the int 0x80,
becomes the entry location for the specified newly loaded executable, that is, the value of the EIP that modifies the kernel stack as the starting point for the new program. When performing a system tune to the EXECVE
In the kernel state, Execve loaded executables overwrite the executable program of the current process, and when the EXECVE system call returns, returns a new
The execution start point of the executing program (main function location), so the new executable program can execute smoothly after the EXECVE system call returns. For static links, you can
Execute program and dynamically linked executable program EXECVE system call returns, if it is a static link, Elf_entry points to the header
(The location of the main function corresponds to 0x8048***); If you need to rely on a dynamic-link library, Elf_entry points to the starting point of the dynamic linker.

How the Linux kernel loads and launches an executable program

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.