<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugzilla.yoctoproject.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugzilla.yoctoproject.org/"
          
          maintainer="it-coreprojects-helpdesk@linuxfoundation.org"
>

    <bug>
          <bug_id>9131</bug_id>
          
          <creation_ts>2016-02-17 21:09:29 +0000</creation_ts>
          <short_desc>Prelink breaks fork IFUNC</short_desc>
          <delta_ts>2016-12-15 16:25:26 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>7</classification_id>
          <classification>Build System, Metadata &amp; Runtime</classification>
          <product>OE-Core</product>
          <component>devtools / tool chain</component>
          <version>2.1</version>
          <rep_platform>All</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>High</priority>
          <bug_severity>major</bug_severity>
          <target_milestone>2.2 M3</target_milestone>
          
          <blocked>8192</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Francisco Pedraza">francisco.j.pedraza.gonzalez</reporter>
          <assigned_to name="Mark Hatle">mark.hatle</assigned_to>
          <cc>alexandru.c.georgescu</cc>
    
    <cc>alexandru.costinx.roman</cc>
    
    <cc>austin.phillips</cc>
    
    <cc>jose.perez.carranza</cc>
    
    <cc>mark.hatle</cc>
    
    <cc>meta.mr.watcher</cc>
    
    <cc>meta.watcher</cc>
    
    <cc>multisosnooley</cc>
    
    <cc>randy.macleod</cc>
    
    <cc>richard.purdie</cc>
    
    <cc>ross.burton</cc>
    
    <cc>sgw</cc>
    
    <cc>yi.zhao</cc>
          
          <qa_contact name="David Rodriguez">david.israelx.rodriguez.castellanos</qa_contact>
          <cf_os>---</cf_os>
          <cf_regression_type>Regression (Used to work)</cf_regression_type>
          
          <cf_docchange>No (bug/feature does not impact docs)</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>59168</commentid>
    <comment_count>0</comment_count>
    <who name="Francisco Pedraza">francisco.j.pedraza.gonzalez</who>
    <bug_when>2016-02-17 21:09:29 +0000</bug_when>
    <thetext>After booting yocto image, SATO is not working properly.
Any application can be opened successfully. 
If you go through terminal via serial mode, this message is displayed:
** (matchbox-desktop:807): WARNING **: Cannot launch &quot;app name&quot;: Failed to read enough data from child pip pipe (No child processes).
AB: http://autobuilder.yoctoproject.org/pub/releases/yocto-2.1_M2.rc3</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>59183</commentid>
    <comment_count>1</comment_count>
    <who name="Yi Zhao">yi.zhao</who>
    <bug_when>2016-02-18 09:04:41 +0000</bug_when>
    <thetext>This issue also happens on beaglebone and qemuppc but on qemumips64 it works without problem. I will update the results for qemuarm and qemumips once I test them.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>59186</commentid>
    <comment_count>2</comment_count>
    <who name="Alexandru Roman">alexandru.costinx.roman</who>
    <bug_when>2016-02-18 09:27:58 +0000</bug_when>
    <thetext>This issue also happens on qemux86(32bit).

I started qemu serial and found the same warning:

