<?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>543</bug_id>
          
          <creation_ts>2010-11-19 14:33:14 +0000</creation_ts>
          <short_desc>Bitbake complains about mmap_min_addr for an unknown reason</short_desc>
          <delta_ts>2011-03-06 17:18:41 +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>core</component>
          <version>0.9</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>normal</bug_severity>
          <target_milestone>1.0 M4</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Darren Hart">dvhart</reporter>
          <assigned_to name="Edwin Zhai">edwin.zhai</assigned_to>
          <cc>dexuan.cui</cc>
    
    <cc>ke.yu</cc>
    
    <cc>kevin.tian</cc>
    
    <cc>Martin.Jansa</cc>
    
    <cc>meta.mr.watcher</cc>
    
    <cc>meta.watcher</cc>
    
    <cc>richard.purdie</cc>
    
    <cc>sgw</cc>
    
    <cc>tom.rini</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>10928</commentid>
    <comment_count>0</comment_count>
    <who name="Darren Hart">dvhart</who>
    <bug_when>2010-11-19 14:33:14 +0000</bug_when>
    <thetext>When changing my MACHINE from atom-pc to beagleboard, trying to build a recipe results in the following. It isn&apos;t clear to me from this why it&apos;s doing any kind of a qemu check as the machine isn&apos;t a qemu machine. It also isn&apos;t clear why this change should be necessary in the first place as qemu works on my system without that change.

Similar thoughts on the OE wiki: http://wiki.openembedded.net/index.php/Category_talk:FAQ#9._sanity_checker_complains_.22.2Fproc.2Fsys.2Fvm.2Fmmap_min_addr_is_not_0.22_on_Ubuntu

$ bitbake perl
FATAL:  Poky&apos;s config sanity checker detected a potential misconfiguration.
	Either fix the cause of this error or at your own risk disable the checker (see sanity.conf).
	Following is the list of potential problems / advisories:

	/proc/sys/vm/mmap_min_addr is not 0. This will cause problems with qemu so please fix the value (as root).

