Bug 1412348

Summary: readelf: Error: the dynamic segment offset + size exceeds the size of the file
Product: [Fedora] Fedora Reporter: Orion Poplawski <orion>
Component: binutilsAssignee: Nick Clifton <nickc>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: unspecified    
Version: 26CC: atigro, dominik, jakub, nickc, orion, rc040203, samuel.rakitnican
Target Milestone: ---Keywords: Reopened
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
Whiteboard:
Fixed In Version: binutils-2.27-21.fc26 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-04-01 17:26:06 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
rootn.exe
none
one of HandBrake's binaries about which readelf is complaining none

Description Orion Poplawski 2017-01-11 20:11:02 UTC
Description of problem:

Builds of root are failing, see https://pagure.io/fedora-infrastructure/issue/5678

From the build.log:

extracting debug info from /builddir/build/BUILDROOT/root-6.08.02-3.fc26.aarch64/usr/bin/rootn.exe
readelf: Error: the dynamic segment offset + size exceeds the size of the file
extracting debug info from /builddir/build/BUILDROOT/root-6.08.02-3.fc26.aarch64/usr/bin/rootnb.exe
extracting debug info from /builddir/build/BUILDROOT/root-6.08.02-3.fc26.aarch64/usr/bin/proofexecv
extracting debug info from /builddir/build/BUILDROOT/root-6.08.02-3.fc26.aarch64/usr/bin/hist2workspace
extracting debug info from /builddir/build/BUILDROOT/root-6.08.02-3.fc26.aarch64/usr/bin/rootd
extracting debug info from /builddir/build/BUILDROOT/root-6.08.02-3.fc26.aarch64/usr/bin/root.exe
readelf: Error: the dynamic segment offset + size exceeds the size of the file
extracting debug info from /builddir/build/BUILDROOT/root-6.08.02-3.fc26.aarch64/usr/bin/root
file /builddir/build/BUILDROOT/root-6.08.02-3.fc26.aarch64/usr/bin/rootcint has 2 other hard links
extracting debug info from /builddir/build/BUILDROOT/root-6.08.02-3.fc26.aarch64/usr/bin/rootcint
extracting debug info from /builddir/build/BUILDROOT/root-6.08.02-3.fc26.aarch64/usr/bin/ssh2rpd
extracting debug info from /builddir/build/BUILDROOT/root-6.08.02-3.fc26.aarch64/usr/bin/pq2
extracting debug info from /builddir/build/BUILDROOT/root-6.08.02-3.fc26.aarch64/usr/bin/proofd
extracting debug info from /builddir/build/BUILDROOT/root-6.08.02-3.fc26.aarch64/usr/bin/rmkdepend
extracting debug info from /builddir/build/BUILDROOT/root-6.08.02-3.fc26.aarch64/usr/bin/proofserv.exe
readelf: Error: the dynamic segment offset + size exceeds the size of the file
hard linked /builddir/build/BUILDROOT/root-6.08.02-3.fc26.aarch64/usr/lib/debug/usr/bin/genreflex.debug to /builddir/build/BUILDROOT/root-6.08.02-3.fc26.aarch64/usr/lib/debug/usr/bin/rootcint.debug
extracting debug info from /builddir/build/BUILDROOT/root-6.08.02-3.fc26.aarch64/usr/bin/roots.exe
readelf: Error: the dynamic segment offset + size exceeds the size of the file
extracting debug info from /builddir/build/BUILDROOT/root-6.08.02-3.fc26.aarch64/usr/bin/hadd
extracting debug info from /builddir/build/BUILDROOT/root-6.08.02-3.fc26.aarch64/usr/bin/g2root
hard linked /builddir/build/BUILDROOT/root-6.08.02-3.fc26.aarch64/usr/lib/debug/usr/bin/rootcling.debug to /builddir/build/BUILDROOT/root-6.08.02-3.fc26.aarch64/usr/lib/debug/usr/bin/rootcint.debug
extracting debug info from /builddir/build/BUILDROOT/root-6.08.02-3.fc26.aarch64/usr/bin/rlibmap
readelf: Error: the dynamic segment offset + size exceeds the size of the file

The readelf errors do not occur on other arches, so I think this may be the cause.

Version-Release number of selected component (if applicable):
2.27-13.fc26

Comment 1 Nick Clifton 2017-01-12 10:01:26 UTC
Hi Orion,

  Please could you upload the aarch64 rootn.exe file so that I can examine it and find out what readelf is complaining about ?

Cheers
  Nick

Comment 2 Orion Poplawski 2017-01-13 15:57:15 UTC
Created attachment 1240381 [details]
rootn.exe

Here you go.

Comment 3 Nick Clifton 2017-01-16 13:03:42 UTC
Hi Orion,

> Here you go.