qemux86 login: D-BUS per-session daemon address is: unix:abstract=/tmp/dbus-pSct7RtlI0,guid=ff64e80c2e1b6aea1fab483656c58c88
[57;205Rmatchbox: Cant find a keycode for keysym 269025056
matchbox: ignoring key shortcut XF86Calendar=!$contacts

matchbox: Cant find a keycode for keysym 2809
matchbox: ignoring key shortcut telephone=!$dates

matchbox: Cant find a keycode for keysym 269025050
matchbox: ignoring key shortcut XF86Start=!matchbox-remote -desktop

[settings daemon] Forking. run with -n to prevent fork

** (matchbox-panel:633): WARNING **: Failed to load applet &quot;battery&quot; (/usr/lib/matchbox-panel/libbattery.so: cannot open shared object file: No such file or directory).

** (matchbox-desktop:632): WARNING **: Cannot launch matchbox-terminal: Failed to read enough data from child pid pipe (No child processes)




For qemux86-64(64bit) I was able to start applications.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>59228</commentid>
    <comment_count>3</comment_count>
    <who name="Francisco Pedraza">francisco.j.pedraza.gonzalez</who>
    <bug_when>2016-02-18 20:47:38 +0000</bug_when>
    <thetext>Additional information:
poky : 152914f2983c5d69001de1d46ce99547fa1e75fe.
Several BSP: MMax32 bit, genericx86.
Steps to reproduce it:
1. Compila an image or download it from AB.
2. Boot the image from SDCard or USB on MMax or desired platform.
3. Try to perform any application, such as terminal etc.
Expected Result: 
All the applications should be launched successfully.
Actual Result:
The applications are not being launched properly.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>59244</commentid>
    <comment_count>4</comment_count>
    <who name="Yi Zhao">yi.zhao</who>
    <bug_when>2016-02-19 07:20:10 +0000</bug_when>
    <thetext>(In reply to comment #1)
&gt; This issue also happens on beaglebone and qemuppc but on qemumips64 it works
&gt; without problem. I will update the results for qemuarm and qemumips once I
&gt; test them.

This issue also happens on qemuarm, but it works on qemumips</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>59275</commentid>
    <comment_count>5</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2016-02-19 15:54:32 +0000</bug_when>
    <thetext>Interestingly, works on intel-core2-32.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>59302</commentid>
    <comment_count>6</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2016-02-19 23:47:50 +0000</bug_when>
    <thetext>core-image-sato also works for me on qemux86...

I&apos;m stuck on the wrong end of a bad 3G link right now so can&apos;t download autobuilder images.  Hopefully on Monday my ADSL is back.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>59411</commentid>
    <comment_count>7</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2016-02-23 21:15:19 +0000</bug_when>
    <thetext>Doesn&apos;t appear to be specific to sysvinit, at least I can&apos;t replicate with sysv or systemd.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>59440</commentid>
    <comment_count>8</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2016-02-24 17:41:00 +0000</bug_when>
    <thetext>If I take an image from the autobuilder, it doesn&apos;t work.  Install libglib from the same release&apos;s rpm/ feed and it works.  I&apos;m blaming prelink but I still can&apos;t replicate outside of the AB.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>59454</commentid>
    <comment_count>9</comment_count>
    <who name="Francisco Pedraza">francisco.j.pedraza.gonzalez</who>
    <bug_when>2016-02-24 23:23:15 +0000</bug_when>
    <thetext>This issues is also reproducible on:
corei7-64 - Minnow max 32. Below you can find the AB link:
http://yocto-ab-master.jf.intel.com/pub/releases/yocto-2.1_M2.rc1/machines/intel-corei7-64/core-image-sato-sdk-intel-corei7-64.hddimg</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>59455</commentid>
    <comment_count>10</comment_count>
    <who name="Francisco Pedraza">francisco.j.pedraza.gonzalez</who>
    <bug_when>2016-02-24 23:30:49 +0000</bug_when>
    <thetext>(In reply to comment #9)
&gt; This issues is also reproducible on:
&gt; corei7-64 - Minnow max 32. Below you can find the AB link:
&gt; http://yocto-ab-master.jf.intel.com/pub/releases/yocto-2.1_M2.rc1/machines/
&gt; intel-corei7-64/core-image-sato-sdk-intel-corei7-64.hddimg

By mistake I added wrong information this is the related one:


This issue is also reproducible on core2-32 on Minnow max 32 bit, AB link:

http://yocto-ab-master.jf.intel.com/pub/releases/yocto-2.1_M2.rc1/machines/intel-core2-32/core-image-sato-sdk-intel-core2-32.hddimg.

meta-qt4 : 4058b0773381f894d915ea3dfac5fe052d82a9a7
meta-intel : aaab29ad036b13a0959925329b2b8e471869ca53
meta-qt3 : 7d958b928a4a38a186746fabbc0d8169dd8bb3a6
poky : 23056103c949b498c23b47579e8dd57ce78e6ed9</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>59588</commentid>
    <comment_count>11</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2016-03-01 15:19:14 +0000</bug_when>
    <thetext>I still can&apos;t make an image built locally fail but if I take an autobuilder image, install prelink into it and run prelink -ua (remove all prelinking) and reboot it, Sato works correctly.

So, I&apos;m blaming prelink somehow breaking the forking in glib&apos;s GSpawn API.

Mark, any thoughts?  The timing suggests that glibc 2.23 could be involved.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>59596</commentid>
    <comment_count>12</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2016-03-01 17:05:30 +0000</bug_when>
    <thetext>Richard can confirm that disabling image-prelink fixes the image.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>59606</commentid>
    <comment_count>13</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2016-03-01 20:00:03 +0000</bug_when>
    <thetext>Worked out why I can&apos;t replicate!

To replicate you need to have build without the security flags enabled, and with image-prelink enabled.  Having security flags enabled works, with or without prelink.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>59621</commentid>
    <comment_count>14</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2016-03-02 13:01:32 +0000</bug_when>
    <thetext>I&apos;ve been bisecting this.  To replicate the problem you need:
1) Don&apos;t enable security flags.  They are disabled by default
2) Enable prelink
3) Have a commit past 8bedf767aa8fa9629dd126bdc649912cfe074f7f (glib-2.0: use the system libpcre)

