<?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>1462</bug_id>
          
          <creation_ts>2011-09-07 16:38:37 +0000</creation_ts>
          <short_desc>Running postinstalls under qemu user mode emulation (such as pango)</short_desc>
          <delta_ts>2013-03-07 16:26:20 +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>Meta-yocto</product>
          <component>meta-yocto</component>
          <version>1.0</version>
          <rep_platform>x86</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>Medium</priority>
          <bug_severity>enhancement</bug_severity>
          <target_milestone>Future</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Saul Wold">sgw</reporter>
          <assigned_to name="Mark Hatle">mark.hatle</assigned_to>
          <cc>poky.bs.watcher</cc>
    
    <cc>poky.watcher</cc>
    
    <cc>richard.purdie</cc>
    
    <cc>sgw</cc>
    
    <cc>song.liu</cc>
          
          
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>---</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>16081</commentid>
    <comment_count>0</comment_count>
    <who name="Saul Wold">sgw</who>
    <bug_when>2011-09-07 16:38:37 +0000</bug_when>
    <thetext>This occurs on x86-64 build, related to the recent change

http://git.yoctoproject.org/cgit/cgit.cgi/poky-contrib/commit/?h=stage/master_under_test&amp;id=78728229311f9ef1746b2cc048a0b86a234b4be7

ERROR: ioctl(SNDCTL_DSP_MAPINBUF): target=0x80085013 host=0x80105013
| ERROR: ioctl(SNDCTL_DSP_MAPOUTBUF): target=0x80085014 host=0x80105014
| qemu: Unsupported syscall: 202
| qemu: uncaught target signal 11 (Segmentation fault) - core dumped
| /srv/home/pokybuild/yocto-autobuilder/yocto-slave/nightly-x86-64/build/build/tmp/work/qemux86_64-poky-linux/core-image-sato-dev-1.0-r0/rootfs/etc/rpm-postinsts/pango-module-basic-fc.sh: line 8: 15371 Segmentation fault      PSEUDO_RELOADED=YES qemu-x86_64 -L $D $D/usr/bin/pango-querymodules &gt; &quot;$D/etc/pango/pango.modules&quot;
|</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>16123</commentid>
    <comment_count>1</comment_count>
    <who name="Mark Hatle">mark.hatle</who>
    <bug_when>2011-09-09 10:02:05 +0000</bug_when>
    <thetext>I was unable to reproduce the segfault on my machine.  However, I have the SDL and GL patches disabled on my build as they cause general segfaults in QEMU on my machine.

I did however track down the source of the messages.  It appears that syscall 202 is a futex call, and futex emulation is only enabled if you qemu is configured in user-mode only.  (As far as I can tell it&apos;s not.... thus the unimplemented syscall.)

However, the actual error appears to be the ioctl message:

ERROR: ioctl(SNDCTL_DSP_MAPOUTBUF): target=0x80085014 host=0x80105014

This points to a bug within QEMU itself.  See the code in question:

linux-user/syscall.c:


        /* automatic consistency check if same arch */
#if (defined(__i386__) &amp;&amp; defined(TARGET_I386) &amp;&amp; defined(TARGET_ABI32)) || \
    (defined(__x86_64__) &amp;&amp; defined(TARGET_X86_64))
        if (unlikely(ie-&gt;target_cmd != ie-&gt;host_cmd)) {
            fprintf(stderr, &quot;ERROR: ioctl(%s): target=0x%x host=0x%x\n&quot;,
                    ie-&gt;name, ie-&gt;target_cmd, ie-&gt;host_cmd);
        }
#endif

My understanding is that its verifying that after loading/processing the command for emulation it is NOT the same, and should be.. thus causing the failure condition.  Someone more familiar with QEMU and the internals likely needs to investigate this and determine what the cause of this failure is and how to correct it.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>16144</commentid>
    <comment_count>2</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2011-09-13 10:20:38 +0000</bug_when>
    <thetext>Just to try and clarify the situation, I think the recent bitbake environment fixes have &quot;solved&quot; the segfault issues. The segfault occurs when qemu thinks its root and makes root only operations.

x86 doesn&apos;t seem to have multiuser support in qemu which is why the futex isses occurs. Whether these are related to the ioctl message or not, I don&apos;t know. For now we&apos;re reverted the pango change though as there are too many issues appearing due to it.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>16145</commentid>
    <comment_count>3</comment_count>
    <who name="Mark Hatle">mark.hatle</who>
    <bug_when>2011-09-13 10:30:55 +0000</bug_when>
    <thetext>There are three different issues presented here.

The first is the Unsupported syscall: 202 -- this is the futex issue.

The second is the segfault, likely fixed or addressed as RP mentioned.

The third is the ioctl... target=... host=... message.  This indicates a bug in the processor emulation within QEMU.  The program was trying to do something and since the target and host are the same it can check that the emulated instruction is the same as the actual instruction, which it isn&apos;t in this case.

Someone with QEMU knowledge needs to investigate the ioctl issue and determine the cause and potential fix.  I did some basic investigation on this (via google/mailing lists) and it could be related to vsyscalls, or similar specialized &quot;fast-path&quot; calling.  However, I could not find any remedy for the issue within the latest QEMU release or git changelogs.  (I did not try running the software with the newer version, this likely should be tried.)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>17707</commentid>
    <comment_count>4</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2011-12-16 09:41:56 +0000</bug_when>
    <thetext>Redefine this as normal, not major since we&apos;re not currently hitting this any any builds since we disabled running this until we&apos;re on the target device.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>17931</commentid>
    <comment_count>5</comment_count>
    <who name="Mark Hatle">mark.hatle</who>
    <bug_when>2012-01-03 10:33:08 +0000</bug_when>
    <thetext>We should attempt to retest this as QEMU has been updated.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>18909</commentid>
    <comment_count>6</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2012-03-08 17:52:13 +0000</bug_when>
    <thetext>Remarking this as a feature enhancement. 

It would be nice to run some of the postinstalls under qemu user mode emulation but it looks like we need much more detailed investigation and planning to make this work reliably on all supported architectures. It may be there is missing functionality in qemu that needs investigation too.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>21185</commentid>
    <comment_count>7</comment_count>
    <who name="Mark Hatle">mark.hatle</who>
    <bug_when>2012-05-08 15:33:54 +0000</bug_when>
    <thetext>I expect QEMU will work for the core BSPs, but when we start to deviate to the unusual ones, i.e. very new cores or cores with specialty instructions, it is likely to not be able to run post install scripts.

One possibility is, if BSPs are tagged if they can run qemu or not, we can add the ability to use QEMU to the install scriptlet intercept code in RPM, as well as potentially the other packaging systems.

Estimate assumes:
* QEMU is functional, and can run what we need with minimal additional work

Estimate includes:
* the time to create (or verify) a flag to indicate if a machine can use qemu for the scripts

* modification of the scriptlet processing code in RPM

* modification of the scriptlet processing code in IPK

* modification of the scriptlet processing code in DEB

* Preserve existing functionality for the non-QEMU case</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>24932</commentid>
    <comment_count>8</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2012-09-07 13:57:00 +0000</bug_when>
    <thetext>I don&apos;t know why this became a 1.3 Medium+. This should really be a future enhancement of medium priority and I&apos;m rescehduling as such.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>30520</commentid>
    <comment_count>9</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2013-03-07 16:26:20 +0000</bug_when>
    <thetext>We now have postinstalls running under qemu emulation for 1.4 so closing this as resolved.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>