From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-catalyst+bounces-3038-garchives=archives.gentoo.org@lists.gentoo.org>
Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80])
	by finch.gentoo.org (Postfix) with ESMTP id 60C23138247
	for <garchives@archives.gentoo.org>; Fri,  3 Jan 2014 06:01:02 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id 858CDE0A65;
	Fri,  3 Jan 2014 06:00:59 +0000 (UTC)
Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183])
	(using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by pigeon.gentoo.org (Postfix) with ESMTPS id 121C3E0A65
	for <gentoo-catalyst@lists.gentoo.org>; Fri,  3 Jan 2014 06:00:59 +0000 (UTC)
Received: from big_daddy.dol-sen.ca (S010600222de111ff.vc.shawcable.net [96.49.5.156])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	(Authenticated sender: dolsen)
	by smtp.gentoo.org (Postfix) with ESMTPSA id 127BB33F56E;
	Fri,  3 Jan 2014 06:00:57 +0000 (UTC)
From: Brian Dolbec <dolsen@gentoo.org>
To: gentoo-catalyst@lists.gentoo.org
Cc: Brian Dolbec <dolsen@gentoo.org>
Subject: [gentoo-catalyst] [PATCH 2/2] catalyst/targets/generic_stage_target.py: mount /dev/shm on linux
Date: Thu,  2 Jan 2014 22:00:44 -0800
Message-Id: <1388728844-2142-3-git-send-email-dolsen@gentoo.org>
X-Mailer: git-send-email 1.8.3.2
In-Reply-To: <1388728844-2142-1-git-send-email-dolsen@gentoo.org>
References: <1388728844-2142-1-git-send-email-dolsen@gentoo.org>
Precedence: bulk
List-Post: <mailto:gentoo-catalyst@lists.gentoo.org>
List-Help: <mailto:gentoo-catalyst+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-catalyst+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-catalyst+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-catalyst.gentoo.org>
X-BeenThere: gentoo-catalyst@lists.gentoo.org
Reply-to: gentoo-catalyst@lists.gentoo.org
X-Archives-Salt: 2fc5baa1-8375-4a9e-8342-7bf3a13c1c5f
X-Archives-Hash: 52ea02cb9d31a4d5d300cda752cb4cf8

Add shm targets defaults. Anthony G. Basile <blueness@gentoo.org>
Some build systems require /dev/shm to be mounted, like python's
build system.  We make sure that on Linux systems, /dev/shm is
mounted in the stage chroots.  See bug #496328.

Douglas Freed <dwfreed@mtu.edu> :
Mount /dev/shm in the chroot with the right options
Bind mounting /dev/shm into the chroot isn't a good idea, as there may
be collisions and result in weird side effects.  Instead, we can just
mount a new tmpfs there, with the right options to ensure security.

(Forward ported to pending branch from 2.X Brian Dolbec)
Conflicts:
	catalyst/targets/generic_stage_target.py
---
 modules/generic_stage_target.py | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/modules/generic_stage_target.py b/modules/generic_stage_target.py
index 790e4da..3d66231 100644
--- a/modules/generic_stage_target.py
+++ b/modules/generic_stage_target.py
@@ -20,6 +20,7 @@ TARGET_MOUNTS_DEFAULTS = {
 	"port_tmpdir": "/var/tmp/portage",
 	"port_logdir": "/var/log/portage",
 	"proc": "/proc",
+	"shm": "/dev/shm",
 	}
 
 SOURCE_MOUNTS_DEFAULTS = {
@@ -29,6 +30,7 @@ SOURCE_MOUNTS_DEFAULTS = {
 	"portdir": "/usr/portage",
 	"port_tmpdir": "tmpfs",
 	"proc": "/proc",
+	"shm": "shmfs",
 	}
 
 
@@ -218,6 +220,7 @@ class generic_stage_target(generic_target):
 			#self.mountmap["portdir"] = None
 		if os.uname()[0] == "Linux":
 			self.mounts.append("devpts")
+			self.mounts.append("shm")
 
 		self.set_mounts()
 
@@ -938,7 +941,7 @@ class generic_stage_target(generic_target):
 				os.makedirs(target, 0755)
 
 			if not os.path.exists(self.mountmap[x]):
-				if not self.mountmap[x] == "tmpfs":
+				if self.mountmap[x] not in ["tmpfs", "shmfs"]:
 					os.makedirs(self.mountmap[x], 0755)
 
 			src=self.mountmap[x]
@@ -959,6 +962,9 @@ class generic_stage_target(generic_target):
 							self.settings["var_tmpfs_portage"] + "G " + \
 							src + " " + target
 						retval=os.system(cmd)
+				elif src == "shmfs":
+					cmd = "mount -t tmpfs -o noexec,nosuid,nodev shm " + target
+					retval=os.system(cmd)
 				else:
 					cmd = "mount --bind " + src + " " + target
 					#print "bind(); cmd =", cmd
-- 
1.8.3.2