layout: post title: "Software Security Notes 3 (Lazy Binding)" date: 2021-2-25 07:00:00 +0800
Relocation when unresolved symbol is first referenced
Can be overridden
Procedure Linkage Table (.plt) and Global Offset Table (.got/.got.plt).
Faster. Load when needed.
One entry in .plt per library function.
Each library has their own .pltand .got (.got.plt).
Dynamic Binding.
Initially the entry in .got.pltrefers back to the .pltfor resolution.
After resolution, the entry in .got.pltis patched with the address of the function.
.dynamic: Useful during loading and setting up for execution.
.init_array: array of pointers to functions to be used as constructors.
.fini_array: array of pointers to functions to be used as destructors.
.shstrtab, .symtab, .strtab, .dynsym, .dynstr
Choose what to load.
readelf -h <file>
- Show the executable header of the file.
readelf --wide --sections <file>
- Show the section headers in the file.
readelf --wide --segments <file>
- Show the program headers in the file.
readelf --relocs <file>
- Show the relocation symbols in the file.
readelf --symbols <file>
- See the entries in the symbol table section.
readelf --dyn-syms <file>
- See the entries in the dynamic symbol table section.
readelf -p <section, e.g., .shstrtab, .dynstr> <file>
- Dump the content of a section in string format.
objdump -M intel -dj. <section> <file>
- Disassemble the content of a section. Usually we apply this to the .text section, and sometimes the .pltsection.