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:   Mon, 20 Dec 2021 16:10:45 +0800
From:   Baoquan He <bhe@...hat.com>
To:     "Matthew Wilcox (Oracle)" <willy@...radead.org>
Cc:     Vivek Goyal <vgoyal@...hat.com>, Dave Young <dyoung@...hat.com>,
        akpm@...ux-foundation.org, kexec@...ts.infradead.org,
        Tiezhu Yang <yangtiezhu@...ngson.cn>,
        linux-kernel@...r.kernel.org,
        Amit Daniel Kachhap <amit.kachhap@....com>,
        Christoph Hellwig <hch@....de>, linux-fsdevel@...r.kernel.org
Subject: Re: [PATCH v3 1/3] vmcore: Convert copy_oldmem_page() to take an
 iov_iter

On 12/13/21 at 02:39pm, Matthew Wilcox (Oracle) wrote:
> Instead of passing in a 'buf' and 'userbuf' argument, pass in an iov_iter.
> s390 needs more work to pass the iov_iter down further, or refactor,
> but I'd be more comfortable if someone who can test on s390 did that work.
> 
> It's more convenient to convert the whole of read_from_oldmem() to
> take an iov_iter at the same time, so rename it to read_from_oldmem_iter()
> and add a temporary read_from_oldmem() wrapper that creates an iov_iter.
> 
> Signed-off-by: Matthew Wilcox (Oracle) <willy@...radead.org>


Thanks for making this to do an awesome clean up. This one looks good to
me.

Acked-by: Baoquan He <bhe@...hat.com>

...... 
> -/**
> - * copy_oldmem_page() - copy one page from old kernel memory
> - * @pfn: page frame number to be copied
> - * @buf: buffer where the copied page is placed
> - * @csize: number of bytes to copy
> - * @offset: offset in bytes into the page
> - * @userbuf: if set, @buf is int he user address space
> - *
> - * This function copies one page from old kernel memory into buffer pointed by
> - * @buf. If @buf is in userspace, set @userbuf to %1. Returns number of bytes
> - * copied or negative error in case of failure.
> - */
> -ssize_t copy_oldmem_page(unsigned long pfn, char *buf,
> -			 size_t csize, unsigned long offset,
> -			 int userbuf)
> +ssize_t copy_oldmem_page(struct iov_iter *iter, unsigned long pfn,
> +			 size_t csize, unsigned long offset)
                                ^^^^^^
I am curious why this parameter is called 'csize', but not 'size' directly.
This is not related to this patch, it's an old naming.

>  {
>  	void *vaddr;
>  
> @@ -40,14 +28,7 @@ ssize_t copy_oldmem_page(unsigned long pfn, char *buf,
>  	if (!vaddr)
>  		return -ENOMEM;
>  
> -	if (userbuf) {
> -		if (copy_to_user(buf, vaddr + offset, csize)) {
> -			iounmap(vaddr);
> -			return -EFAULT;
> -		}
> -	} else {
> -		memcpy(buf, vaddr + offset, csize);
> -	}
> +	csize = copy_to_iter(vaddr + offset, csize, iter);
>  
>  	iounmap(vaddr);
>  	return csize;

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