https://sourceware.org/bugzilla/show_bug.cgi?id=24156
Bug ID: 24156 Summary: gcc -N -nostdlib test.c creates PT_PHDR out of range for auxiliary vector fetching of AT_PHDR Product: binutils Version: 2.31 Status: UNCONFIRMED Severity: normal Priority: P2 Component: ld Assignee: unassigned at sourceware dot org Reporter: ryan at bitlackeys dot org Target Milestone: --- In older versions such as 2.24 this wasn't a problem because it did not include an INTERP segment, therefore no auxv fetching was necessary. In newer versions the ld-linux.so fails to find AT_PHDR on the auxv (On the stack) because it PT_PHDR exists outside of a LOAD segment-- and lastly, the original behavior of -N -nostdlib never included a PT_INTERP segment. Although I agree that -N -nostdlib -static is more correct for excluding an interpreter. Still if PT_INTERP is going to exist, the interpreter will need a valid AT_PHDR, otherwise the program segfaults. elfmaster@dreamcity:~/git/scop_virus$ ld -v GNU ld (GNU Binutils for Ubuntu) 2.30 elfmaster@dreamcity:~/git/scop_virus$ elfmaster@dreamcity:~/git/scop_virus$ gcc -N -nostdlib t.c -o t elfmaster@dreamcity:~/git/scop_virus$ readelf -l t Elf file type is EXEC (Executable file) Entry point 0x400241 There are 7 program headers, starting at offset 64 Program Headers: Type Offset VirtAddr PhysAddr FileSiz MemSiz Flags Align PHDR 0x0000000000000040 0x0000000000200040 0x0000000000000000 0x0000000000000188 0x0000000000000188 R 0x8 readelf: Error: the PHDR segment is not covered by a LOAD segment INTERP 0x00000000000001c8 0x00000000004001c8 0x00000000004001c8 0x000000000000001c 0x000000000000001c R 0x1 [Requesting program interpreter: /lib64/ld-linux-x86-64.so.2] LOAD 0x00000000000001c8 0x00000000004001c8 0x00000000004001c8 0x00000000000001b0 0x00000000000001b0 RWE 0x8 DYNAMIC 0x0000000000000298 0x0000000000400298 0x0000000000400298 0x00000000000000e0 0x00000000000000e0 RW 0x8 NOTE 0x00000000000001e4 0x00000000004001e4 0x00000000004001e4 0x0000000000000024 0x0000000000000024 R 0x4 GNU_EH_FRAME 0x0000000000000248 0x0000000000400248 0x0000000000400248 0x0000000000000014 0x0000000000000014 R 0x4 GNU_STACK 0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000 RW 0x10 Section to Segment mapping: Segment Sections... 00 01 .interp 02 .interp .note.gnu.build-id .gnu.hash .dynsym .dynstr .text .eh_frame_hdr .eh_frame .dynamic 03 .dynamic 04 .note.gnu.build-id 05 .eh_frame_hdr 06 elfmaster@dreamcity:~/git/scop_virus$ LD_SHOW_AUXV=1 ./t AT_SYSINFO_EHDR: 0x7ffeaa5ba000 AT_HWCAP: bfebfbff AT_PAGESZ: 4096 AT_CLKTCK: 100 AT_PHDR: 0x400040 AT_PHENT: 56 AT_PHNUM: 7 AT_BASE: 0x7f7d95c61000 AT_FLAGS: 0x0 AT_ENTRY: 0x400241 AT_UID: 1000 AT_EUID: 1000 AT_GID: 1000 AT_EGID: 1000 AT_SECURE: 0 AT_RANDOM: 0x7ffeaa4eecd9 AT_HWCAP2: 0x0 AT_EXECFN: ./t AT_PLATFORM: x86_64 Segmentation fault (core dumped) elfmaster@dreamcity:~/git/scop_virus$ -- You are receiving this mail because: You are on the CC list for the bug. _______________________________________________ bug-binutils mailing list bug-binutils@gnu.org https://lists.gnu.org/mailman/listinfo/bug-binutils