https://sourceware.org/bugzilla/show_bug.cgi?id=25699
Bug ID: 25699 Summary: strip-new: SIGSEGV in bfd_elf_set_group_contents (elf.c:3538) Product: binutils Version: 2.35 (HEAD) Status: UNCONFIRMED Severity: normal Priority: P2 Component: binutils Assignee: unassigned at sourceware dot org Reporter: fdgkhdkgh at gmail dot com Target Milestone: --- Created attachment 12391 --> https://sourceware.org/bugzilla/attachment.cgi?id=12391&action=edit file that reproduces this problem OS : ubuntu 18.04.3 kernel : gnu/linux 5.0.0-32-generic processor : Intel(R) Core(TM) i5-8400 CPU @ 2.80GHz compiler : gcc 7.4.0 Steps to Reproduce : download the sample from attachment strip-new -R .fini --strip-unneeded ./sample gdb backtrace : #0 0x00005555556d1490 in bfd_elf_set_group_contents (abfd=0x555555c4cba0, sec=0x555555c5b710, failedptrarg=<optimized out>) at elf.c:3538 #1 0x000055555565b544 in bfd_map_over_sections (abfd=abfd@entry=0x555555c4cba0, operation=operation@entry=0x5555556d11c0 <bfd_elf_set_group_contents>, user_storage=user_storage@entry=0x7fffffff1d5c) at section.c:1377 #2 0x00005555556fede2 in _bfd_elf_compute_section_file_positions (abfd=0x555555c4cba0, link_info=link_info@entry=0x0) at elf.c:4325 #3 0x000055555573299f in _bfd_elf_set_section_contents (abfd=0x555555c4cba0, section=0x555555c5b5d0, location=0x555555c4d050, offset=0x0, count=0x13) at elf.c:9199 #4 0x000055555565bb83 in bfd_set_section_contents (abfd=0x555555c4cba0, section=0x555555c5b5d0, location=0x555555c4d050, offset=<optimized out>, count=<optimized out>) at section.c:1518 #5 0x000055555559fcf4 in copy_section (ibfd=<optimized out>, isection=<optimized out>, obfdarg=0x555555c4cba0) at objcopy.c:4427 #6 0x000055555565b544 in bfd_map_over_sections (abfd=0x555555c47420, operation=0x55555559e2b0 <copy_section>, user_storage=0x555555c4cba0) at section.c:1377 #7 0x00005555555a7d7f in copy_object (ibfd=<optimized out>, obfd=<optimized out>, input_arch=<optimized out>) at objcopy.c:3265 #8 0x00005555555b0b3e in copy_object (input_arch=0x0, obfd=0x555555c4cba0, ibfd=0x555555c47420) at objcopy.c:2611 #9 copy_file (input_filename=0x7fffffff26c8 "./sample", output_filename=0x555555c47400 "./stNaz8mA", input_target=<optimized out>, output_target=<optimized out>, input_arch=0x0) at objcopy.c:3830 #10 0x000055555558fb4e in strip_main (argv=<optimized out>, argc=<optimized out>) at objcopy.c:4815 #11 main (argc=<optimized out>, argc@entry=0x5, argv=<optimized out>, argv@entry=0x7fffffff22b8) at objcopy.c:6013 #12 0x00007ffff7801b97 in __libc_start_main (main=0x5555555888d0 <main>, argc=0x5, argv=0x7fffffff22b8, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fffffff22a8) at ../csu/libc-start.c:310 #13 0x0000555555594dea in _start () -------------- gdb report : Program received signal SIGSEGV, Segmentation fault. [----------------------------------registers-----------------------------------] RAX: 0x0 RBX: 0x0 RCX: 0xb40 ('@\x0b') RDX: 0x7fffffff1d5c --> 0x0 RSI: 0x555555c493e0 --> 0x1100000005 RDI: 0x7ffff7bcc680 --> 0xfbad2887 RBP: 0x20 (' ') RSP: 0x7fffffff1c20 --> 0x555555c5b710 --> 0x555555c48438 --> 0x2e00746c702e746f ('ot.plt') RIP: 0x5555556d1490 (<bfd_elf_set_group_contents+720>: mov rax,QWORD PTR [r12+r14*8]) R8 : 0x7ffff7bcd8b0 --> 0x0 R9 : 0x7ffff7fd2740 (0x00007ffff7fd2740) R10: 0xa ('\n') R11: 0x246 R12: 0x0 R13: 0x555555c5b710 --> 0x555555c48438 --> 0x2e00746c702e746f ('ot.plt') R14: 0x1 R15: 0x555555c4cba0 --> 0x555555c4ccd0 ("./stNaz8mA") EFLAGS: 0x10206 (carry PARITY adjust zero sign trap INTERRUPT direction overflow) [-------------------------------------code-------------------------------------] 0x5555556d1480 <bfd_elf_set_group_contents+704>: lea rsp,[rsp+0x98] 0x5555556d1488 <bfd_elf_set_group_contents+712>: mov r13,QWORD PTR [rsp] 0x5555556d148c <bfd_elf_set_group_contents+716>: mov r14d,DWORD PTR [r13+0x10] => 0x5555556d1490 <bfd_elf_set_group_contents+720>: mov rax,QWORD PTR [r12+r14*8] 0x5555556d1494 <bfd_elf_set_group_contents+724>: mov r8,QWORD PTR [rax+0x28] 0x5555556d1498 <bfd_elf_set_group_contents+728>: lea rsp,[rsp-0x98] 0x5555556d14a0 <bfd_elf_set_group_contents+736>: mov QWORD PTR [rsp],rdx 0x5555556d14a4 <bfd_elf_set_group_contents+740>: mov QWORD PTR [rsp+0x8],rcx [------------------------------------stack-------------------------------------] 0000| 0x7fffffff1c20 --> 0x555555c5b710 --> 0x555555c48438 --> 0x2e00746c702e746f ('ot.plt') 0008| 0x7fffffff1c28 --> 0x7fffffff1d5c --> 0x0 0016| 0x7fffffff1c30 --> 0x555555c5f830 --> 0x90000000f 0024| 0x7fffffff1c38 --> 0x555555c5b710 --> 0x555555c48438 --> 0x2e00746c702e746f ('ot.plt') 0032| 0x7fffffff1c40 --> 0x1 0040| 0x7fffffff1c48 --> 0x555555c4cba0 --> 0x555555c4ccd0 ("./stNaz8mA") 0048| 0x7fffffff1c50 --> 0x5555556d11c0 (<bfd_elf_set_group_contents>: lea rsp,[rsp-0x98]) 0056| 0x7fffffff1c58 --> 0x7fffffff1d5c --> 0x0 [------------------------------------------------------------------------------] Legend: code, data, rodata, value Stopped reason: SIGSEGV 0x00005555556d1490 in bfd_elf_set_group_contents (abfd=0x555555c4cba0, sec=0x555555c5b710, failedptrarg=<optimized out>) at elf.c:3538 3538 symindx = elf_section_syms (abfd)[sec->index]->udata.i; -- You are receiving this mail because: You are on the CC list for the bug.