Bug 741053 - binutils-2.20.51.0.2-build-id.patch causes segfault on ARM
Summary: binutils-2.20.51.0.2-build-id.patch causes segfault on ARM
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Fedora
Classification: Fedora
Component: binutils
Version: 15
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Nick Clifton
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-09-24 18:49 UTC by Daniel Drake
Modified: 2012-08-07 20:00 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2012-08-07 20:00:20 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Daniel Drake 2011-09-24 18:49:53 UTC
F15 gcc fails to link on armv5tel due to ld crashing. 100% reproducible.

/usr/bin/ld --build-id --no-add-needed --eh-frame-hdr --hash-style=gnu -export-dynamic -dynamic-linker /lib/ld-linux.so.3 -X -m armelf_linux_eabi -o cc1 /usr/lib/gcc/armv5tel-redhat-linux-gnueabi/4.5.1/../../../crt1.o /usr/lib/gcc/armv5tel-redhat-linux-gnueabi/4.5.1/../../../crti.o /usr/lib/gcc/armv5tel-redhat-linux-gnueabi/4.5.1/crtbegin.o -L/usr/lib/gcc/armv5tel-redhat-linux-gnueabi/4.5.1 -L/usr/lib/gcc/armv5tel-redhat-linux-gnueabi/4.5.1/../../.. c-lang.o c-family/stub-objc.o attribs.o c-errors.o c-decl.o c-typeck.o c-convert.o c-aux-info.o c-objc-common.o c-parser.o tree-mudflap.o c-family/c-common.o c-family/c-cppbuiltin.o c-family/c-dump.o c-family/c-format.o c-family/c-gimplify.o c-family/c-lex.o c-family/c-omp.o c-family/c-opts.o c-family/c-pch.o c-family/c-ppoutput.o c-family/c-pragma.o c-family/c-pretty-print.o c-family/c-semantics.o c-family/c-ada-spec.o arm-c.o cc1-checksum.o main.o libbackend.a ../libcpp/libcpp.a ../libdecnumber/libdecnumber.a ../libcpp/libcpp.a ../libiberty/libiberty.a ../libdecnumber/libdecnumber.a -lmpc -lmpfr -lgmp -ldl -lz -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/lib/gcc/armv5tel-redhat-linux-gnueabi/4.5.1/crtend.o /usr/lib/gcc/armv5tel-redhat-linux-gnueabi/4.5.1/../../../crtn.o


Program received signal SIGSEGV, Segmentation fault.
sha1_process_block (buffer=<value optimized out>, len=<value optimized out>, 
    ctx=0x6a578500) at ./sha1.c:319
319	  while (words < endp)
Missing separate debuginfos, use: debuginfo-install glibc-2.13-2.1.armv5tel libgcc-4.5.1-5.fc14.1.armv5tel zlib-1.2.5-2.fc14.armv5tel
(gdb) 
(gdb) bt
#0  sha1_process_block (buffer=<value optimized out>, 
    len=<value optimized out>, ctx=0x6a578500) at ./sha1.c:319
#1  0x000348c8 in sha1_process_bytes (buffer=0x43ef2068, len=42803016, 
    ctx=0xbefff430) at ./sha1.c:245
#2  0x4006fc44 in bfd_elf32_checksum_contents (abfd=0x92530, 
    process=0x34808 <sha1_process_bytes>, arg=0xbefff430) at elfcode.h:1182
#3  0x0002d090 in gldarmelf_linux_eabi_write_build_id_section (abfd=0x90558)
    at earmelf_linux_eabi.c:1394
#4  0x400790d8 in _bfd_elf_write_object_contents (abfd=0x90558) at elf.c:5321
#5  0x4004301c in bfd_close (abfd=0x90558) at opncls.c:699
#6  0x000229fc in main (argc=10000, argv=0x43) at ./ldmain.c:497


This is with binutils-2.21.51.0.6-7.fc15.

I determined that removing --build-id from the ld invocation avoids the issue, and also that this issue doesn't occur if I rebuild binutils without patch08 "binutils-2.20.51.0.2-build-id.patch". I think this patch is buggy somehow.

The same bug is reported at Ubuntu:
https://bugs.launchpad.net/ubuntu/+source/binutils/+bug/759507
probably because they have also included the suspected-buggy patch:
http://patches.ubuntu.com/doh/b/binutils/extracted/128_build_id.dpatch

SSH access is available to an ARM box that trivially reproduces this issue if needed.

Any help much appreciated, as this is holding back F15/F16 ARM porting efforts. Thanks!

Comment 1 Daniel Drake 2011-09-24 21:24:20 UTC
This issue does not appear if we shift to a newer binutils version (by taking one of the f16 ones and rebuilding for f15).

The last version where this bug still occurs: 2.21.51.0.8-3.fc16
The first version that doesn't crash: 2.21.51.0.9-1.fc16

The suspected buggy patch is still included in the working version.

I took a look at the differences between 2.21.51.0.8 and 2.21.51.0.9 and identified that the following commit (included in 0.9 but not 0.8) solves the issue:
http://repo.or.cz/w/binutils.git/commitdiff/16beaaa62261c6bf0650e68a4f163c826b9fd79e

If I add that to F15 (even without removing binutils-2.20.51.0.2-build-id.patch), the crash no longer occurs.

Looking at that commit, I guess binutils-2.20.51.0.2-build-id.patch may not be buggy after all. The commit seems to fix the specific case of reading sections after bfd_final_link has written the contents out to disk, which is exactly what binutils-2.20.51.0.2-build-id.patch does. This looks like the right fix to me.

Comment 2 Nick Clifton 2011-09-30 15:15:09 UTC
Hi Daniel,

  Sorry for the very long delay in responding to this issue.  I have looked over the patch you located and I agree that it does the job, so I have now checked it in to the f15 sources.  Please try binutils-2.21.51.0.6-8.fc15 and let me know if you have any more problems.

Cheers
  Nick

Comment 3 Daniel Drake 2011-10-01 13:43:11 UTC
Another ARM contributor hit exactly the same issue compiling ghc (matching backtrace), and confirms that binutils-2.21.51.0.6-9.fc15 fixes the problem. Thanks!

Comment 4 Fedora End Of Life 2012-08-07 20:00:22 UTC
This message is a notice that Fedora 15 is now at end of life. Fedora
has stopped maintaining and issuing updates for Fedora 15. It is
Fedora's policy to close all bug reports from releases that are no
longer maintained. At this time, all open bugs with a Fedora 'version'
of '15' have been closed as WONTFIX.

(Please note: Our normal process is to give advanced warning of this
occurring, but we forgot to do that. A thousand apologies.)

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, feel free to reopen
this bug and simply change the 'version' to a later Fedora version.

Bug Reporter: Thank you for reporting this issue and we are sorry that
we were unable to fix it before Fedora 15 reached end of life. If you
would still like to see this bug fixed and are able to reproduce it
against a later version of Fedora, you are encouraged to click on
"Clone This Bug" (top right of this page) and open it against that
version of Fedora.

Although we aim to fix as many bugs as possible during every release's
lifetime, sometimes those efforts are overtaken by events. Often a
more recent Fedora release includes newer upstream software that fixes
bugs or makes them obsolete.

The process we are following is described here:
http://fedoraproject.org/wiki/BugZappers/HouseKeeping


Note You need to log in before you can comment on or make changes to this bug.