I&apos;ve no idea why glib-2.0 linking to the host libpcre instead of an internal fork would cause this problem, especially when that is the recommended linking method.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>59640</commentid>
    <comment_count>15</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2016-03-02 21:28:10 +0000</bug_when>
    <thetext>*Definitely* prelink.

Setting LD_USE_LOAD_BIAS=0 when starting matchbox-desktop fixes the problem, which basically disables prelink.

Mark, if you have any further ideas on how to chase this, I&apos;m all ears!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>59773</commentid>
    <comment_count>16</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2016-03-07 23:03:21 +0000</bug_when>
    <thetext>I confirmed that &quot;prelink -u /usr/bin/matchbox-desktop&quot; also &quot;fixes&quot; the problem in a previously broken image.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>60011</commentid>
    <comment_count>17</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2016-03-16 13:53:14 +0000</bug_when>
    <thetext>Retitling to reflect the state of debugging.  We&apos;ve disabled prelink in master for 2.1, rescheduling to 2.1M4 in case a simple fix is discovered, otherwise we can move this to 2.2.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>60014</commentid>
    <comment_count>18</comment_count>
    <who name="Mark Hatle">mark.hatle</who>
    <bug_when>2016-03-16 14:01:26 +0000</bug_when>
    <thetext>Where we are at in debugging.

The sample application we have is setup to link to:

glib-2.0 and libc.so


glib-2.0 further requires libpcre and libpthread.


The problem is that both libc.so and libpthread contain a &apos;fork&apos; function.  The former is a function, the later is an IFUNC.


When the prelinker parses the system, it parses the glib-2.0 library and internally defined the call to go to the IFUNC.  (Which is correct.)


