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]
Date:   Sun, 29 Mar 2020 13:19:59 -0700
From:   Bart Van Assche <bvanassche@....org>
To:     Martijn Coenen <maco@...roid.com>, axboe@...nel.dk, hch@....de
Cc:     Chaitanya.Kulkarni@....com, linux-block@...r.kernel.org,
        linux-kernel@...r.kernel.org, kernel-team@...roid.com
Subject: Re: [PATCH] loop: Add LOOP_SET_FD_WITH_OFFSET ioctl.

On 2020-03-29 07:04, Martijn Coenen wrote:
> -static int loop_set_fd(struct loop_device *lo, fmode_t mode,
> -		       struct block_device *bdev, unsigned int arg)
> +static int loop_set_fd_with_offset(struct loop_device *lo, fmode_t mode,
> +		struct block_device *bdev, unsigned int arg, loff_t offset)

Since this function has to be modified, please add an additional patch
to rename 'arg' into 'fd'. Additionally, how about renaming
"loop_set_fd_with_offset" into "loop_set_fd_and_offset"? I think the
latter name reflects more clearly the purpose of this function.

> @@ -1624,6 +1625,17 @@ static int lo_ioctl(struct block_device *bdev, fmode_t mode,
>  		break;
>  	case LOOP_GET_STATUS64:
>  		return loop_get_status64(lo, (struct loop_info64 __user *) arg);
> +	case LOOP_SET_FD_WITH_OFFSET: {
> +		struct loop_fd_with_offset fdwo;
> +
> +		if (copy_from_user(&fdwo,
> +				(struct loop_fd_with_offset __user *) arg,
> +				sizeof(struct loop_fd_with_offset)))
                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The kernel code that I'm familiar with uses sizeof(<variable name>)
instead of sizeof(<struct name>). That makes it less likely that
changing the type of the variable will introduce a mismatch between the
sizeof() expression and the size of the variable.

Thanks,

Bart.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