<?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>224</bug_id>
          
          <creation_ts>2010-08-23 23:22:45 +0000</creation_ts>
          <short_desc>[Netbook/emenlow] matchbox-panel segfault after X startup</short_desc>
          <delta_ts>2010-12-21 06:07:22 +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>0.9</version>
          <rep_platform>Netbook</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>VERIFIED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>Medium</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>0.9 M3</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Jiajun Xu">jiajun.xu</reporter>
          <assigned_to name="Edwin Zhai">edwin.zhai</assigned_to>
          <cc>dongxiao.xu</cc>
    
    <cc>jessica.zhang</cc>
    
    <cc>josh</cc>
    
    <cc>kevin.tian</cc>
    
    <cc>poky.bs.watcher</cc>
    
    <cc>poky.watcher</cc>
    
    <cc>richard.purdie</cc>
    
    <cc>sgw</cc>
          
          
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          <cf_verified>Program Management</cf_verified>
          <cf_docchange>---</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>9354</commentid>
    <comment_count>0</comment_count>
    <who name="Jiajun Xu">jiajun.xu</who>
    <bug_when>2010-08-23 23:22:45 +0000</bug_when>
    <thetext>Testing Env:    
Hardware: netbook/emenlow
Images from weekly build (20100818) on autobuilder,
http://autobuilder.pokylinux.org/nightly/20100818-1.
poky tree commit: efadb43d671666d70a2a374e33fe9deca44f3e84

With the netbook/emenlow images from autobuilder, matchbox-panel meets segfault after Xserver start up.

