Re: [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]



On Wed, Mar 12, 2025 at 04:12:04PM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <djwong@xxxxxxxxxx>
> 
> If we're running in a private mount namespace, /tmp is a private tmpfs

Since we're dropping privatens for ./check, there's no need for this
patch anymore.  I'll roll up and resend this series without this patch
and with the rvbs that have trickled in since then.

--D

> 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