From 956e29d3bbdc455da2d1d97701cbe0a9996c0422 Mon Sep 17 00:00:00 2001 From: Peter Wilhelm Date: Wed, 5 Jun 2024 18:25:39 -0500 Subject: [PATCH] Update exec_env.py to mount /dev/null and /dev/urandom --- include/python/exec_env.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/include/python/exec_env.py b/include/python/exec_env.py index 95522d7..d63d304 100644 --- a/include/python/exec_env.py +++ b/include/python/exec_env.py @@ -63,9 +63,13 @@ def link(self, src, dest): class ChrootEnv(ExecuteEnv): def execute(self, cmd, display=False, logfile="", **kwargs): - mount_point = os.path.join(self.chroot_dir, 'proc') - if not os.path.ismount(mount_point): - subprocess.check_call(['mount', '-t', 'proc', 'none', mount_point]) + proc_mount_point = os.path.join(self.chroot_dir, 'proc') + if not os.path.ismount(proc_mount_point): + subprocess.check_call(['mount', '-t', 'proc', 'none', proc_mount_point]) + + dev_mount_point = os.path.join(self.chroot_dir, 'dev') + if not os.path.ismount(dev_mount_point): + subprocess.check_call(['mount', '--bind', '/dev', dev_mount_point]) if isinstance(cmd, list): cmd = ['chroot', self.chroot_dir] + cmd