Verified gzip 1.10-0ubuntu3.1 rebuilt with binutils (2.33-2ubuntu1.1):
root@ee-motd-verify:~# dpkg -l gzip Desired=Unknown/Install/Remove/Purge/Hold | Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend |/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad) ||/ Name Version Architecture Description +++-==============-===============-============-================================= ii gzip 1.10-0ubuntu3.1 amd64 GNU compression utilities root@ee-motd-verify:~# FILE=/usr/bin/gzip; readelf -W --program-headers $FILE | awk -v size=$(stat -c %s $FILE) '/^ LOAD/ {if (strtonum($2) > size) {print "wrong offset ("$2" ("strtonum($2)") points past EOF:" size; exit 1;}}' && echo ok ok root@ee-motd-verify:~# FILE=/usr/bin/gzip; readelf -W --program-headers $FILE
Elf file type is DYN (Shared object file) Entry point 0x4190 There are 14 program headers, starting at offset 64
Program Headers: Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align PHDR 0x000040 0x0000000000000040 0x0000000000000040 0x000310 0x000310 R 0x8 INTERP 0x000350 0x0000000000000350 0x0000000000000350 0x00001c 0x00001c R 0x1 [Requesting program interpreter: /lib64/ld-linux-x86-64.so.2] LOAD 0x000000 0x0000000000000000 0x0000000000000000 0x0027a0 0x0027a0 R 0x1000 LOAD 0x003000 0x0000000000003000 0x0000000000003000 0x00ea05 0x00ea05 R E 0x1000 LOAD 0x012000 0x0000000000012000 0x0000000000012000 0x003e80 0x003e80 R 0x1000 LOAD 0x016690 0x0000000000017690 0x0000000000017690 0x000d70 0x000d70 RW 0x1000 LOAD 0x000000 0x000000000001a000 0x000000000001a000 0x000000 0x0ca048 RW 0x1000 DYNAMIC 0x016b80 0x0000000000017b80 0x0000000000017b80 0x0001f0 0x0001f0 RW 0x8 NOTE 0x000370 0x0000000000000370 0x0000000000000370 0x000020 0x000020 R 0x8 NOTE 0x000390 0x0000000000000390 0x0000000000000390 0x000044 0x000044 R 0x4 GNU_PROPERTY 0x000370 0x0000000000000370 0x0000000000000370 0x000020 0x000020 R 0x8 GNU_EH_FRAME 0x01433c 0x000000000001433c 0x000000000001433c 0x000404 0x000404 R 0x4 GNU_STACK 0x000000 0x0000000000000000 0x0000000000000000 0x000000 0x000000 RW 0x10 GNU_RELRO 0x016690 0x0000000000017690 0x0000000000017690 0x000970 0x000970 R 0x1
Section to Segment mapping: Segment Sections... 00 01 .interp 02 .interp .note.gnu.property .note.gnu.build-id .note.ABI-tag .gnu.hash .dynsym .dynstr .gnu.version .gnu.version_r .rela.dyn .rela.plt 03 .init .plt .plt.got .plt.sec .text .fini 04 .rodata .eh_frame_hdr .eh_frame 05 .init_array .fini_array .data.rel.ro .dynamic .got .data 06 .bss 07 .dynamic 08 .note.gnu.property 09 .note.gnu.build-id .note.ABI-tag 10 .note.gnu.property 11 .eh_frame_hdr 12 13 .init_array .fini_array .data.rel.ro .dynamic .got root@ee-motd-verify:~# stat -c %s /usr/bin/gzip 97496
Note that the last PT_LOAD segment is set to 0.
Verified gzip 1.10-0ubuntu3.1 rebuilt with binutils (2.33-2ubuntu1.1):
root@ee- motd-verify: ~# dpkg -l gzip Unknown/ Install/ Remove/ Purge/Hold Not/Inst/ Conf-files/ Unpacked/ halF-conf/ Half-inst/ trig-aWait/ Trig-pend /Reinst- required (Status,Err: uppercase=bad) ======= ====-== ======= ======- ======= =====-= ======= ======= ======= ======= ==== motd-verify: ~# FILE=/usr/bin/gzip; readelf -W --program-headers $FILE | awk -v size=$(stat -c %s $FILE) '/^ LOAD/ {if (strtonum($2) > size) {print "wrong offset ("$2" ("strtonum($2)") points past EOF:" size; exit 1;}}' && echo ok motd-verify: ~# FILE=/usr/bin/gzip; readelf -W --program-headers $FILE
Desired=
| Status=
|/ Err?=(none)
||/ Name Version Architecture Description
+++-===
ii gzip 1.10-0ubuntu3.1 amd64 GNU compression utilities
root@ee-
ok
root@ee-
Elf file type is DYN (Shared object file)
Entry point 0x4190
There are 14 program headers, starting at offset 64
Program Headers: ld-linux- x86-64. so.2]
Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align
PHDR 0x000040 0x0000000000000040 0x0000000000000040 0x000310 0x000310 R 0x8
INTERP 0x000350 0x0000000000000350 0x0000000000000350 0x00001c 0x00001c R 0x1
[Requesting program interpreter: /lib64/
LOAD 0x000000 0x0000000000000000 0x0000000000000000 0x0027a0 0x0027a0 R 0x1000
LOAD 0x003000 0x0000000000003000 0x0000000000003000 0x00ea05 0x00ea05 R E 0x1000
LOAD 0x012000 0x0000000000012000 0x0000000000012000 0x003e80 0x003e80 R 0x1000
LOAD 0x016690 0x0000000000017690 0x0000000000017690 0x000d70 0x000d70 RW 0x1000
LOAD 0x000000 0x000000000001a000 0x000000000001a000 0x000000 0x0ca048 RW 0x1000
DYNAMIC 0x016b80 0x0000000000017b80 0x0000000000017b80 0x0001f0 0x0001f0 RW 0x8
NOTE 0x000370 0x0000000000000370 0x0000000000000370 0x000020 0x000020 R 0x8
NOTE 0x000390 0x0000000000000390 0x0000000000000390 0x000044 0x000044 R 0x4
GNU_PROPERTY 0x000370 0x0000000000000370 0x0000000000000370 0x000020 0x000020 R 0x8
GNU_EH_FRAME 0x01433c 0x000000000001433c 0x000000000001433c 0x000404 0x000404 R 0x4
GNU_STACK 0x000000 0x0000000000000000 0x0000000000000000 0x000000 0x000000 RW 0x10
GNU_RELRO 0x016690 0x0000000000017690 0x0000000000017690 0x000970 0x000970 R 0x1
Section to Segment mapping: motd-verify: ~# stat -c %s /usr/bin/gzip
Segment Sections...
00
01 .interp
02 .interp .note.gnu.property .note.gnu.build-id .note.ABI-tag .gnu.hash .dynsym .dynstr .gnu.version .gnu.version_r .rela.dyn .rela.plt
03 .init .plt .plt.got .plt.sec .text .fini
04 .rodata .eh_frame_hdr .eh_frame
05 .init_array .fini_array .data.rel.ro .dynamic .got .data
06 .bss
07 .dynamic
08 .note.gnu.property
09 .note.gnu.build-id .note.ABI-tag
10 .note.gnu.property
11 .eh_frame_hdr
12
13 .init_array .fini_array .data.rel.ro .dynamic .got
root@ee-
97496
Note that the last PT_LOAD segment is set to 0.