InnocentZero's Treasure Chest

HomeFeedAbout MeList of interesting people

14 Feb 1990

Executing and ELF

Steps of the execution

  • The shell makes an execvc system call to run an executable binary, and the kernel responds with sys_execve which calls the do_execve function.
  • It opens the executable binary and does some preparation. It calls search_binary_handler. That will call load_elf_binary in our case.
  • It allocates memory segments for the program headers and zeroes out the BSS section by calling the padzero function.
  • load_elf_binary also checks for the INTERP segment. According to AMD64 SysV ABI, the only valid interpreter is /lib/ld64.so.1.
  • If there's a loader, it'll call load_elf_interp function to load the interpreter as well.
  • Finally it calls start_thread and passes control to either the binary or the interpreter.

Other posts
Creative Commons License
This website by innocentzer0 is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.