lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <3bd1f738-93b7-038d-6db9-7bf6a330b1ea@linux.ibm.com>
Date:   Wed, 16 Dec 2020 10:53:45 +0530
From:   Ritesh Harjani <riteshh@...ux.ibm.com>
To:     fstests@...r.kernel.org, Eryu Guan <guan@...u.me>
Cc:     linux-ext4@...r.kernel.org, linux-xfs@...r.kernel.org,
        anju@...ux.vnet.ibm.com
Subject: Re: [PATCHv2 1/2] common/rc: Add whitelisted FS support in
 _require_scratch_swapfile()



On 12/16/20 10:47 AM, Ritesh Harjani wrote:
> Filesystems e.g. ext4 and XFS supports swapon by default and an error
> returned with swapon should be treated as a failure. Hence
> add ext4/xfs as whitelisted fstype in _require_scratch_swapfile()
> 
> Signed-off-by: Ritesh Harjani <riteshh@...ux.ibm.com>
> ---
> v1->v2: Addressed comments from Eryu @[1]
> [1]: https://patchwork.kernel.org/project/fstests/cover/cover.1604000570.git.riteshh@linux.ibm.com/
> 
>   common/rc | 20 ++++++++++++++++----
>   1 file changed, 16 insertions(+), 4 deletions(-)
> 
> diff --git a/common/rc b/common/rc
> index 33b5b598a198..635b77a005c6 100644
> --- a/common/rc
> +++ b/common/rc
> @@ -2380,6 +2380,7 @@ _format_swapfile() {
>   # Check that the filesystem supports swapfiles
>   _require_scratch_swapfile()
>   {
> +	local fstyp=$FSTYP
>   	_require_scratch
>   	_require_command "$MKSWAP_PROG" "mkswap"
> 
> @@ -2401,10 +2402,21 @@ _require_scratch_swapfile()
>   	# Minimum size for mkswap is 10 pages
>   	_format_swapfile "$SCRATCH_MNT/swap" $(($(get_page_size) * 10))
> 
> -	if ! swapon "$SCRATCH_MNT/swap" >/dev/null 2>&1; then
> -		_scratch_unmount
> -		_notrun "swapfiles are not supported"
> -	fi
> +	# For whitelisted fstyp swapon should not fail.
> +	case "$fstyp" in
> +	ext4|xfs)
> +		if ! swapon "$SCRATCH_MNT/swap" >/dev/null 2>&1; then
> +			_scratch_unmount
> +			_fail "swapon failed for $fstyp"

@Eryu,
As of now I added _fail() if swapon failed for given whitelisting fstype.
Do you think this is alright, or should I just ignore the error in
case of such FS?



> +		fi
> +		;;
> +	*)
> +		if ! swapon "$SCRATCH_MNT/swap" >/dev/null 2>&1; then
> +			_scratch_unmount
> +			_notrun "swapfiles are not supported"
> +		fi
> +		;;
> +	esac
> 
>   	swapoff "$SCRATCH_MNT/swap" >/dev/null 2>&1
>   	_scratch_unmount
> --
> 2.26.2
> 

Powered by blists - more mailing lists