[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug ld/31300] New: ld: warning: x.so has a LOAD segment with RWX permis
From: |
hjl.tools at gmail dot com |
Subject: |
[Bug ld/31300] New: ld: warning: x.so has a LOAD segment with RWX permissions |
Date: |
Fri, 26 Jan 2024 19:28:53 +0000 |
https://sourceware.org/bugzilla/show_bug.cgi?id=31300
Bug ID: 31300
Summary: ld: warning: x.so has a LOAD segment with RWX
permissions
Product: binutils
Version: 2.43 (HEAD)
Status: NEW
Severity: normal
Priority: P2
Component: ld
Assignee: unassigned at sourceware dot org
Reporter: hjl.tools at gmail dot com
Target Milestone: ---
Target: x86-64
Created attachment 15336
--> https://sourceware.org/bugzilla/attachment.cgi?id=15336&action=edit
A testcase
[hjl@gnu-cfl-3 pr113617]$ gcc -c pr113617.s
[hjl@gnu-cfl-3 pr113617]$ ld -shared -o x.so pr113617.o
ld: warning: x.so has a LOAD segment with RWX permissions
[hjl@gnu-cfl-3 pr113617]$ readelf -SlW x.so
There are 19 section headers, starting at offset 0x39f8:
Section Headers:
[Nr] Name Type Address Off Size ES Flg
Lk Inf Al
[ 0] NULL 0000000000000000 000000 000000 00
0 0 0
[ 1] .hash HASH 0000000000000238 000238 00002c 04 A
3 0 8
[ 2] .gnu.hash GNU_HASH 0000000000000268 000268 00001c 00 A
3 0 8
[ 3] .dynsym DYNSYM 0000000000000288 000288 000090 18 A
4 1 8
[ 4] .dynstr STRTAB 0000000000000318 000318 000124 00 A
0 0 1
[ 5] .rela.dyn RELA 0000000000000440 000440 000018 18 A
3 0 8
[ 6] .rela.plt RELA 0000000000000458 000458 000078 18 AI
3 13 8
[ 7] .plt PROGBITS 0000000000001000 001000 000060 10 AX
0 0 16
[ 8] .text PROGBITS 0000000000001060 001060 0001df 00 AX
0 0 16
[ 9] .note.gnu.property NOTE 0000000000002000 002000 000030 00 A
0 0 8
[10] .eh_frame PROGBITS 0000000000002030 002030 000154 00 A
0 0 8
[11] .data.rel.ro PROGBITS 0000000000003e80 002e80 000008 00 WAX
0 0 8
[12] .dynamic DYNAMIC 0000000000003e88 002e88 000160 10 WA
4 0 8
[13] .got.plt PROGBITS 0000000000003fe8 002fe8 000040 08 WA
0 0 8
[14] .bss NOBITS 0000000000004028 003028 000010 00 WA
0 0 8
[15] .comment PROGBITS 0000000000000000 003028 00002a 01 MS
0 0 1
[16] .symtab SYMTAB 0000000000000000 003058 000240 18
17 19 8
[17] .strtab STRTAB 0000000000000000 003298 0006c4 00
0 0 1
[18] .shstrtab STRTAB 0000000000000000 00395c 000099 00
0 0 1
Key to Flags:
W (write), A (alloc), X (execute), M (merge), S (strings), I (info),
L (link order), O (extra OS processing required), G (group), T (TLS),
C (compressed), x (unknown), o (OS specific), E (exclude),
D (mbind), l (large), p (processor specific)
Elf file type is DYN (Shared object file)
Entry point 0x0
There are 9 program headers, starting at offset 64
Program Headers:
Type Offset VirtAddr PhysAddr FileSiz MemSiz
Flg Align
LOAD 0x000000 0x0000000000000000 0x0000000000000000 0x0004d0
0x0004d0 R 0x1000
LOAD 0x001000 0x0000000000001000 0x0000000000001000 0x00023f
0x00023f R E 0x1000
LOAD 0x002000 0x0000000000002000 0x0000000000002000 0x000184
0x000184 R 0x1000
LOAD 0x002e80 0x0000000000003e80 0x0000000000003e80 0x0001a8
0x0001b8 RWE 0x1000
DYNAMIC 0x002e88 0x0000000000003e88 0x0000000000003e88 0x000160
0x000160 RW 0x8
NOTE 0x002000 0x0000000000002000 0x0000000000002000 0x000030
0x000030 R 0x8
GNU_PROPERTY 0x002000 0x0000000000002000 0x0000000000002000 0x000030
0x000030 R 0x8
GNU_STACK 0x000000 0x0000000000000000 0x0000000000000000 0x000000
0x000000 RW 0x10
GNU_RELRO 0x002e80 0x0000000000003e80 0x0000000000003e80 0x000180
0x000180 R 0x1
Section to Segment mapping:
Segment Sections...
00 .hash .gnu.hash .dynsym .dynstr .rela.dyn .rela.plt
01 .plt .text
02 .note.gnu.property .eh_frame
03 .data.rel.ro .dynamic .got.plt .bss
04 .dynamic
05 .note.gnu.property
06 .note.gnu.property
07
08 .data.rel.ro .dynamic
[hjl@gnu-cfl-3 pr113617]$
LOAD 0x002e80 0x0000000000003e80 0x0000000000003e80 0x0001a8 0x0001b8
RWE 0x1000
is wrong since
03 .data.rel.ro .dynamic .got.plt .bss
doesn't need the X bit.
--
You are receiving this mail because:
You are on the CC list for the bug.
- [Bug ld/31300] New: ld: warning: x.so has a LOAD segment with RWX permissions,
hjl.tools at gmail dot com <=