Bug 835877

Summary: xlatetom fails for cross-endian elf note data
Product: [Fedora] Fedora Reporter: Dan Horák <dan>
Component: elfutilsAssignee: Roland McGrath <roland>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: dwa, dwmw2, fche, karsten, mjw, mjw, pmachata, roland
Target Milestone: ---   
Target Release: ---   
Hardware: s390x   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-08-09 23:09:54 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:

Description Dan Horák 2012-06-27 12:12:02 UTC
unstrip test fails on s390 and s390x with

--- unstrip.out	2012-06-27 02:54:54.093809686 -0400
+++ -	2012-06-27 02:54:54.099578719 -0400
@@ -1,6 +1,6 @@
 0x8048000+0x2000 f1c600bc36cb91bf01f9a63a634ecb79aa4c3199@0x8048178 . - [exe]
 0xf77d6000+0x1000 676560b1b765cde9c2e53f134f4ee354ea894747@0xf77d6210 . - linux-gate.so.1
-0xf77b3000+0x9000 - /lib/librt.so.1 - librt.so.1
-0xf7603000+0x1b0000 - /lib/libc.so.6 - libc.so.6
-0xf75e9000+0x1a000 - /lib/libpthread.so.0 - libpthread.so.0
+0xf77b3000+0x9000 c6c5b5e35ab9589d4762ac85b4bd56b1b2720e37@0xf77b3164 /lib/librt.so.1 - librt.so.1
+0xf7603000+0x1b0000 0b9bf374699e141e5dfc14757ff42b8c2373b4de@0xf7603184 /lib/libc.so.6 - libc.so.6
+0xf75e9000+0x1a000 29a103420abe341e92072fb14274e250e4072148@0xf75e9164 /lib/libpthread.so.0 - libpthread.so.0
 0xf77d7000+0x21000 6d2cb32650054f1c176d01d48713a4a5e5e84c1a@0xf77d7124 /lib/ld-linux.so.2 - ld-linux.so.2
FAIL: run-unstrip-n.sh


Version-Release number of selected component (if applicable):
elfutils-0.154-1.fc18

build in koji is http://s390.koji.fedoraproject.org/koji/taskinfo?taskID=709627

Comment 1 Petr Machata 2012-06-28 12:59:22 UTC
The problem is in interaction between libdwfl and libelf.  For non-native core dumps, dwfl_segment_report_module issues elf32_xlatetom on data of each note.  elf32_xlatetom checks, whether the data contains an integer number of records.  But I don't think it is right to do that for notes, as the payload bytes follow the header bytes, it's not an array of records as is the case otherwise.  So how about this?

