<?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>3143</bug_id>
          
          <creation_ts>2012-09-20 10:24:09 +0000</creation_ts>
          <short_desc>qemu-mips segfault on mips x86_64 gmae-toolchain</short_desc>
          <delta_ts>2012-10-08 03:43:21 +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>unspecified</version>
          <rep_platform>x86</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>VERIFIED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard>(merged)</status_whiteboard>
          <keywords></keywords>
          <priority>Medium+</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>1.3 M5</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="liang li">liang.li2</reporter>
          <assigned_to name="Laurentiu Palcu">laurentiu.palcu</assigned_to>
          <cc>jessica.zhang</cc>
    
    <cc>laurentiu.serban</cc>
    
    <cc>meta.mr.watcher</cc>
    
    <cc>meta.watcher</cc>
    
    <cc>poky.adt.watcher</cc>
    
    <cc>poky.watcher</cc>
    
    <cc>yi.zhao</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>25448</commentid>
    <comment_count>0</comment_count>
    <who name="liang li">liang.li2</who>
    <bug_when>2012-09-20 10:24:09 +0000</bug_when>
    <thetext>toolchain from below:
http://autobuilder.yoctoproject.org/pub/nightly/20120919-2/toolchain/x86_64/poky-eglibc-x86_64-mips-toolchain-gmae-1.2+snapshot-20120919.sh

steps below:
1.install toolchain to &quot;/opt/poky/1.2+snapshot&quot;.
2.run &quot;source /opt/poky/1.2+snapshot/environment-setup-mips32-poky-linux&quot;.
3.run &quot;${CC} -o test test.c -lm&quot;
4.run &quot;qemu-mips /opt/poky/1.2+snapshot/sysroots/mips32-poky-linux/lib/ld.so.1 --library-path /opt/poky/1.2+snapshot/sysroots/mips32-poky-linux/lib:/opt/poky/1.2+snapshot/sysroots/mips32-poky-linux/usr/lib ./test&quot;

errors below:
qemu: uncaught target signal 11 (Segmentation fault) - core dumped
Segmentation fault (core dumped)

run &quot;file ./test&quot;,output below:
./test: ELF 32-bit MSB executable, MIPS, MIPS32 version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.16, with unknown capability 0x41000000 = 0xf676e75, with unknown capability 0x10000 = 0x70401, not stripped

test.c below:
#include &lt;stdio.h&gt;
#include &lt;math.h&gt;
double convert(long long l)
{
return (double)l;// or double(l)
}

int main(int argc, char * argv[])
{
long long l = 10;
double f;
f = convert(l);
printf(&quot;convert: %lld =&gt; %f\n&quot;, l, f);
f = 1234.67;
printf(&quot;floorf(%f) = %f\n&quot;, f, floorf(f));
return 0;
}


test env :
host :ubuntu 12.04 x86_64

git info:52850f0fc6f801298413ee779834b346ef7f48d6
git branch: poky/1.3_M5</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>25601</commentid>
    <comment_count>1</comment_count>
    <who name="Laurentiu Palcu">laurentiu.palcu</who>
    <bug_when>2012-09-24 13:08:26 +0000</bug_when>
    <thetext>Do you happen to know if this is a regression? Did it work previously?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>25602</commentid>
    <comment_count>2</comment_count>
    <who name="Laurentiu Palcu">laurentiu.palcu</who>
    <bug_when>2012-09-24 13:10:38 +0000</bug_when>
    <thetext>It looks like it&apos;s enough for the test.c file to contain an empty main() function and it still segfaults...</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>25632</commentid>
    <comment_count>3</comment_count>
    <who name="liang li">liang.li2</who>
    <bug_when>2012-09-25 02:18:25 +0000</bug_when>
    <thetext>(In reply to comment #1)
&gt; Do you happen to know if this is a regression? Did it work previously?

not regression,such error not met before.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>25743</commentid>
    <comment_count>4</comment_count>
    <who name="liang li">liang.li2</who>
    <bug_when>2012-09-26 07:32:08 +0000</bug_when>
    <thetext>error still exists in 1.3 M5 RC2 from:
http://autobuilder.pokylinux.org/nightly/20120926-1/toolchain/x86_64/poky-eglibc-x86_64-mips-toolchain-gmae-1.2+snapshot-20120926.sh
git info: 718eb85806e080d0b165344b272e531ef19421eb
git branch:  poky/1.3_M5</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>25793</commentid>
    <comment_count>5</comment_count>
    <who name="Laurentiu Palcu">laurentiu.palcu</who>
    <bug_when>2012-09-26 15:51:09 +0000</bug_when>
    <thetext>I isolated the issue doing a bisect on qemu repository and found that this issue was introduced by this commit: &quot;linux-user: reserve 4GB of vmem for 32-on-64&quot;. Reverting it will make qemu-mips work again.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>25935</commentid>
    <comment_count>6</comment_count>
    <who name="Laurentiu Palcu">laurentiu.palcu</who>
    <bug_when>2012-09-28 15:03:28 +0000</bug_when>
    <thetext>After some investigations, it looks like the problem is in the translated code and a MMU fault is generated in the virtual CPU. Somehow, a kernel address is accessed from user/supervisor mode or supervisor address from user mode and a MMU fault is triggered. Everything works fine however if the guest virtual address space is limited to 2GB...</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>26107</commentid>
    <comment_count>7</comment_count>
    <who name="Laurentiu Palcu">laurentiu.palcu</who>
    <bug_when>2012-10-03 10:59:18 +0000</bug_when>
    <thetext>Patch on the mailing list.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>26191</commentid>
    <comment_count>8</comment_count>
    <who name="Laurentiu Palcu">laurentiu.palcu</who>
    <bug_when>2012-10-04 06:51:58 +0000</bug_when>
    <thetext>Patch merged:

http://git.yoctoproject.org/cgit.cgi/poky/commit/?id=0d43dc75e4ddf9b8966429f41355cb2e8895d0e2</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>26312</commentid>
    <comment_count>9</comment_count>
    <who name="liang li">liang.li2</who>
    <bug_when>2012-10-08 03:43:21 +0000</bug_when>
    <thetext>no such error to nightly build 20121003-4:
http://autobuilder.yoctoproject.org/pub/nightly/20121003-4/toolchain/x86_64/poky-eglibc-x86_64-mips-toolchain-gmae-1.3.sh
git info:86c9aa8081f107420cd3763d0566d779daddc2b1
git branch:poky/danny</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>