Patchwork [PATCHv3,4/6] sanity.bbclass: Check for /proc/sys/vm/mmap_min_addr to be >= 65536

login
register
mail settings
Submitter Khem Raj
Date March 3, 2011, 6:52 a.m.
Message ID <1299135167-18330-5-git-send-email-raj.khem@gmail.com>
Download mbox | patch
Permalink /patch/1051/
State New, archived
Headers show

Comments

Khem Raj - March 3, 2011, 6:52 a.m.
* Now qemu can handle lower values we can chnage this sanity test
  to check of values if less than 65536

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 meta/classes/sanity.bbclass |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)
Martin Jansa - March 3, 2011, 7:15 a.m.
On Wed, Mar 02, 2011 at 10:52:45PM -0800, Khem Raj wrote:
> * Now qemu can handle lower values we can chnage this sanity test
>   to check of values if less than 65536
> 
> Signed-off-by: Khem Raj <raj.khem@gmail.com>
> ---
>  meta/classes/sanity.bbclass |   10 ++++++----
>  1 files changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/meta/classes/sanity.bbclass b/meta/classes/sanity.bbclass
> index 13940f8..aae5028 100644
> --- a/meta/classes/sanity.bbclass
> +++ b/meta/classes/sanity.bbclass
> @@ -170,10 +170,12 @@ def check_sanity(e):
>          # This path is no longer user-readable in modern (very recent) Linux
>          try:
>              if os.path.exists("/proc/sys/vm/mmap_min_addr"):
> -                f = file("/proc/sys/vm/mmap_min_addr", "r")
> -                if (f.read().strip() != "0"):
> -                        messages = messages + "/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"
> -                f.close()
> +                f = open("/proc/sys/vm/mmap_min_addr", "r")
> +                try:
> +                    if (int(f.read().strip()) < 65536):
> +                        messages = messages + "/proc/sys/vm/mmap_min_addr is not >= 65536. 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 = 65536 in /etc/sysctl.conf.\n"
> +                finally:
> +                    f.close()
>          except:
>              pass
>  

corner cases when it cannot be read are with kernel between

http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=0e1a6ef2dea88101b056b6d9984f3325c5efced3
2.6.33-rc2-0e1a6ef2dea88101b056b6d9984f3325c5efced3

and

http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=822cceec7248013821d655545ea45d1c6a9d15b3
2.6.34-rc3-822cceec7248013821d655545ea45d1c6a9d15b3

see:
http://www.mail-archive.com/openembedded-devel@lists.openembedded.org/msg02340.html

Don't know if any large distribution is using 2.6.34 without that 2nd
patch backported.

Regards,
Richard Purdie - March 3, 2011, 12:13 p.m.
On Thu, 2011-03-03 at 08:15 +0100, Martin Jansa wrote:
> On Wed, Mar 02, 2011 at 10:52:45PM -0800, Khem Raj wrote:
> > * Now qemu can handle lower values we can chnage this sanity test
> >   to check of values if less than 65536
> > 
> > Signed-off-by: Khem Raj <raj.khem@gmail.com>
> > ---
> >  meta/classes/sanity.bbclass |   10 ++++++----
> >  1 files changed, 6 insertions(+), 4 deletions(-)
> > 
> > diff --git a/meta/classes/sanity.bbclass b/meta/classes/sanity.bbclass
> > index 13940f8..aae5028 100644
> > --- a/meta/classes/sanity.bbclass
> > +++ b/meta/classes/sanity.bbclass
> > @@ -170,10 +170,12 @@ def check_sanity(e):
> >          # This path is no longer user-readable in modern (very recent) Linux
> >          try:
> >              if os.path.exists("/proc/sys/vm/mmap_min_addr"):
> > -                f = file("/proc/sys/vm/mmap_min_addr", "r")
> > -                if (f.read().strip() != "0"):
> > -                        messages = messages + "/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"
> > -                f.close()
> > +                f = open("/proc/sys/vm/mmap_min_addr", "r")
> > +                try:
> > +                    if (int(f.read().strip()) < 65536):
> > +                        messages = messages + "/proc/sys/vm/mmap_min_addr is not >= 65536. 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 = 65536 in /etc/sysctl.conf.\n"
> > +                finally:
> > +                    f.close()
> >          except:
> >              pass
> >  
> 
> corner cases when it cannot be read are with kernel between
> 
> http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=0e1a6ef2dea88101b056b6d9984f3325c5efced3
> 2.6.33-rc2-0e1a6ef2dea88101b056b6d9984f3325c5efced3
> 
> and
> 
> http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=822cceec7248013821d655545ea45d1c6a9d15b3
> 2.6.34-rc3-822cceec7248013821d655545ea45d1c6a9d15b3
> 
> see:
> http://www.mail-archive.com/openembedded-devel@lists.openembedded.org/msg02340.html
> 
> Don't know if any large distribution is using 2.6.34 without that 2nd
> patch backported.

My laptop at least is running a kernel where that file isn't
readable :/. It isn't a standard distro one though.

Cheers,

Richard

Patch

diff --git a/meta/classes/sanity.bbclass b/meta/classes/sanity.bbclass
index 13940f8..aae5028 100644
--- a/meta/classes/sanity.bbclass
+++ b/meta/classes/sanity.bbclass
@@ -170,10 +170,12 @@  def check_sanity(e):
         # This path is no longer user-readable in modern (very recent) Linux
         try:
             if os.path.exists("/proc/sys/vm/mmap_min_addr"):
-                f = file("/proc/sys/vm/mmap_min_addr", "r")
-                if (f.read().strip() != "0"):
-                        messages = messages + "/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"
-                f.close()
+                f = open("/proc/sys/vm/mmap_min_addr", "r")
+                try:
+                    if (int(f.read().strip()) < 65536):
+                        messages = messages + "/proc/sys/vm/mmap_min_addr is not >= 65536. 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 = 65536 in /etc/sysctl.conf.\n"
+                finally:
+                    f.close()
         except:
             pass