- Learning Linux Binary Analysis
- Ryan “elfmaster” O'Neill
- 439字
- 2021-07-16 12:56:53
ELF file types
An ELF file may be marked as one of the following types:
ET_NONE
: This is an unknown type. It indicates that the file type is unknown, or has not yet been defined.ET_REL
: This is a relocatable file. ELF type relocatable means that the file is marked as a relocatable piece of code or sometimes called an object file. Relocatable object files are generally pieces of Position independent code (PIC) that have not yet been linked into an executable. You will often see.o
files in a compiled code base. These are the files that hold code and data suitable for creating an executable file.ET_EXEC
: This is an executable file. ELF type executable means that the file is marked as an executable file. These types of files are also called programs and are the entry point of how a process begins running.ET_DYN
: This is a shared object. ELF type dynamic means that the file is marked as a dynamically linkable object file, also known as shared libraries. These shared libraries are loaded and linked into a program's process image at runtime.ET_CORE
: This is an ELF type core that marks a core file. A core file is a dump of a full process image during the time of a program crash or when the process has delivered an SIGSEGV signal (segmentation violation). GDB can read these files and aid in debugging to determine what caused the program to crash.
If we look at an ELF file with the command readelf -h
, we can view the initial ELF file header. The ELF file header starts at the 0 offset of an ELF file and serves as a map to the rest of the file. Primarily, this header marks the ELF type, the architecture, and the entry point address where execution is to begin, and provides offsets to the other types of ELF headers (section headers and program headers), which will be explained in depth later. More of the file header will be understood once we explain the meaning of section headers and program headers. Looking at the ELF(5) man page in Linux shows us the ELF header structure:
#define EI_NIDENT 16 typedef struct { unsigned char e_ident[EI_NIDENT]; uint16_t e_type; uint16_t e_machine; uint32_t e_version; ElfN_Addr e_entry; ElfN_Off e_phoff; ElfN_Off e_shoff; uint32_t e_flags; uint16_t e_ehsize; uint16_t e_phentsize; uint16_t e_phnum; uint16_t e_shentsize; uint16_t e_shnum; uint16_t e_shstrndx; } ElfN_Ehdr;
Later in this chapter, we will see how to utilize the fields in this structure to map out an ELF file with a simple C program. First, we will continue looking at the other types of ELF headers that exist.
- Python程序設(shè)計(jì)教程(第2版)
- 簡(jiǎn)單高效LATEX
- FFmpeg入門(mén)詳解:音視頻原理及應(yīng)用
- Learning Network Forensics
- 劍指MySQL:架構(gòu)、調(diào)優(yōu)與運(yùn)維
- Spring+Spring MVC+MyBatis整合開(kāi)發(fā)實(shí)戰(zhàn)
- 打開(kāi)Go語(yǔ)言之門(mén):入門(mén)、實(shí)戰(zhàn)與進(jìn)階
- C#程序設(shè)計(jì)(項(xiàng)目教學(xué)版)
- Building Dynamics CRM 2015 Dashboards with Power BI
- Hadoop大數(shù)據(jù)分析技術(shù)
- R語(yǔ)言數(shù)據(jù)挖掘:實(shí)用項(xiàng)目解析
- OpenCV Android開(kāi)發(fā)實(shí)戰(zhàn)
- 開(kāi)源網(wǎng)絡(luò)地圖可視化:基于Leaflet的在線地圖開(kāi)發(fā)
- Mastering Vim
- Building E-Commerce Solutions with WooCommerce(Second Edition)