Bug 1206312 - find-debuginfo.sh fails on ELF with more than 256 notes
Summary: find-debuginfo.sh fails on ELF with more than 256 notes
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: rpm
Version: 7.1
Hardware: All
OS: Linux
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Florian Festi
QA Contact: Karel Srot
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-03-26 18:18 UTC by Pat Riehecky
Modified: 2016-07-04 18:37 UTC (History)
8 users (show)

Fixed In Version: rpm-4.11.3-10.el7
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-11-19 11:58:38 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2015:2138 0 normal SHIPPED_LIVE rpm bug fix and enhancement update 2015-11-19 10:39:52 UTC

Description Pat Riehecky 2015-03-26 18:18:24 UTC
Description of problem:

 Since the fix for CVE-2014-9620, file will print a "warning" that it only processed 256 notes:

$ file -N libjvm.so
libjvm.so: ELF 64-bit LSB shared object, x86-64, version 1 (GNU/Linux), dynamically linked, BuildID[sha1]=63ece24db1a29f9df8231337f741664e0b10fc7f, not stripped, too many notes (256)

And this leads to those messages and a failure:

stat: cannot stat 'libjvm.so,': No such file or directory
stat: cannot stat 'too': No such file or directory
stat: cannot stat 'many': No such file or directory
stat: cannot stat 'notes': No such file or directory
stat: cannot stat '(256)': No such file or directory

Version-Release number of selected component (if applicable):rpm-4.11.1-25.el7.x86_64


How reproducible:100%


Steps to Reproduce:
1.Attempt to build an RPM with an ELF binary containing more than 256 notes
2.
3.

Actual results:
+ /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/qemu-1.5.3
stat: cannot stat '/builddir/build/BUILDROOT/qemu-kvm-1.5.3-86.el7_1.1.x86_64/usr/libexec/qemu-kvm,': No such file or directory
stat: cannot stat 'too': No such file or directory
stat: cannot stat 'many': No such file or directory
stat: cannot stat 'notes': No such file or directory
stat: cannot stat '(256)': No such file or directory
extracting debug info from /builddir/build/BUILDROOT/qemu-kvm-1.5.3-86.el7_1.1.x86_64/usr/libexec/ksmctl

Expected results:
can build as expected

Additional info:
Fixed upstream at http://www.rpm.org/ticket/887

Comment 3 Karel Srot 2015-06-23 07:50:26 UTC
While trying to reproduce this bug I have encountered two things.

1. The fix for CVE-2014-9620 is not present in RHEL-6 nor RHEL-7 (intentionally) and therefore I was only able to reproduce it using the file from Fedora 21.

2. While trying to reproduce the problem I have also used specially crafted ELF created using the script from http://mx.gw.com/pipermail/file/2014/001653.html
Since it doesn't contain debug info it is processed differently as the real ELF but I have encountered one thing. When building the SPEC after removing the '%debug_package' macro I can see various error messages in the build log. It looks as follows:

Executing(%build): /bin/sh -e /var/tmp/rpm-tmp.YOp1bI
+ umask 022
+ cd /root/rpmbuild/BUILD
+ exit 0
Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.Dsru9n
+ umask 022
+ cd /root/rpmbuild/BUILD
+ '[' /root/rpmbuild/BUILDROOT/bz1206312pkg-1.0-1.x86_64 '!=' / ']'
+ rm -rf /root/rpmbuild/BUILDROOT/bz1206312pkg-1.0-1.x86_64
++ dirname /root/rpmbuild/BUILDROOT/bz1206312pkg-1.0-1.x86_64
+ mkdir -p /root/rpmbuild/BUILDROOT
+ mkdir /root/rpmbuild/BUILDROOT/bz1206312pkg-1.0-1.x86_64
+ mkdir -p /root/rpmbuild/BUILDROOT/bz1206312pkg-1.0-1.x86_64//usr/sbin
+ cp /mnt/testarea/test/bz1206312_crafted_elf.so /mnt/testarea/test/bz1206312_real.so.debug /root/rpmbuild/BUILDROOT/bz1206312pkg-1.0-1.x86_64//usr/sbin
+ chmod a+x /root/rpmbuild/BUILDROOT/bz1206312pkg-1.0-1.x86_64//usr/sbin/bz1206312_crafted_elf.so /root/rpmbuild/BUILDROOT/bz1206312pkg-1.0-1.x86_64//usr/sbin/bz1206312_real.so.debug
+ /usr/lib/rpm/check-buildroot
+ /usr/lib/rpm/redhat/brp-compress
+ /usr/lib/rpm/redhat/brp-strip /usr/bin/strip
+ /usr/lib/rpm/redhat/brp-strip-comment-note /usr/bin/strip /usr/bin/objdump
/usr/bin/objdump: '/root/rpmbuild/BUILDROOT/bz1206312pkg-1.0-1.x86_64/usr/sbin/bz1206312_crafted_elf.so,': No such file
/usr/bin/strip: '/root/rpmbuild/BUILDROOT/bz1206312pkg-1.0-1.x86_64/usr/sbin/bz1206312_crafted_elf.so,': No such file
/usr/bin/objdump: 'too': No such file
/usr/bin/strip: 'too': No such file
/usr/bin/objdump: 'many': No such file
/usr/bin/strip: 'many': No such file
/usr/bin/objdump: 'notes': No such file
/usr/bin/strip: 'notes': No such file
/usr/bin/objdump: '(256)': No such file
/usr/bin/strip: '(256)': No such file

Seems that also /usr/lib/rpm/brp-strip-comment-note should be fixed.

Comment 4 Florian Festi 2015-06-30 09:55:13 UTC
Nice catch! Thanks for looking into this that deeply! Fixed upstream at

https://github.com/rpm-software-management/rpm/commit/5b4805df2085b0e7c4f09caad62638c3238b3bc1

So there are even more scripts than need fixing.

The question still is whether this should be fixed in RHEL 7.2 or not as the file utility in unchanged there.

Comment 5 Florian Festi 2015-06-30 10:31:42 UTC
Are there any plans to add this new message to RHEL? Or should we just add these patches to be on the save side?

Comment 6 Florian Festi 2015-07-02 13:55:58 UTC
We are just putting the patches in to be on the save side

Comment 12 errata-xmlrpc 2015-11-19 11:58:38 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2015-2138.html


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