[oe] [PATCH] sanity.bbclass: Reading /proc/sys/vm/mmap_min_addr is not permitted with 2.6.33+ on host

Martin Jansa martin.jansa at gmail.com
Sat Jan 2 17:10:43 UTC 2010


* With 2.6.33-rc2-00252-ge9e5521 on my host I noticed that
  "cat /proc/sys/vm/mmap_min_addr" returns now
  "cat: /proc/sys/vm/mmap_min_addr: Operation not permitted"
  Its probably becuse of
  http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=0e1a6ef2dea88101b056b6d9984f3325c5efced3
  But I'm not sure if checking CAP_SYS_RAWIO even for reading this value
  is intentional or just bug which should be fixed in kernel.

* This patch prints notice about need to check that value yourself (as
  root) instead of failing with "ERROR: IO Error: [Errno 1] Operation
  not permitted"

* Its not optimal, because this notice is shown every time you run
  bitbake (even after checking/setting 0 to mmap_min_addr if you have
  kernel not allowing to read it

Signed-off-by: Martin Jansa <Martin.Jansa at gmail.com>
---
 classes/sanity.bbclass |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/classes/sanity.bbclass b/classes/sanity.bbclass
index f65df61..4f90975 100644
--- a/classes/sanity.bbclass
+++ b/classes/sanity.bbclass
@@ -97,10 +97,15 @@ def check_sanity(e):
 				messages = messages + "qemu-native was in ASSUME_PROVIDED but the QEMU binaries (qemu-arm) can't be found in PATH"
 
 		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()
+			try:
+				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()
+			except:
+				import bb
+				bb.msg.note(1, bb.msg.domain.Parsing, "/proc/sys/vm/mmap_min_addr cannot be checked. This will cause problems with qemu if it is not set to 0, so please check the value (as root).\n\nTo fix this in later reboots, set vm.mmap_min_addr = 0 in /etc/sysctl.conf.\n")
+				
 
 	for util in required_utilities.split():
 		if not check_app_exists( util, e.data ):
-- 
1.6.6





More information about the Openembedded-devel mailing list