To fix this in later reboots, set vm.mmap_min_addr = 0 in /etc/sysctl.conf.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>11945</commentid>
    <comment_count>1</comment_count>
    <who name="Saul Wold">sgw</who>
    <bug_when>2011-02-22 10:02:22 +0000</bug_when>
    <thetext>*** Bug 662 has been marked as a duplicate of this bug. ***</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>11946</commentid>
    <comment_count>2</comment_count>
    <who name="Saul Wold">sgw</who>
    <bug_when>2011-02-22 10:03:44 +0000</bug_when>
    <thetext>Edwin, Please confirm that the mmap_min_addr patch is no longer needed with the latest qemu and if so, then remove this sanity check.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>11964</commentid>
    <comment_count>3</comment_count>
    <who name="Edwin Zhai">edwin.zhai</who>
    <bug_when>2011-02-22 17:06:40 +0000</bug_when>
    <thetext>(In reply to comment #2)
&gt; Edwin, Please confirm that the mmap_min_addr patch is no longer needed with the
&gt; latest qemu and if so, then remove this sanity check.

Saul,
I&apos;m not in the mmap_min_addr context, but I assume if I can build qemuarm minimal image, and run without these checks, then it&apos;s okay.

Right?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>11965</commentid>
    <comment_count>4</comment_count>
    <who name="Tom Rini">tom.rini</who>
    <bug_when>2011-02-22 17:11:58 +0000</bug_when>
    <thetext>So, when I brought this up to Richard before, his answer was (to paraphrase) that he had a recollection of someone saying there were still corner cases and that it wasn&apos;t 100% fixed upstream (despite upstream saying it was fixed).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>12120</commentid>
    <comment_count>5</comment_count>
    <who name="Martin Jansa">Martin.Jansa</who>
    <bug_when>2011-02-25 07:38:25 +0000</bug_when>
    <thetext>(In reply to comment #4)
&gt; So, when I brought this up to Richard before, his answer was (to paraphrase)
&gt; that he had a recollection of someone saying there were still corner cases and
&gt; that it wasn&apos;t 100% fixed upstream (despite upstream saying it was fixed).

The corner cases are when user account running bitbake (and then qemu) is not allowed to read /proc/sys/vm/mmap_min_addr and adjust mmap_min_addr in qemu accordingly.

That&apos;s why OE still has
http://git.openembedded.org/cgit.cgi/openembedded/commit/?id=93a439a42b538be1f96c9250122504bfbdbd8d7b

And that&apos;s why this check will fail to read /proc/sys/vm/mmap_min_addr on some kernels and report &quot;maybe false positive&quot;, see:
http://www.mail-archive.com/openembedded-devel@lists.openembedded.org/msg02340.html

And here is response on qemu-devel:
http://www.mail-archive.com/qemu-devel@nongnu.org/msg31804.html
but c581deda322080e8beb88b2e468d4af54454e4b3 afaik didn&apos;t solve it completely</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>12155</commentid>
    <comment_count>6</comment_count>
    <who name="Edwin Zhai">edwin.zhai</who>
    <bug_when>2011-02-27 23:56:52 +0000</bug_when>
    <thetext>(In reply to comment #5)
&gt; (In reply to comment #4)
&gt; &gt; So, when I brought this up to Richard before, his answer was (to paraphrase)
&gt; &gt; that he had a recollection of someone saying there were still corner cases and
&gt; &gt; that it wasn&apos;t 100% fixed upstream (despite upstream saying it was fixed).
&gt; 
&gt; The corner cases are when user account running bitbake (and then qemu) is not
&gt; allowed to read /proc/sys/vm/mmap_min_addr and adjust mmap_min_addr in qemu
&gt; accordingly.
&gt; 
&gt; That&apos;s why OE still has
&gt; http://git.openembedded.org/cgit.cgi/openembedded/commit/?id=93a439a42b538be1f96c9250122504bfbdbd8d7b
&gt; 
&gt; And that&apos;s why this check will fail to read /proc/sys/vm/mmap_min_addr on some
&gt; kernels and report &quot;maybe false positive&quot;, see:
&gt; http://www.mail-archive.com/openembedded-devel@lists.openembedded.org/msg02340.html
&gt; 
&gt; And here is response on qemu-devel:
&gt; http://www.mail-archive.com/qemu-devel@nongnu.org/msg31804.html
&gt; but c581deda322080e8beb88b2e468d4af54454e4b3 afaik didn&apos;t solve it completely

Martin,
Thanks for your reply. It&apos;s more clear now. There is in fact 2 issues:
1. qemu linux-user doesn&apos;t reload it well, so we need set the mmap_min_addr to 0.  And qemu c581deda322080e8beb88b2e468d4af54454e4b3 fix it (already in 0.13.0).

2. Another issue is user on some distribution can&apos;t access the mmap_min_addr, so your patch assume 65536(from most of popular distribution) in such case.

Is it right?
I think issue 1 depends on 2, but not sure if these 2 fixes conflict?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>12156</commentid>
    <comment_count>7</comment_count>
    <who name="Edwin Zhai">edwin.zhai</who>
    <bug_when>2011-02-28 00:14:56 +0000</bug_when>
    <thetext>So proper solution is adding Martin&apos;s patch in case that end user has no access of the /proc/..../mmap_min_addr and removed our checks. 

If so I&apos;ll have a test to see if qemuarm can be built and run well with this solution.

Another question is: does our check in sanity.bbclass have such access issue?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>12286</commentid>
    <comment_count>8</comment_count>
    <who name="Dexuan Cui">dexuan.cui</who>
    <bug_when>2011-03-04 00:20:01 +0000</bug_when>
    <thetext>(In reply to comment #6)
&gt; (In reply to comment #5)
&gt; &gt; (In reply to comment #4)
&gt; &gt; &gt; So, when I brought this up to Richard before, his answer was (to paraphrase)
&gt; &gt; &gt; that he had a recollection of someone saying there were still corner cases and
&gt; &gt; &gt; that it wasn&apos;t 100% fixed upstream (despite upstream saying it was fixed).
&gt; &gt; 
&gt; &gt; The corner cases are when user account running bitbake (and then qemu) is not
&gt; &gt; allowed to read /proc/sys/vm/mmap_min_addr and adjust mmap_min_addr in qemu
&gt; &gt; accordingly.
&gt; &gt; 
&gt; &gt; That&apos;s why OE still has
&gt; &gt; http://git.openembedded.org/cgit.cgi/openembedded/commit/?id=93a439a42b538be1f96c9250122504bfbdbd8d7b
&gt; &gt; 
&gt; &gt; And that&apos;s why this check will fail to read /proc/sys/vm/mmap_min_addr on some
&gt; &gt; kernels and report &quot;maybe false positive&quot;, see:
&gt; &gt; http://www.mail-archive.com/openembedded-devel@lists.openembedded.org/msg02340.html
&gt; &gt; 
&gt; &gt; And here is response on qemu-devel:
&gt; &gt; http://www.mail-archive.com/qemu-devel@nongnu.org/msg31804.html
&gt; &gt; but c581deda322080e8beb88b2e468d4af54454e4b3 afaik didn&apos;t solve it completely
&gt; Martin,
&gt; Thanks for your reply. It&apos;s more clear now. There is in fact 2 issues:
&gt; 1. qemu linux-user doesn&apos;t reload it well, so we need set the mmap_min_addr to
&gt; 0.  And qemu c581deda322080e8beb88b2e468d4af54454e4b3 fix it (already in
&gt; 0.13.0).
&gt; 2. Another issue is user on some distribution can&apos;t access the mmap_min_addr,
&gt; so your patch assume 65536(from most of popular distribution) in such case.
&gt; Is it right?
&gt; I think issue 1 depends on 2, but not sure if these 2 fixes conflict?

Now in poky we have qemu 0.13.0, and we also have the patch:
http://git.pokylinux.org/cgit/cgit.cgi/poky/commit/?id=ea63409781dc9a5de2d852ec044e55dc82e31a96
&quot;qemu-0.13.0: Add patch to avoid mmap_min_addr
* This patch is taken from OE commit 40e293342ca76921904a43b03b635d9219432edf

(From OE-Core rev: 11d76595e036f46906859b59dc06094b2e979771)

Signed-off-by: Khem Raj &lt;raj.khem@gmail.com&gt;
Signed-off-by: Richard Purdie &lt;richard.purdie@linuxfoundation.org&gt;&quot;

So I think the bug was actually fixed? (In reply to comment #7)

&gt; So proper solution is adding Martin&apos;s patch in case that end user has no access
&gt; of the /proc/..../mmap_min_addr and removed our checks. 
&gt; If so I&apos;ll have a test to see if qemuarm can be built and run well with this
&gt; solution.
&gt; Another question is: does our check in sanity.bbclass have such access issue?
The code in sanity.bbclass is:
 if data.getVar(&apos;TARGET_ARCH&apos;, e.data, True) == &quot;arm&quot;:
        # This path is no longer user-readable in modern (very recent) Linux
        try:
            if os.path.exists(&quot;/proc/sys/vm/mmap_min_addr&quot;):
                f = file(&quot;/proc/sys/vm/mmap_min_addr&quot;, &quot;r&quot;)
                if (f.read().strip() != &quot;0&quot;):
                        messages = messages + &quot;/proc/sys/vm/mmap_min_addr is not 0. This will cause problems with qemu so please fix the value (as root).\n\nTo fix this in later reboots, set vm.mmap_min_addr = 0 in /etc/sysctl.conf.\n&quot;
                f.close()
        except:
            pass
So I think bitbake can ignore the exception safely.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>12287</commentid>
    <comment_count>9</comment_count>
    <who name="Edwin Zhai">edwin.zhai</who>
    <bug_when>2011-03-04 00:31:57 +0000</bug_when>
    <thetext>I have tested arm build without Raj&apos;s patch, and everything works well.
In theory, Raj&apos;s patch should not cause any regression.

I&apos;ll make a new test with Raj&apos;s patch, then send pull request if no regression.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>12311</commentid>
    <comment_count>10</comment_count>
    <who name="Edwin Zhai">edwin.zhai</who>
    <bug_when>2011-03-06 17:18:41 +0000</bug_when>
    <thetext>Fixed in poky master @ 0bc244181fce67725ddd0981481e5611b700cf51</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>