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  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:   Wed, 20 May 2020 20:02:55 +0900
From:   Masami Hiramatsu <mhiramat@...nel.org>
To:     Christoph Hellwig <hch@....de>
Cc:     x86@...nel.org, Alexei Starovoitov <ast@...nel.org>,
        Daniel Borkmann <daniel@...earbox.net>,
        Linus Torvalds <torvalds@...ux-foundation.org>,
        Andrew Morton <akpm@...ux-foundation.org>,
        linux-parisc@...r.kernel.org, linux-um@...ts.infradead.org,
        netdev@...r.kernel.org, bpf@...r.kernel.org, linux-mm@...ck.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH 20/20] maccess: return -ERANGE when
 copy_from_kernel_nofault_allowed fails

On Tue, 19 May 2020 15:44:49 +0200
Christoph Hellwig <hch@....de> wrote:

> Allow the callers to distinguish a real unmapped address vs a range
> that can't be probed.
> 
> Suggested-by: Masami Hiramatsu <mhiramat@...nel.org>
> Signed-off-by: Christoph Hellwig <hch@....de>

Hi Christoph,

Can you also update the kerneldoc comment too?
Other than that, this looks good to me.

Reviewed-by: Masami Hiramatsu <mhiramat@...nel.org>

Thank you!

> ---
>  mm/maccess.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/mm/maccess.c b/mm/maccess.c
> index 1e7d77656c596..4010d64189d21 100644
> --- a/mm/maccess.c
> +++ b/mm/maccess.c
> @@ -25,7 +25,7 @@ bool __weak copy_from_kernel_nofault_allowed(void *dst, const void *unsafe_src,
>  long copy_from_kernel_nofault(void *dst, const void *src, size_t size)
>  {
>  	if (!copy_from_kernel_nofault_allowed(dst, src, size))
> -		return -EFAULT;
> +		return -ERANGE;
>  
>  	pagefault_disable();
>  	copy_from_kernel_nofault_loop(dst, src, size, u64, Efault);
> @@ -69,7 +69,7 @@ long strncpy_from_kernel_nofault(char *dst, const void *unsafe_addr, long count)
>  	if (unlikely(count <= 0))
>  		return 0;
>  	if (!copy_from_kernel_nofault_allowed(dst, unsafe_addr, count))
> -		return -EFAULT;
> +		return -ERANGE;
>  
>  	pagefault_disable();
>  	do {
> @@ -107,7 +107,7 @@ long copy_from_kernel_nofault(void *dst, const void *src, size_t size)
>  	mm_segment_t old_fs = get_fs();
>  
>  	if (!copy_from_kernel_nofault_allowed(dst, src, size))
> -		return -EFAULT;
> +		return -ERANGE;
>  
>  	set_fs(KERNEL_DS);
>  	pagefault_disable();
> @@ -174,7 +174,7 @@ long strncpy_from_kernel_nofault(char *dst, const void *unsafe_addr, long count)
>  	if (unlikely(count <= 0))
>  		return 0;
>  	if (!copy_from_kernel_nofault_allowed(dst, unsafe_addr, count))
> -		return -EFAULT;
> +		return -ERANGE;
>  
>  	set_fs(KERNEL_DS);
>  	pagefault_disable();
> -- 
> 2.26.2
> 


-- 
Masami Hiramatsu <mhiramat@...nel.org>

Powered by blists - more mailing lists