[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug binutils/27314] New: objcopy overwrite sections
From: |
address@hidden |
Subject: |
[Bug binutils/27314] New: objcopy overwrite sections |
Date: |
Tue, 02 Feb 2021 08:47:32 +0000 |
https://sourceware.org/bugzilla/show_bug.cgi?id=27314
Bug ID: 27314
Summary: objcopy overwrite sections
Product: binutils
Version: 2.36
Status: UNCONFIRMED
Severity: critical
Priority: P2
Component: binutils
Assignee: unassigned at sourceware dot org
Reporter: ptr@void-ptr.info
Target Milestone: ---
Created attachment 13193
--> https://sourceware.org/bugzilla/attachment.cgi?id=13193&action=edit
object file (ELF)
objcopy overwrite sections. Affected at least 2.36, 2.35.
Sample:
objcopy -O binary typesize.o typesize.bin
objdump -s typesize.o
typesize.o: file format elf64-x86-64
Contents of section .rodata:
0000 7ac8db4e 97b49c19 5f5f7533 32000400 z..N....__u32...
0010 6361705f 75736572 5f646174 615f7400 cap_user_data_t.
0020 08006361 705f7573 65725f68 65616465 ..cap_user_heade
0030 725f7400 08006368 6172202a 00080063 r_t...char *...c
...
Contents of section .note.gnu.property:
0000 04000000 20000000 05000000 474e5500 .... .......GNU.
0010 020001c0 04000000 00000000 00000000 ................
0020 010001c0 04000000 01000000 00000000 ................
The section .note.gnu.property overwrite section .rodata:
hexdump -C typesize.bin
00000000 04 00 00 00 20 00 00 00 05 00 00 00 47 4e 55 00 |.... .......GNU.|
00000010 02 00 01 c0 04 00 00 00 00 00 00 00 00 00 00 00 |................|
00000020 01 00 01 c0 04 00 00 00 01 00 00 00 00 00 00 00 |................|
00000030 72 5f 74 00 08 00 63 68 61 72 20 2a 00 08 00 63 |r_t...char *...c|
00000040 68 61 72 20 2a 20 63 6f 6e 73 74 20 2a 00 08 00 |har * const *...|
00000050 63 6f 6e 73 74 20 63 68 61 72 20 2a 00 08 00 63 |const char *...c|
...
If section .note.gnu.property removed, the result (at least for .rodata) is
fine.
objcopy -O binary --remove-section .note.gnu.property typesize.o typesize.bin
hexdump -C typesize.bin
00000000 7a c8 db 4e 97 b4 9c 19 5f 5f 75 33 32 00 04 00 |z..N....__u32...|
00000010 63 61 70 5f 75 73 65 72 5f 64 61 74 61 5f 74 00 |cap_user_data_t.|
00000020 08 00 63 61 70 5f 75 73 65 72 5f 68 65 61 64 65 |..cap_user_heade|
00000030 72 5f 74 00 08 00 63 68 61 72 20 2a 00 08 00 63 |r_t...char *...c|
00000040 68 61 72 20 2a 20 63 6f 6e 73 74 20 2a 00 08 00 |har * const *...|
....
--
You are receiving this mail because:
You are on the CC list for the bug.
- [Bug binutils/27314] New: objcopy overwrite sections,
address@hidden <=
- [Bug binutils/27314] objcopy overwrite sections, hjl.tools at gmail dot com, 2021/02/02
- [Bug binutils/27314] objcopy overwrite sections, address@hidden, 2021/02/02
- [Bug binutils/27314] objcopy overwrite sections, amodra at gmail dot com, 2021/02/02
- [Bug binutils/27314] objcopy overwrite sections, hjl.tools at gmail dot com, 2021/02/03
- [Bug binutils/27314] objcopy overwrite sections, address@hidden, 2021/02/03