From: Anthony G. Basile Date: Mon, 30 Dec 2013 23:57:28 +0000 (-0800) Subject: catalyst/targets/generic_stage_target.py: mount /dev/shm on linux X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=e5a9e20376397f2714aa7a835b7f42f71fcc38d9;p=catalyst.git catalyst/targets/generic_stage_target.py: mount /dev/shm on linux Add shm targets defaults. Anthony G. Basile 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 : 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 --- diff --git a/modules/generic_stage_target.py b/modules/generic_stage_target.py index 790e4da2..3d66231f 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