Thanks.  Unfortunately I cannot reproduce the problem. :-(  Running "readelf -W -S rootn.exe" produces the expected output and no error messages about the dynamic segment.  Plus when I check the dynamic segment manually, it does indeed fit in the file.

I am at a loss as how to proceed with this bug.  The code that checks the dynamic section size in readelf looks good to me.  The rootn.exe file looks OK.  I suppose that it is possible that the find-debuginfo.sh script (which is invoking readelf and then failing) is picking up an old version of readelf.  But I have tried versions from F23 (based upon binutils 2.25) and RHEL 6.9 (based upon binutils 2.20) and they both work as well.

Possibly the problem is output synchronization - ie the error message about the dynamic segment being too big is not caused by the rootn.exe file at all, but some other file that has been processed by readelf.  The error message is printed to stderr, so it is quite possible that the build log is not synchronising stdout and stderr output, or that multiple processes are running at the same time.  So, with that in mind, would you mind trying out a rawhide rebuild which should pick up a new binutils rpm (binutils-2.27-14.fc26) which includes the file name in all error messages.

Cheers
  Nick

I see that there is a new version of the rootn package (6.08.04) as compared to the version whose builds were failing in koji (6.08.02).  Does this new version also experience these build problems ?

Comment 4 Orion Poplawski 2017-01-23 23:56:01 UTC
Seems to be building now - https://koji.fedoraproject.org/koji/taskinfo?taskID=17392791

Thanks for taking a look.

Comment 5 Dominik 'Rathann' Mierzejewski 2017-01-29 00:16:49 UTC
I'm seeing the same issue while building HandBrake for RPMFusion (reproducible in mock locally on x86_64) and the result is an empty -debuginfo package:
[...]
+ /usr/lib/rpm/find-debuginfo.sh --strict-build-id -m --run-dwz --dwz-low-mem-die-limit 10000000 --dwz-max-die-limit 110000000 /builddir/build/BUILD/HandBrake-1.0.2
extracting debug info from /builddir/build/BUILDROOT/HandBrake-1.0.2-1.fc26.x86_64/usr/bin/ghb
readelf: Error: the dynamic segment offset + size exceeds the size of the file
extracting debug info from /builddir/build/BUILDROOT/HandBrake-1.0.2-1.fc26.x86_64/usr/bin/HandBrakeCLI
readelf: Error: the dynamic segment offset + size exceeds the size of the file
dwz: Too few files for multifile optimization
/usr/lib/rpm/sepdebugcrcfix: Updated 0 CRC32s, 2 CRC32s did match.
[...]

Here's the affected package:
https://www.greysector.net/~rathann/review/HandBrake/HandBrake-1.0.2-1.fc25.src.rpm

Comment 6 Dominik 'Rathann' Mierzejewski 2017-01-29 00:20:04 UTC
Created attachment 1245468 [details]
one of HandBrake's binaries about which readelf is complaining

Comment 7 Nick Clifton 2017-01-31 10:58:57 UTC
Hi Dominik,

  This is very strange.  I cannot reproduce this failure.  I downloaded the binary you provided in comment #6 and tried to get readelf to complain about it, but to no avail.  All the versions that I tried, including rawhide, F25, F23 and even RHEL 6.9, all think that the binary is OK and that there are no problems with the dynamic segment.

  Can I ask a few questions:

  * Which version of the binutils rpm do you have installed ?

  * Are you running the build on a 32-bit host ?

  * If you run "readelf -W -S HandBrakeCLI" are any errors reported ?

Cheers
  Nick

Comment 8 Fedora End Of Life 2017-02-28 10:55:56 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 26 development cycle.
Changing version to '26'.

Comment 9 Ralf Corsepius 2017-03-21 16:19:01 UTC
Another case, this time fedora-26-i386's systemd:

e.g.: https://kojipkgs.fedoraproject.org//packages/systemd/233/3.fc26/data/logs/i686/build.log

...
extracting debug info from /builddir/build/BUILDROOT/systemd-233-3.fc26.i386/usr/lib/systemd/tests/test-arphrd-list
readelf: /builddir/build/BUILDROOT/systemd-233-3.fc26.i386/usr/lib/debug/usr/lib/systemd/tests/test-arphrd-list.debug: Error: the dynamic segment offset + size exceeds the size of the file
extracting debug info from /builddir/build/BUILDROOT/systemd-233-3.fc26.i386/usr/lib/systemd/tests/test-condition
...

ATM, this case can be reproduced by rebuilding systemd-233-3.fc26.src.rpm from fedora's git (fc26 branch) in local mocks (on x86_64, in case this should matter)

Comment 10 Nick Clifton 2017-03-21 16:29:43 UTC
Hi Ralf,

  Could this be related to:

https://bugzilla.redhat.com/show_bug.cgi?id=1434050

  If so, does the problem still exist with the binutils-2.27-21.fc26 rpm that was created today ?

Cheers
  Nick

Comment 11 Dominik 'Rathann' Mierzejewski 2017-03-22 00:02:26 UTC
Actually the empty debuginfo package was not readelf's fault. Sorry for the false positive.

Also sorry, but I didn't have time to dig into this. The bug you referenced in comment 10 looks like it could be the same. I'll try to keep an eye out for these error messages in my next builds.

Comment 12 Ralf Corsepius 2017-03-22 04:28:54 UTC
(In reply to Nick Clifton from comment #10)
>   If so, does the problem still exist with the binutils-2.27-21.fc26 rpm
> that was created today ?

I can confirm, this error-message is gone when building 
systemd-233-3.fc26.i386 w/ binutils-2.27-21.fc26.

Comment 13 Nick Clifton 2017-03-22 10:47:55 UTC

*** This bug has been marked as a duplicate of bug 1434050 ***

Comment 14 Fedora Update System 2017-03-22 11:43:05 UTC
binutils-2.27-21.fc26 has been submitted as an update to Fedora 26. https://bodhi.fedoraproject.org/updates/FEDORA-2017-519de08d5c

Comment 15 Fedora Update System 2017-03-22 15:29:18 UTC
binutils-2.27-21.fc26 has been pushed to the Fedora 26 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2017-519de08d5c

Comment 16 srakitnican 2017-03-23 22:30:17 UTC
Experienced the same issue on Fedora 25, binutils-2.27-21.fc26.x86_64 fixed the issue.

Comment 17 Fedora Update System 2017-04-01 17:26:06 UTC
binutils-2.27-21.fc26 has been pushed to the Fedora 26 stable repository. If problems still persist, please make note of it in this bug report.