diff -up elfutils-0.154/libelf/elf32_xlatetom.c\~ elfutils-0.154/libelf/elf32_xlatetom.c
--- elfutils-0.154/libelf/elf32_xlatetom.c~	2012-06-22 14:25:41 +0200
+++ elfutils-0.154/libelf/elf32_xlatetom.c	2012-06-28 14:59:37 +0200
@@ -59,7 +59,8 @@ elfw2(LIBELFBITS, xlatetom) (dest, src, 
 #endif
 
 
-  if (src->d_size % recsize != 0)
+  if (src->d_type != ELF_T_NHDR
+      && src->d_size % recsize != 0)
     {
       __libelf_seterrno (ELF_E_INVALID_DATA);
       return NULL;

Maybe with an explanatory comment.

Comment 2 Petr Machata 2012-06-28 16:26:40 UTC
*** Bug 836297 has been marked as a duplicate of this bug. ***

Comment 3 Karsten Hopp 2012-07-02 11:17:37 UTC
any updates here as this is blocking quite a few builds on s390* and ppc* ?

Comment 4 Mark Wielaard 2012-07-02 11:55:11 UTC
(In reply to comment #3)
> any updates here as this is blocking quite a few builds on s390* and ppc* ?

Sorry, I hadn't realized this was blocking. Currently on vacation without access to real development machines (will go the GNU Tools Cauldron afterwards). If you need a build of 0.154 for an architecture that doesn't have a clean test result flip the %global nocheck to true in elfutils.spec (or make a special patch for the particular test in question like elfutils-0.154-binutils-pr-ld-13621.patch).

Note that the testcase is new and checks whether the fix for RHBZ#805447 is correct. So it isn't really a regression.

Comment 5 Karsten Hopp 2012-07-02 12:04:31 UTC
no problem, I'll exclude that particular test on the failing arches.
Enjoy your vacation!

Comment 6 Dan Horák 2012-07-02 12:16:51 UTC
(In reply to comment #5)
> no problem, I'll exclude that particular test on the failing arches.
> Enjoy your vacation!

thanks, I also prefer disable just the particular test

Comment 7 Fedora Update System 2012-07-10 18:26:13 UTC
elfutils-0.154-1.1.fc17 has been submitted as an update for Fedora 17.
https://admin.fedoraproject.org/updates/elfutils-0.154-1.1.fc17

Comment 8 Roland McGrath 2012-07-10 20:29:44 UTC
(In reply to comment #1)

The change looks fine to me if it gets a comment.
But as a general thing, I think patch review should be done over the mailing list rather than bugzilla.

Comment 9 Mark Wielaard 2012-07-18 11:31:14 UTC
Petr's patch was committed upstream. I created packages with it backported (and enabled the testcase again) as elfutils-0.154-2.fc18. Do the ppc and s390 koji builders pick that one up automagically?

Comment 10 Dan Horák 2012-07-18 11:42:07 UTC
(In reply to comment #9)
> Petr's patch was committed upstream. I created packages with it backported
> (and enabled the testcase again) as elfutils-0.154-2.fc18. Do the ppc and
> s390 koji builders pick that one up automagically?

yes, they will pick the new build automagically

Comment 11 Mark Wielaard 2012-07-21 20:45:10 UTC
(In reply to comment #10)
> (In reply to comment #9)
> > Petr's patch was committed upstream. I created packages with it backported
> > (and enabled the testcase again) as elfutils-0.154-2.fc18. Do the ppc and
> > s390 koji builders pick that one up automagically?
> 
> yes, they will pick the new build automagically

So 154-2 build and test were fine on i686, x86_64, ppc, ppc64 and s390.
But s390x saw a strange failure:
http://s390.koji.fedoraproject.org/koji/getfile?taskID=732847&name=build.log

Extracting symbols... File `elf32_checksum.o' not found in archive
FAIL: run-arextract.sh
Cannot get archive index: no index available
FAIL: run-arsymtest.sh

This is probably completely unrelated. But strange. Anybody with a s390x around that could investigate?

Comment 12 Petr Machata 2012-07-22 22:45:51 UTC
Dan Horák is usually willing to let me play on one of his Fedora/s390 machines, so I'll take a look.

(I also reassigned the component back from 0xFFFF.  Not sure why that happened.)

Comment 13 Dan Horák 2012-07-23 06:50:51 UTC
(In reply to comment #11)
> (In reply to comment #10)
> > (In reply to comment #9)
> > > Petr's patch was committed upstream. I created packages with it backported
> > > (and enabled the testcase again) as elfutils-0.154-2.fc18. Do the ppc and
> > > s390 koji builders pick that one up automagically?
> > 
> > yes, they will pick the new build automagically
> 
> So 154-2 build and test were fine on i686, x86_64, ppc, ppc64 and s390.
> But s390x saw a strange failure:
> http://s390.koji.fedoraproject.org/koji/getfile?taskID=732847&name=build.log
> 
> Extracting symbols... File `elf32_checksum.o' not found in archive
> FAIL: run-arextract.sh
> Cannot get archive index: no index available
> FAIL: run-arsymtest.sh

the second failure can be related to the recent change in binutils to support static library archives larger than 4GB, see bug #835957 for details

Comment 14 Petr Machata 2012-07-23 17:57:21 UTC
After looking inside, I think that both are related to 64-bit archives.  __libelf_next_arhdr_wrlock is rejecting archives because of the unknown special entry /SYM64/.

Comment 15 Mark Wielaard 2012-07-23 18:30:14 UTC
(In reply to comment #14)
> After looking inside, I think that both are related to 64-bit archives. 
> __libelf_next_arhdr_wrlock is rejecting archives because of the unknown
> special entry /SYM64/.

Thanks for looking. Lets open a new bug report for this issue then.

Comment 16 Fedora Update System 2012-07-25 10:15:13 UTC
elfutils-0.154-2.fc17 has been submitted as an update for Fedora 17.
https://admin.fedoraproject.org/updates/elfutils-0.154-2.fc17

Comment 17 Fedora Update System 2012-07-25 10:17:01 UTC
elfutils-0.154-2.fc16 has been submitted as an update for Fedora 16.
https://admin.fedoraproject.org/updates/elfutils-0.154-2.fc16

Comment 18 Fedora Update System 2012-07-26 03:57:54 UTC
Package elfutils-0.154-2.fc17:
* should fix your issue,
* was pushed to the Fedora 17 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing elfutils-0.154-2.fc17'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2012-11095/elfutils-0.154-2.fc17
then log in and leave karma (feedback).

Comment 19 Fedora Update System 2012-08-09 23:09:54 UTC
elfutils-0.154-2.fc16 has been pushed to the Fedora 16 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 20 Fedora Update System 2012-08-09 23:32:35 UTC
elfutils-0.154-2.fc17 has been pushed to the Fedora 17 stable repository.  If problems still persist, please make note of it in this bug report.