[Bug binutils/19435] New: objdump receives SIGABRT when disassembling Mach O binary on OS X
https://sourceware.org/bugzilla/show_bug.cgi?id=19435 Bug ID: 19435 Summary: objdump receives SIGABRT when disassembling Mach O binary on OS X Product: binutils Version: 2.25 Status: NEW Severity: normal Priority: P2 Component: binutils Assignee: unassigned at sourceware dot org Reporter: iankronquist at gmail dot com Target Milestone: --- Created attachment 8887 --> https://sourceware.org/bugzilla/attachment.cgi?id=8887&action=edit C Source code which can cause objdump to fail On OS X 10.11, given certain Mach-O x86_64 binaries compiled with the '-g' flag objdump vversion 2.25 receives SIGABRT when attempting to free a pointer which was never allocated. It should at least fail gracefully, but preferably should not fail at all. Steps to reproduce: Given the attached C source file, compile it with the '-g' flag with GCC 5.3.0 or clang Apple LLVM version 7.0.0 (clang-700.1.76). $ gcc -g out.c OR $ clang -g out.c Now run disassemble the resulting binary with the '-S' flag to mix in source code with the binary: $ objdump -S a.out ./a.out: file format mach-o-x86-64 Disassembly of section .text: ... many correct assembly instructions ... gobjdump(13297,0x7fff791b1000) malloc: *** error for object 0x101203e00: pointer being freed was not allocated *** set a breakpoint in malloc_error_break to debug Abort trap: 6 For your convenience, a binary which causes these problems is attached. I would be willing to do further investigation into this, and, if I am not too busy and this looks relatively approachable, work on providing a patch. -- 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
[Bug binutils/19435] objdump receives SIGABRT when disassembling Mach O binary on OS X
https://sourceware.org/bugzilla/show_bug.cgi?id=19435 Ian Kronquist changed: What|Removed |Added CC||iankronquist at gmail dot com -- 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
[Bug binutils/19435] objdump receives SIGABRT when disassembling Mach O binary on OS X
https://sourceware.org/bugzilla/show_bug.cgi?id=19435 --- Comment #1 from Ian Kronquist --- Created attachment --> https://sourceware.org/bugzilla/attachment.cgi?id=&action=edit A binary produced from the previous out.c file which causes objdump to fail -- 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
[Bug binutils/19435] objdump receives SIGABRT when disassembling Mach O binary on OS X
https://sourceware.org/bugzilla/show_bug.cgi?id=19435 --- Comment #2 from Ian Kronquist --- As a disclaimer, that C source code is incredibly ugly, and generated from a homework assignment. I swear I would never write trash like that. -- 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
[Bug binutils/19435] objdump receives SIGABRT when disassembling Mach O binary on OS X
https://sourceware.org/bugzilla/show_bug.cgi?id=19435 --- Comment #4 from Ian Kronquist --- Nick, The problem is mach-o specific. The problem persists under mainline binutils built on OS X. I attached a problematic mach-o which you could try to disassemble as described previously. The problem is in the function bfd_mach_o_close_and_cleanup, probably in the only invocation of free in that function. My guess is that some of the bfd metadata is messed up and never properly allocated, but I'm not sure. I'll have to do some more investigation. I'm willing to try to help fix the bug and submit a patch if I can get some guidance. Thanks, Ian On Jan 8, 2016 1:53 AM, "nickc at redhat dot com" < sourceware-bugzi...@sourceware.org> wrote: > https://sourceware.org/bugzilla/show_bug.cgi?id=19435 > > Nick Clifton changed: > >What|Removed |Added > > > CC||nickc at redhat dot com > > --- Comment #3 from Nick Clifton --- > Hi Ian, > > Unfortunately I am unable to reproduce this problem using an x86_64 Linux > hosted cross compiler. Possibly the problem is Mach-O specific. > > Please could you check to see if the problem is still present with the > current mainline binutils development sources. > > If the problem does still exist, please you try to narrow down where > the bug > is occurring. Ie where is the free() happening ? > > Cheers > Nick > > -- > You are receiving this mail because: > You are on the CC list for the bug. > You reported the bug. -- 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
[Bug binutils/19435] objdump receives SIGABRT when disassembling Mach O binary on OS X
https://sourceware.org/bugzilla/show_bug.cgi?id=19435 --- Comment #7 from Ian Kronquist --- Hi Nick, Those patches fix the problem, or at the very least hide it. Sincerely, Ian Kronquist On Fri, Jan 22, 2016 at 3:52 AM, nickc at redhat dot com < sourceware-bugzi...@sourceware.org> wrote: > https://sourceware.org/bugzilla/show_bug.cgi?id=19435 > > --- Comment #6 from Nick Clifton --- > I missed a bit... > > diff --git a/bfd/mach-o.c b/bfd/mach-o.c > index 72454f9..a712ff6 100644 > --- a/bfd/mach-o.c > +++ b/bfd/mach-o.c > @@ -5798,14 +5798,16 @@ bfd_mach_o_close_and_cleanup (bfd *abfd) >if (mdata->dsym_bfd != NULL) > { >bfd *fat_bfd = mdata->dsym_bfd->my_archive; > +#if 0 >char *dsym_filename = (char *)(fat_bfd > ? fat_bfd->filename > : mdata->dsym_bfd->filename); > +#endif >bfd_close (mdata->dsym_bfd); >mdata->dsym_bfd = NULL; >if (fat_bfd) > bfd_close (fat_bfd); > - free (dsym_filename); > + /*free (dsym_filename);*/ > } > } > > Cheers > Nick > > -- > You are receiving this mail because: > You are on the CC list for the bug. > You reported the bug. > -- 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