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]
Date:   Sat, 14 Mar 2020 11:57:23 +0100
From:   "Rafael J. Wysocki" <rjw@...ysocki.net>
To:     Eric Biggers <ebiggers@...nel.org>
Cc:     linux-pm@...r.kernel.org, Len Brown <len.brown@...el.com>,
        Pavel Machek <pavel@....cz>, glider@...gle.com,
        linux-kernel@...r.kernel.org,
        syzbot+af962bf9e7e27bccd025@...kaller.appspotmail.com
Subject: Re: [PATCH] PM / hibernate: Remove unnecessary compat ioctl overrides

On Sunday, March 8, 2020 4:27:01 AM CET Eric Biggers wrote:
> From: Eric Biggers <ebiggers@...gle.com>
> 
> Since the SNAPSHOT_GET_IMAGE_SIZE, SNAPSHOT_AVAIL_SWAP_SIZE, and
> SNAPSHOT_ALLOC_SWAP_PAGE ioctls produce an loff_t result, and loff_t is
> always 64-bit even in the compat case, there's no reason to have the
> special compat handling for these ioctls.  Just remove this unneeded
> code so that these ioctls call into snapshot_ioctl() directly, doing
> just the compat_ptr() conversion on the argument.
> 
> (This unnecessary code was also causing a KMSAN false positive.)
> 
> Signed-off-by: Eric Biggers <ebiggers@...gle.com>
> ---
>  kernel/power/user.c | 16 +---------------
>  1 file changed, 1 insertion(+), 15 deletions(-)
> 
> diff --git a/kernel/power/user.c b/kernel/power/user.c
> index 77438954cc2b..58ed9478787f 100644
> --- a/kernel/power/user.c
> +++ b/kernel/power/user.c
> @@ -409,21 +409,7 @@ snapshot_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
>  	switch (cmd) {
>  	case SNAPSHOT_GET_IMAGE_SIZE:
>  	case SNAPSHOT_AVAIL_SWAP_SIZE:
> -	case SNAPSHOT_ALLOC_SWAP_PAGE: {
> -		compat_loff_t __user *uoffset = compat_ptr(arg);
> -		loff_t offset;
> -		mm_segment_t old_fs;
> -		int err;
> -
> -		old_fs = get_fs();
> -		set_fs(KERNEL_DS);
> -		err = snapshot_ioctl(file, cmd, (unsigned long) &offset);
> -		set_fs(old_fs);
> -		if (!err && put_user(offset, uoffset))
> -			err = -EFAULT;
> -		return err;
> -	}
> -
> +	case SNAPSHOT_ALLOC_SWAP_PAGE:
>  	case SNAPSHOT_CREATE_IMAGE:
>  		return snapshot_ioctl(file, cmd,
>  				      (unsigned long) compat_ptr(arg));
> 

Applied as 5.7 material, thanks!




Powered by blists - more mailing lists