Skip to contentSkip to conversation

sanity.bbclass: handle lack of permission to read /proc/sys/vm/mmap_min_addr

PATCH In review Marcin Juszkiewicz 2 participants 2 messages Jan 22, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sanity.bbclass: handle lack of permission to read /proc/sys/vm/mmap_min_addr

From: Martin Jansa <[email protected]>

* 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 makes bitbake ignore reading error. Possible QEmu failure is not handled yet.

---
 classes/sanity.bbclass |   13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)
classes/sanity.bbclass +8 -5
index f65df61..f57d8e4 100644
@@ -96,11 +96,14 @@ def check_sanity(e):
 			if not check_app_exists("qemu-arm", e.data):
 				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:
+			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()
+		except:
+			pass
 
 	for util in required_utilities.split():
 		if not check_app_exists( util, e.data ):
Signature · 1 line
1.6.6
Acked-by on v1 1/1
#1 lore raw
Quoted 10 lines · Marcin Juszkiewicz

From: Martin Jansa<[email protected]>

* 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.

Quoted 4 lines

This patch makes bitbake ignore reading error. Possible QEmu failure is not handled yet.

Quoted 28 lines
---
  classes/sanity.bbclass |   13 ++++++++-----
  1 files changed, 8 insertions(+), 5 deletions(-)
classes/sanity.bbclass +8 -5
index f65df61..f57d8e4 100644
@@ -96,11 +96,14 @@ def check_sanity(e):
  			if not check_app_exists("qemu-arm", e.data):
  				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:
+			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()
+		except:
+			pass
 
  	for util in required_utilities.split():
  		if not check_app_exists( util, e.data ):