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