[PATCH 3/3] check: don't allow TEST_DIR/SCRATCH_MNT to be in /tmp

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]



From: Darrick J. Wong <djwong@xxxxxxxxxx>

If we're running in a private mount namespace, /tmp is a private tmpfs
mount.  Using TEST_DIR/SCRATCH_MNT that point there is a bad idea
because anyone can write to there.  Let's just stop that.

Signed-off-by: "Darrick J. Wong" <djwong@xxxxxxxxxx>
---
 check |   14 ++++++++++++++
 1 file changed, 14 insertions(+)


diff --git a/check b/check
index 33eb3e0859e578..09134ee63e41e2 100755
--- a/check
+++ b/check
@@ -815,6 +815,20 @@ function run_section()
 		echo "SECTION       -- $section"
 	fi
 
+	# If we're running in a private mount namespace, /tmp is a private
+	# directory.  We /could/ just mkdir it, but we'd rather have people
+	# set those paths elsewhere.
+	if [ "$HAVE_PRIVATENS" = yes ] && [[ $TEST_DIR =~ ^\/tmp ]]; then
+		echo "$TEST_DIR: TEST_DIR must not be in /tmp"
+		status=1
+		exit
+	fi
+	if [ "$HAVE_PRIVATENS" = yes ] && [[ $SCRATCH_MNT =~ ^\/tmp ]]; then
+		echo "$SCRATCH_MNT: SCRATCH_MNT must not be in /tmp"
+		status=1
+		exit
+	fi
+
 	sect_start=`_wallclock`
 	if $RECREATE_TEST_DEV || [ "$OLD_FSTYP" != "$FSTYP" ]; then
 		echo "RECREATING    -- $FSTYP on $TEST_DEV"





[Index of Archives]     [Linux Filesystems Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux