Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 622886 - sys-devel/binutils-2.28: upstream fix: Don't error on .debug files with NOBITS .dynamic section.
Summary: sys-devel/binutils-2.28: upstream fix: Don't error on .debug files with NOBIT...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal minor (vote)
Assignee: Gentoo Toolchain Maintainers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-06-28 03:24 UTC by Hank Leininger
Modified: 2017-09-13 19:00 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
Fix readelf warning on debuginfo files. (binutils-2.28-readelf-debug.patch,1.32 KB, patch)
2017-06-28 03:24 UTC, Hank Leininger
Details | Diff
Modify binutils ebuild to use the readelf patch (binutils-2.28-r2-ebuild_readelf_debug_fix.patch,406 bytes, patch)
2017-06-28 03:26 UTC, Hank Leininger
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Hank Leininger 2017-06-28 03:24:30 UTC
Created attachment 478260 [details, diff]
Fix readelf warning on debuginfo files.

There is a small bug already fixed in upstream binutils: readelf on a separate debuginfo file will produce a spurious warning, like this example taken directly from the Stack Clash mitigation writeup at https://wiki.gentoo.org/wiki/Hardened/Gentoo_Hardened_and_Stack_Clash for the case of a system using FEATURES=splitdebug:

  $ readelf -p .comment /usr/lib/debug/usr/bin/whoami.debug
  readelf: Error: the dynamic segment offset + size exceeds the size of the file

  String dump of section '.comment':
    [     0]  GCC: (Gentoo Hardened 5.4.0-r3 p1.3, pie-0.6.5) 5.4.0

This is because of a check that was added recently that does not do the right thing with splitdebug files.  This has been fixed upstream, see:

  https://sourceware.org/ml/binutils/2017-03/msg00279.html

These errors are unhandled by tools that use readelf, such as app-admin/checksec-1.7.5 (although it doesn't really expect to be pointed at debuginfo files AFAIK).

I have extracted the patch and tested locally, after which I get the expected behavior:

  $ readelf -p .comment /usr/lib/debug/usr/bin/whoami.debug

  String dump of section '.comment':
    [     0]  GCC: (Gentoo Hardened 5.4.0-r3 p1.3, pie-0.6.5) 5.4.0

I'll attach the readelf.c patch, and also the .ebuild patch I used to apply it (only for testing, it looks like toolchain-binutils.eclass does some magic with PATCHVER= to grab the necessary patch bundle).
Comment 1 Hank Leininger 2017-06-28 03:26:34 UTC
Created attachment 478262 [details, diff]
Modify binutils ebuild to use the readelf patch
Comment 2 Matthias Maier gentoo-dev 2017-08-02 00:13:42 UTC
Patch applied in 2.28.1



commit cf5003fe2fc3b45f366d0a3c6fdf834ed9d54321
Author: Matthias Maier <tamiko@gentoo.org>
Date:   Tue Aug 1 19:05:14 2017 -0500

    sys-devel/binutils: version bump to 2.28.1, patchset 1.0
    
    Includes fixes for bugs #622036 #622500 #622886 #624524 #624702
    
    Package-Manager: Portage-2.3.6, Repoman-2.3.3
Comment 3 Andreas K. Hüttel archtester gentoo-dev 2017-09-13 19:00:26 UTC
(In reply to Matthias Maier from comment #2)
> Patch applied in 2.28.1
> 
> 
> 
> commit cf5003fe2fc3b45f366d0a3c6fdf834ed9d54321
> Author: Matthias Maier <tamiko@gentoo.org>
> Date:   Tue Aug 1 19:05:14 2017 -0500
> 
>     sys-devel/binutils: version bump to 2.28.1, patchset 1.0
>     
>     Includes fixes for bugs #622036 #622500 #622886 #624524 #624702
>     
>     Package-Manager: Portage-2.3.6, Repoman-2.3.3

I guess we can close this now.