https://sourceware.org/bugzilla/show_bug.cgi?id=32946
Bug ID: 32946
Summary: strip corrupts file if e_phoff != 0x40
Product: binutils
Version: unspecified
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: binutils
Assignee: unassigned at sourceware dot org
Reporter: cbytensky at gmail dot com
Target Milestone: ---
Created attachment 16075
--> https://sourceware.org/bugzilla/attachment.cgi?id=16075&action=edit
Sample program with e_phoff != 0x40 that prints `Hello, syscall!`
Overview:
The strip utility currently assumes that the program header table always begins
at offset 0x40 in an ELF64 file. If e_phoff in the ELF header is set to any
other value, strip will adjust section load addresses incorrectly and corrupt
the binary.
Steps to Reproduce:
1) Run strip on sample program from attachment.
Actual Results:
strip emits the following warnings:
strip: stzHDWTq: section .text lma 0x40 adjusted to 0xb0
strip: stzHDWTq: section .data lma 0x55 adjusted to 0xc5
After this, the stripped binary is corrupted (it no longer executes and emits
`Illegal instruction` error).
Expected Results:
The stripped binary should remain valid and executable and should emit `Hello,
syscall!` message.
--
You are receiving this mail because:
You are on the CC list for the bug.