Bug 1563141 - eu-readelf provides strange output after annobin update in F28
Summary: eu-readelf provides strange output after annobin update in F28
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: annobin
Version: 28
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: 2018-04-03 08:59 UTC by Vít Ondruch
Modified: 2018-04-09 13:25 UTC (History)
9 users (show)

Fixed In Version: annobin-5.2-1.fc28
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-04-09 13:25:27 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
Faulty libruby (13.75 MB, application/x-sharedlib)
2018-04-03 12:45 UTC, Vít Ondruch
no flags Details

Description Vít Ondruch 2018-04-03 08:59:05 UTC
Description of problem:
Ruby recently started to fail on F28 since this Koschei build [1] (please note that Rawhide builds appear to pass this test). The build fails at this line [2], where the "eu-readelf" output is processed. Comparing the output of eu-readelf on f28 and Rawhide, there are differences such as:

~~~
   GA*GOW                 0  <unknown>: 256
-  GA*ÿÿÿÿÿÿÿÿ           0  <unknown>: 256
-  GA!stack_clash          0  <unknown>: 256
+  GA*                  0  <unknown>: 256
+  GA+stack_clash          0  <unknown>: 256
   GA*cf_protection          0  <unknown>: 256
~~~

Please note the "ÿÿÿÿÿÿÿÿ" on F28 which appears to be just "^A" on Rawhide.

Not sure if this is really annobin but this is my best guess.





[1] https://apps.fedoraproject.org/koschei/build/4542439
[2] https://src.fedoraproject.org/rpms/ruby/blob/master/f/test_systemtap.rb#_56

Comment 1 Florian Weimer 2018-04-03 09:08:49 UTC
Well, there is a \001/^A byte in the note name, so there isn't much that eu-readelf can do here.  eu-readelf shouldn't produce U+00FF characters in the output, though.

Comment 2 Mark Wielaard 2018-04-03 09:14:21 UTC
I don't think this is a error in eu-readelf, it just produces the NOTE name. annobin really shouldn't use unprintable characters in the NOTE string name. The NOTE name is null-terminated character representation of the entry's owner. It should be something like "GNU" or "annobin". But it appears to encode data, which should go into the note descriptor.

Comment 3 Mark Wielaard 2018-04-03 09:49:37 UTC
BTW. For the ruby testcase it would probably help to just grep for the stapsdt probe NOTEs. Just only scan for the 2 lines after a stapsdt owner NOTE with:

probes_detected = `eu-readelf -n "#{LIBRUBY_SO}" | grep -A2 "^  stapsdt"`

Comment 4 Vít Ondruch 2018-04-03 09:51:36 UTC
I don't understand why this exhibits itself on F28 and not on Rawhide while elfutils are of the same version on Rawhide as well as F28:

$ rpm -qf `which eu-readelf`
elfutils-0.170-1.fc27.x86_64

Comment 5 Vít Ondruch 2018-04-03 09:54:05 UTC
(In reply to Mark Wielaard from comment #3)
I think I am going to give you some time to fix this prior applying the workaround ;)