#######
[    6.520630] [drm] Big FIFO is enabled
[    9.894403] matchbox-panel[556]: segfault at 137 ip 4f08fd6d sp bfb3fb20 error 4 in libgdk-x11-2.0.so.0.2000.1[4f02a000+90000]
[   10.056766] nm-applet[495]: segfault at 0 ip 4e8d75cd sp bfee3400 error 4 in libglib-2.0.so.0.2400.1[4e8b1000+c7000]
[ 1228.723953] [drm] Big FIFO is enabled
[ 2009.032007] [drm] Big FIFO is enabled
#######</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>9374</commentid>
    <comment_count>1</comment_count>
    <who name="Joshua Lock - Disabled">josh</who>
    <bug_when>2010-08-25 07:07:37 +0000</bug_when>
    <thetext>I can&apos;t reproduce this with a build from recent master. Saul, can we close this bug?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>9375</commentid>
    <comment_count>2</comment_count>
    <who name="Joshua Lock - Disabled">josh</who>
    <bug_when>2010-08-25 07:09:50 +0000</bug_when>
    <thetext>Sorry, that should have been addressed at Jiajun ... I&apos;m going to close this unless someone can tell me how to repro?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>9376</commentid>
    <comment_count>3</comment_count>
    <who name="Jiajun Xu">jiajun.xu</who>
    <bug_when>2010-08-25 08:31:48 +0000</bug_when>
    <thetext>(In reply to comment #2)
&gt; Sorry, that should have been addressed at Jiajun ... I&apos;m going to close this
&gt; unless someone can tell me how to repro?

OK. I will check the issue with next weekly build.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>9437</commentid>
    <comment_count>4</comment_count>
    <who name="Dongxiao Xu">dongxiao.xu</who>
    <bug_when>2010-08-26 18:29:46 +0000</bug_when>
    <thetext>I can reproduce this bug on netbook against the latest poky master commit e10703aa5b008e5bd4ba00606e633281759496fe.
So reopen it.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>9523</commentid>
    <comment_count>5</comment_count>
    <who name="Jiajun Xu">jiajun.xu</who>
    <bug_when>2010-09-01 20:22:32 +0000</bug_when>
    <thetext>The bug still exists with 20100831 image built from autobuilder.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>9642</commentid>
    <comment_count>6</comment_count>
    <who name="Edwin Zhai">edwin.zhai</who>
    <bug_when>2010-09-07 23:07:55 +0000</bug_when>
    <thetext>This bug is root caused as a bug of gcc 4.5.0, whose optimization make some code missing. 
seg fault happened @ tmp_reset_bg (gtk+-2.20.1/gdk/x11/gdkwindow-x11.c), which is inline function extended inside _gdk_x11_window_tmp_unset_bg.

This macro is the culprit:
xpixmap = GDK_DRAWABLE_XID (bg_pixmap)

and can be extended as following:

if ( GDK_IS_WINDOW (obj-&gt;bg_pixmap) )
    xpixmap =  GDK_WINDOW_XID (obj-&gt;bg_pixmap);
else 
{
    GdkDrawable *drawimpl;
    GdkDrawableImplX11 *implx11;
    Window xid;

+    __asm__ __volatile__ (&quot;nop&quot;);

    drawimpl = ((GdkPixmapObject *)(obj-&gt;bg_pixmap))-&gt;impl;
    implx11 = GDK_DRAWABLE_IMPL_X11(drawimpl);
    xid = implx11-&gt;xid;

    xpixmap = xid;
}


We can avoid this by any of following: 1. change the &quot;march=core2&quot; to &quot;march=i586&quot; in the netbook config. 2. change tmp_reset_bg as normal function instead of static. 3. add a simple &quot;nop&quot; like above

The root cause is: the function call of GDK_IS_WINDOW, and some stack handling is missing after gcc&apos;s optimization. Pls. see the difference after adding a simple &quot;nop&quot;

   669a1:       74 2e                   je     669d1 &lt;_gdk_x11_window_tmp_reset_bg+0x131&gt;
   669a3:       85 d2                   test   %edx,%edx
   669a5:       74 23                   je     669ca &lt;_gdk_x11_window_tmp_reset_bg+0x12a&gt;
   669a7:       8b 02                   mov    (%edx),%eax
   669a9:       85 c0                   test   %eax,%eax
   669ab:       74 05                   je     669b2 &lt;_gdk_x11_window_tmp_reset_bg+0x112&gt;
   669ad:       3b 38                   cmp    (%eax),%edi
+  669af:       90                      nop
   669b0:       74 19                   je     669cb &lt;_gdk_x11_window_tmp_reset_bg+0x12b&gt;
+  669b2:       89 14 24                mov    %edx,(%esp)
+  669b5:       89 54 24 18             mov    %edx,0x18(%esp)
+  669b9:       89 7c 24 04             mov    %edi,0x4(%esp)
+  669bd:       e8 76 ce fa ff          call   13838 &lt;g_type_check_instance_is_a@plt&gt;
   669c2:       8b 54 24 18             mov    0x18(%esp),%edx
+  669c6:       85 c0                   test   %eax,%eax
+  669c8:       75 01                   jne    669cb &lt;_gdk_x11_window_tmp_reset_bg+0x12b&gt;
+  669ca:       90                      nop
   669cb:       8b 42 0c                mov    0xc(%edx),%eax
!=&gt;669ce:       8b 68 14                mov    0x14(%eax),%ebp
   669d1:       8b 16                   mov    (%esi),%edx

&quot;+&quot; stands for new added instruction after &quot;nop&quot;, and &quot;!=&gt;&quot; is the instruction introduce seg fault.

We can see with &quot;nop&quot;, $edx is saved to stack, call GDK_IS_WINDOW (&lt;g_type_check_instance_is_a@plt&gt;), restore $edx from stack. Then deduced $edx=&gt;$eax=&gt;$ebp to get the right reference.

Without &quot;nop&quot;, the $edx is not saved to stack, but still restore it from stack with wrong value. Then $eax get the wrong value, thus seg fault...</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>9643</commentid>
    <comment_count>7</comment_count>
    <who name="Edwin Zhai">edwin.zhai</who>
    <bug_when>2010-09-07 23:12:12 +0000</bug_when>
    <thetext>Regarding the solution, fixing on gcc side is hard. For the following workaround:
1. change the &quot;march=core2&quot; to &quot;march=i586&quot; in the netbook config.
2. change tmp_reset_bg as normal function instead of static.
3. add a simple &quot;nop&quot; like above

1 is not feasible as we need core2 to support some C++ package compilation.
Both 2 &amp; 3 seems to be ugly, but we can still use it as tmp solution for M3.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>9737</commentid>
    <comment_count>8</comment_count>
    <who name="Saul Wold">sgw</who>
    <bug_when>2010-09-10 16:22:33 +0000</bug_when>
    <thetext>Fixed in Master and M3 dc29f661c3c7b95fdb875532a803a1612f46a1a1</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>9935</commentid>
    <comment_count>9</comment_count>
    <who name="Jiajun Xu">jiajun.xu</who>
    <bug_when>2010-09-21 09:53:25 +0000</bug_when>
    <thetext>The bug is verified as fixed in M3 testing.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>