Skip to content

Tag: elf

Understanding ELF64 text/data segment layout/padding

I’m trying to brush up on UNIX viruses and one text I’m reading mentions that parasitic code can be inserted in the padding between the text and the data segment, supposedly up to 2MB in size on x86-64 systems. But when I compile a simple hello world program with gcc -no-pie… …and insp…

Overlapping mappings for loaded ELF segments

I’d like to understand a detail of how the dynamic loader creates mappings for ELF segments. Consider a tiny shared library linked with GNU ld. The program headers are: Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align LOAD 0x000000 0x0000000000000000 0x0000000000000000 0x00095c 0x00095c R E 0x2000…

Relocation addend in ELF files – Elf64_Rel vs Elf64_Rela?

ELF files contain two structures to handle relocations: Elf64_Rel: and Elf64_Rela: I want to take peek at the relocation entries but I’m not sure which one to use. The manual pages are quite cryptic about this. Is there a specific usage for each? Answer This depends on the target. Most targets use only …