Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Bug#1050483: /usr/bin/x86_64-linux-gnu-objdump: objdump and nm choke on fully stripped ELF executables

70 views
Skip to first unread message

Joshua

unread,
Aug 24, 2023, 8:50:04 PM8/24/23
to
Package: binutils-x86-64-linux-gnu
Version: 2.35.2-2
Severity: normal
File: /usr/bin/x86_64-linux-gnu-nm

Dear Maintainer,

* What led up to the situation?

Originally, trying to figure out why these programs would not load. Ultimately,
discovering that nm (my normal go-to tool) and objdump could not handle these.
I'm not exactly sure what the problem is, but it appears to be the tools cannot
handle binaries that have less than two sections.

* What exactly did you do (or not do) that was effective (or
ineffective)?

After discovering that readelf could cope with the problem I was able to repair
the binary headers; however even so, objdump and nm cannot cope.

* What outcome did you expect instead?

A more sane error message than a section that doesn't exist has an offset outside
the file repeated twice.

Diagnostic output:

$ objdump --all ./mv
objdump: warning: ./mv has a corrupt section with a size (7ba002000) larger than the file size
objdump: warning: ./mv has a corrupt section with a size (7ba002000) larger than the file size
objdump: ./mv: file format not recognized
$ readelf --all ./mv
ELF Header:
Magic: 7f 45 4c 46 02 01 01 03 00 00 00 00 00 00 00 00
Class: ELF64
Data: 2's complement, little endian
Version: 1 (current)
OS/ABI: UNIX - GNU
ABI Version: 0
Type: EXEC (Executable file)
Machine: Advanced Micro Devices X86-64
Version: 0x1
Entry point address: 0x200078
Start of program headers: 64 (bytes into file)
Start of section headers: 120 (bytes into file)
Flags: 0x0
Size of this header: 64 (bytes)
Size of program headers: 56 (bytes)
Number of program headers: 1
Size of section headers: 0 (bytes)
Number of section headers: 0
Section header string table index: 0
readelf: Warning: possibly corrupt ELF file header - it has a non-zero section header offset, but no section headers

There are no sections to group in this file.

Program Headers:
Type Offset VirtAddr PhysAddr
FileSiz MemSiz Flags Align
LOAD 0x0000000000000000 0x0000000000200000 0x0000000000000000
0x00000000000000ee 0x00000000000000ee R E 0x1000

There is no dynamic section in this file.
$

Here are three binaries with which to reproduce the problem:

begin-base64 755 chmod
f0VMRgIBAQMAAAAAAAAAAAIAPgABAAAAeAAgAAAAAABAAAAAAAAAAHgAAAAA
AAAAAAAAAEAAOAABAAAAAAAAAAEAAAAFAAAAAAAAAAAAAAAAACAAAAAAAAAA
AAAAAAAADQEAAAAAAAANAQAAAAAAAAAQAAAAAAAAWEiD+AN1S15eMckxwKw8
AHQPLDByPDwIczjB4QMJwevsic5fuFoAAAAPBffYdBtQvwIAAABIjTQlBgEg
ALoHAAAAuAEAAAAPBViXuDwAAAAPBb8CAAAASI00Je8AIAC6FwAAALgBAAAA
DwW/DgAAALg8AAAADwVVc2FnZTogY2htb2Qgbm5ubiBmaWxlCkVycm9yIQo=
====

begin-base64 755 mv
f0VMRgIBAQMAAAAAAAAAAAIAPgABAAAAeAAgAAAAAABAAAAAAAAAAHgAAAAA
AAAAAAAAAEAAOAABAAAAAAAAAAEAAAAFAAAAAAAAAAAAAAAAACAAAAAAAAAA
AAAAAAAA7gAAAAAAAADuAAAAAAAAAAAQAAAAAAAAWEiD+AN1MV9fXrhSAAAA
DwX32HQbUL8CAAAASI00JecAIAC6BwAAALgBAAAADwVYl7g8AAAADwW/AgAA
AEiNNCXVACAAuhIAAAC4AQAAAA8Fvw4AAAC4PAAAAA8FVXNhZ2U6IG12IHNy
YyBkc3QKRXJyb3IhCg==
====

begin-base64 755 sln
f0VMRgIBAQMAAAAAAAAAAAIAPgABAAAAeAAgAAAAAABAAAAAAAAAAHgAAAAA
AAAAAAAAAEAAOAABAAAAAAAAAAEAAAAFAAAAAAAAAAAAAAAAACAAAAAAAAAA
AAAAAAAA7wAAAAAAAADvAAAAAAAAAAAQAAAAAAAAWEiD+AN1MV9fXrhYAAAA
DwX32HQbUL8CAAAASI00JegAIAC6BwAAALgBAAAADwVYl7g8AAAADwW/AgAA
AEiNNCXVACAAuhMAAAC4AQAAAA8Fvw4AAAC4PAAAAA8FVXNhZ2U6IHNsbiBz
cmMgZHN0CkVycm9yIQo=
====

-- System Information:
Debian Release: 11.6
APT prefers oldstable-updates
APT policy: (500, 'oldstable-updates'), (500, 'oldstable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 5.10.0-20-amd64 (SMP w/12 CPU threads)
Locale: LANG=en_US, LC_CTYPE=en_US (charmap=ISO-8859-1), LANGUAGE not set
Shell: /bin/sh linked to /bin/dash
Init: unable to detect
LSM: AppArmor: enabled

Versions of packages binutils-x86-64-linux-gnu depends on:
ii binutils-common 2.35.2-2
ii libbinutils 2.35.2-2
ii libc6 2.31-13+deb11u5
ii libctf-nobfd0 2.35.2-2
ii libctf0 2.35.2-2
ii libgcc-s1 10.2.1-6
ii libstdc++6 10.2.1-6
ii zlib1g 1:1.2.11.dfsg-2+deb11u2

binutils-x86-64-linux-gnu recommends no packages.

Versions of packages binutils-x86-64-linux-gnu suggests:
pn binutils-doc <none>

-- no debconf information

Joshua Hudson

unread,
Aug 25, 2023, 12:30:05 PM8/25/23
to
Trying on sid (2023-08-25) objdump fails with: "./mv: file format not
recognized" and readelf still works.

objdump version from sid: GNU objdump (GNU Binutils for Debian) 2.41
0 new messages