Comment 6 Nick Clifton 2018-04-03 11:57:55 UTC
(In reply to Mark Wielaard from comment #2)
Hi Mark,

> I don't think this is a error in eu-readelf, it just produces the NOTE name.
> annobin really shouldn't use unprintable characters in the NOTE string name.
> The NOTE name is null-terminated character representation of the entry's
> owner. It should be something like "GNU" or "annobin". But it appears to
> encode data, which should go into the note descriptor.

This was an unfortunately design choice, but it is too late to change it now without loosing backwards compatibility.

Interestingly, there appears to be something wrong with the note that is being displayed by eu-readelf:

  GA*ÿÿÿÿÿÿÿÿ 

Assuming that the first \001 byte is correct, then this is supposed to be a version note which includes a printable string as the rest of its name, rather
than a numeric sequence.  Ie it is supposed to be:

  GA$\0013p5\000

(Which indicates version 3 of the protocol and version 5 of the plugin).

I think that the note that eu-readelf is displaying has been corrupted somehow,
and this is what is causing the display problems.  I am not sure what would be causing this corruption however.

Cheers
  Nick

Comment 7 Nick Clifton 2018-04-03 12:03:55 UTC
Hi Vít,

> Ruby recently started to fail on F28 since this Koschei build 

Which version of the annobin package are you using ?


> [ The build fails at this
> line [2], where the "eu-readelf" output is processed.

Would it be possible for you to upload the binary file that is being
processed at this point ?

Also - do you get similar problems if you use the readelf program from
the binutils package instead of eu-readelf ?


> Not sure if this is really annobin but this is my best guess.

It probably is annobin's fault, somehow, but in order to find out what
is causing it, it would be really helpful to have a small, reproducible
test case.  Is there any change that you could capture the compilation 
that is producing the binary that contains the bogus annobin note ?

Cheers
  Nick

Comment 8 Vít Ondruch 2018-04-03 12:43:47 UTC
(In reply to Nick Clifton from comment #7)
> Hi Vít,
> 
> > Ruby recently started to fail on F28 since this Koschei build 
> 
> Which version of the annobin package are you using ?

$ rpm -q annobin
annobin-5.1-1.fc28.x86_64

> > [ The build fails at this
> > line [2], where the "eu-readelf" output is processed.
> 
> Would it be possible for you to upload the binary file that is being
> processed at this point ?
> 
> Also - do you get similar problems if you use the readelf program from
> the binutils package instead of eu-readelf ?

This is relevant part of the readelf output:

~~~
  GA*GOW:0x00000000044aa 0x00000000     OPEN
    Applies to region from 0x2da30 to 0x2dc88
  GA*<stack prot>0xffffffffffffffff 0x00000000  OPEN
    Applies to region from 0x2da30 to 0x2dc88
  GA!stack_clash:false 0x00000000       OPEN
    Applies to region from 0x2da30 to 0x2dc88
  GA*cf_protection:0x001 0x00000000     OPEN
    Applies to region from 0x2da30 to 0x2dc88
~~~

Comment 9 Vít Ondruch 2018-04-03 12:45:10 UTC
Created attachment 1416729 [details]
Faulty libruby

Comment 10 Vít Ondruch 2018-04-03 12:47:35 UTC
(In reply to Nick Clifton from comment #7)
> > Not sure if this is really annobin but this is my best guess.
> 
> It probably is annobin's fault, somehow, but in order to find out what
> is causing it, it would be really helpful to have a small, reproducible
> test case.  Is there any change that you could capture the compilation 
> that is producing the binary that contains the bogus annobin note ?

You should be able to reproduce it locally:

~~~
fedpkg co ruby
cd ruby
fedpkg srpm
mock -r fedora-28-x86_64 ruby-2.5.0-90.fc28.src.rpm
~~~

Comment 11 Nick Clifton 2018-04-03 14:58:20 UTC
(In reply to Vít Ondruch from comment #10)
 
Hi Vit,

  OK, following those directions I was able to reproduce the problem.
  I was able to develop a workaround by editing the test_systemtab.rb script
  and changing:

# Detect probes in resulting library.
get_probes_detected = %r{
^\s*Provider:\s+ruby,\s+Name:\s+(\S+),\s+.*$
}

probes_detected = `eu-readelf -n "#{LIBRUBY_SO}"`

  to:

# Detect probes in resulting library.
get_probes_detected = %r{
^\s*Name:\s+(\S+)$
}

probes_detected = `readelf -n "#{LIBRUBY_SO}"`

  (ie using the readelf from the binutils package).

  The fix, IMHO, is for eu-readelf to either interpret annobin notes
  in the same way as the binutils readelf, and/or display non-printing
  characters as escape sequences.  (This would be a good thing even if
  the annobin notes did not exist as there can always be corrupt binaries
  containing corrupt notes).

  In the meantime I will add a patch to annobin so that it no longer
  records an unknown stack-protection setting as -1, but instead uses 0.
  This should prevent the generation of the notes that eu-readelf does not
  like.

Cheers
  Nick

Comment 12 Nick Clifton 2018-04-03 15:27:19 UTC
Hi Vit,

  I have built annobin-5.2-1.fc28 (and annobin-5.2-1.fc29) which should
  no longer generate the note that is confusing eu-readelf.  Please give
  it a go.

Cheers
  Nick

Comment 13 Vít Ondruch 2018-04-04 09:43:35 UTC
Hi Nick,

I tried build of Ruby in F28 mock manually installing the recent build of annobin-5.2-1.fc28 and the build passed. The build is still passing on Rawhide. So it should be good on Ruby side.

Will you submit update for F28? And possibly buildroot override? Pavel Valena is working on Ruby updates, so it will soon become blocker for us.

Thx

Comment 14 Fedora Update System 2018-04-04 10:27:09 UTC
annobin-5.2-1.fc28 has been submitted as an update to Fedora 28. https://bodhi.fedoraproject.org/updates/FEDORA-2018-77a311c2e5

Comment 15 Fedora Update System 2018-04-04 18:36:44 UTC
annobin-5.2-1.fc28 has been pushed to the Fedora 28 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-2018-77a311c2e5

Comment 16 Fedora Update System 2018-04-09 13:25:27 UTC
annobin-5.2-1.fc28 has been pushed to the Fedora 28 stable repository. If problems still persist, please make note of it in this bug report.


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