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] [day] [month] [year] [list]
Message-ID: <d4e265dd-a4c0-4e06-995e-98602275100c@huawei.com>
Date: Sat, 8 Nov 2025 12:05:45 +0800
From: Baokun Li <libaokun1@...wei.com>
To: Fedor Pchelkin <pchelkin@...ras.ru>
CC: Theodore Ts'o <tytso@....edu>, <linux-ext4@...r.kernel.org>, Jan Kara
	<jack@...e.cz>, Andreas Dilger <adilger.kernel@...ger.ca>, "Darrick J. Wong"
	<djwong@...nel.org>, <linux-kernel@...r.kernel.org>,
	<lvc-project@...uxtesting.org>
Subject: Re: [PATCH v2 2/2] ext4: check if mount_opts is NUL-terminated in
 ext4_ioctl_set_tune_sb()

On 2025-11-02 00:04, Fedor Pchelkin wrote:
> params.mount_opts may come as potentially non-NUL-term string.  Userspace
> is expected to pass a NUL-term string.  Add an extra check to ensure this
> holds true.  Note that further code utilizes strscpy_pad() so this is just
> for proper informing the user of incorrect data being provided.
>
> Found by Linux Verification Center (linuxtesting.org).
>
> Signed-off-by: Fedor Pchelkin <pchelkin@...ras.ru>

Looks good to me.

Reviewed-by: Baokun Li <libaokun1@...wei.com>

> ---
>
> v2: check length of mount_opts in superblock tuning ioctl (Jan Kara)
>
>     Can't plainly return error at strscpy_pad() call site in
>     ext4_sb_setparams(), that's a void ext4_update_sb_callback.
>
> v1: https://lore.kernel.org/lkml/20251028130949.599847-1-pchelkin@ispras.ru/T/#u
>
>  fs/ext4/ioctl.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/fs/ext4/ioctl.c b/fs/ext4/ioctl.c
> index a93a7baae990..3dec26c939fd 100644
> --- a/fs/ext4/ioctl.c
> +++ b/fs/ext4/ioctl.c
> @@ -1394,6 +1394,10 @@ static int ext4_ioctl_set_tune_sb(struct file *filp,
>  	if (copy_from_user(&params, in, sizeof(params)))
>  		return -EFAULT;
>  
> +	if (strnlen(params.mount_opts, sizeof(params.mount_opts)) ==
> +	    sizeof(params.mount_opts))
> +		return -E2BIG;
> +
>  	if ((params.set_flags & ~TUNE_OPS_SUPPORTED) != 0)
>  		return -EOPNOTSUPP;
>  



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