When the prelinker parses the test application, it does NOT get a conflict warning from the libc.so (which binds symbols on a breadth-first basis.  This ends up binding the fork, called from glib to the libc.so version.  And then the application is now bound to the libc.so version.


When the program is executed, the dynamic loader runs and does some minimal relocation binding that is not possible in the prelinker -- it gets to the fork call and now the glib library binds to the IFUNC resolve function, but the application was told it&apos;s not an IFUNC -- so fork is never executed and a failure occurs.


This does NOT appear to be a bug in the prelinker or the glibc&apos;s ld.so.  As strange as it is, this type of dynamic linking can cause issues because the libraries are not fully qualified.  A failure should be able to happen without a prelinked library -- the prelinker just makes it significantly more likely to occur.


We believe that the problem is the application itself is not linked to both glib and libpthread (and libpcre) -- so no conflict is detected.  We&apos;re currently investigating updating the pkgconfig file for glib to include libpthread and libpcre, as they are both required.   (These are currently specified in the pkgconfig &apos;private&apos; section, but it appears they should be promoted to the more public linking methods.)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>60016</commentid>
    <comment_count>19</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2016-03-16 14:07:29 +0000</bug_when>
    <thetext>Drinks all round at Wind River, thanks Mark.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>60170</commentid>
    <comment_count>20</comment_count>
    <who name="Mark Hatle">mark.hatle</who>
    <bug_when>2016-03-19 01:05:30 +0000</bug_when>
    <thetext>Further information.  We believe we&apos;ve tracked down the problem to the prelink-rtld.

If the application had a full set of DT_NEEDED, the issue would not have been a problem -- however an application is not required to have that.

Inside the prelink-rtld the system was doing effectively doing a &quot;depth-first&quot; search defining the scope and binding the symbols for resolution.

The ld.so rules indicate a &quot;breadth-first&quot; search should be preformed instead.  We have a standalone test case and a fix for the issue in progress.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>60172</commentid>
    <comment_count>21</comment_count>
    <who name="Mark Hatle">mark.hatle</who>
    <bug_when>2016-03-19 01:44:34 +0000</bug_when>
    <thetext>Prelink commit: dc411f96f2e27bea69c1c1e5c1074451d796adfc appears to fix the issue.

Further testing in progress.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>60174</commentid>
    <comment_count>22</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2016-03-19 22:18:34 +0000</bug_when>
    <thetext>Excellent, thanks Mark and co!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>61513</commentid>
    <comment_count>23</comment_count>
    <who name="Mark Hatle">mark.hatle</who>
    <bug_when>2016-04-21 15:36:43 +0000</bug_when>
    <thetext>I just want to update status on this.

We have a fix for the specific fork issue (and have for a few weeks now).  However, with the glibc version in master we&apos;ve got other failures occurring in the test cases.

We&apos;re trying to identify and understand them before we go to reenable prelink.

Work is progressing, but this has stopped integration of this particular fix.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>62182</commentid>
    <comment_count>24</comment_count>
    <who name="Jose Perez C">jose.perez.carranza</who>
    <bug_when>2016-05-13 15:25:28 +0000</bug_when>
    <thetext>Cannot reproduce it, tested in below images 

intel-core2-32 - Minnow 32

http://yocto-ab-master.ostc.intel.com/pub/releases/yocto-meta-intel-5.0-krogoth-2.1.rc3/machines/intel-core2-32/core-image-sato-intel-core2-32.hddimg

intel-corei7-64 - NUC 

http://yocto-ab-master.ostc.intel.com/pub/releases/yocto-meta-intel-5.0-krogoth-2.1.rc3/machines/intel-corei7-64/core-image-sato-intel-corei7-64.hddimg


meta-qt4 : 4058b0773381f894d915ea3dfac5fe052d82a9a7
meta-intel : 91ffb8144c11c391ea3f62ce2a59a49e0f1cb01c
meta-qt3 : 7d958b928a4a38a186746fabbc0d8169dd8bb3a6
poky : 898a78357e72fb80f1f8e26ba90bad5b7b054a4f</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>62183</commentid>
    <comment_count>25</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2016-05-13 15:28:33 +0000</bug_when>
    <thetext>You can&apos;t reproduce because we&apos;ve disabled prelink until this is fixed.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>62185</commentid>
    <comment_count>26</comment_count>
    <who name="Mark Hatle">mark.hatle</who>
    <bug_when>2016-05-13 15:33:19 +0000</bug_when>
    <thetext>As mentioned before.. we&apos;re still working on this issue.  Prelink undo is broken.  We think it&apos;s related to something in binutils, but until we know for sure we&apos;re not comfortable calling everything resolved.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>62836</commentid>
    <comment_count>27</comment_count>
    <who name="Mark Hatle">mark.hatle</who>
    <bug_when>2016-06-09 15:41:30 +0000</bug_when>
    <thetext>A change in binutils 2.22 triggered a second fault in the prelinker.  Sections were not longer ordered by offset in some cases.  This caused a failure in the un-prelink validation stages.  We finally have figured out the cause and a possible solution to this issue.  It is in review.

There is one remaining test case failure that still needs to be looked at after this.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>65223</commentid>
    <comment_count>28</comment_count>
    <who name="Austin Phillips">austin.phillips</who>
    <bug_when>2016-08-16 12:06:33 +0000</bug_when>
    <thetext>This bug has also been observed with use of mount.exfat from the fuse-exfat recipe in the meta-filesystem bitbake layer, armel target, prelink enabled.

Use of LD_USE_LOAD_BIAS=0 fixes the issue.

eg.
LD_USE_LOAD_BIAS=0 mount.exfat &lt;my-device&gt; &lt;mount point&gt;

The following link gives another explanation of this behaviour and a suggested fix.

https://sourceware.org/ml/libc-alpha/2016-05/msg00034.html</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>65281</commentid>
    <comment_count>29</comment_count>
    <who name="Mark Hatle">mark.hatle</who>
    <bug_when>2016-08-17 19:06:29 +0000</bug_when>
    <thetext>Austin - thank you for the link.  This confirms that the problems we are seeing are not unique to our configuration.

I will finish up the work to resolve the YP specific issue, and then focus some time on working with the libc folks to resolve it there as well.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>65350</commentid>
    <comment_count>30</comment_count>
    <who name="Mark Hatle">mark.hatle</who>
    <bug_when>2016-08-19 12:58:40 +0000</bug_when>
    <thetext>Fixed in oe-core commits:


0b191e4bf0cba77669497d272dda46c536f7e527
9d2c82f7d3fc0fdafc5c4fdd1707324bc4cdbf22</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>69162</commentid>
    <comment_count>31</comment_count>
    <who name="Plauchu Edwin">edwin.plauchu.camacho</who>
    <bug_when>2016-12-15 16:25:26 +0000</bug_when>
    <thetext>*** Bug 8192 has been marked as a duplicate of this bug. ***</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>