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]
Message-ID: <YUw/k1PdjfYmufQP@kroah.com>
Date:   Thu, 23 Sep 2021 10:49:23 +0200
From:   Greg KH <gregkh@...uxfoundation.org>
To:     Jeya R <jeyr@...eaurora.org>
Cc:     linux-arm-msm@...r.kernel.org, srinivas.kandagatla@...aro.org,
        linux-kernel@...r.kernel.org, fastrpc.upstream@....qualcomm.com
Subject: Re: [PATCH] misc: fastrpc: copy to user only for non-DMA-BUF heap
 buffers

On Thu, Sep 23, 2021 at 02:07:52PM +0530, Jeya R wrote:
> fastrpc_put_args is copying all the output buffers to user. For large
> number of output context buffers, this might cause performance
> degradation. Copying is not needed for DMA-BUF heap buffers.

What does "performance degradation" really mean?

> 
> Signed-off-by: Jeya R <jeyr@...eaurora.org>
> ---
>  drivers/misc/fastrpc.c | 18 ++++++++++--------
>  1 file changed, 10 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/misc/fastrpc.c b/drivers/misc/fastrpc.c
> index beda610..536eabf 100644
> --- a/drivers/misc/fastrpc.c
> +++ b/drivers/misc/fastrpc.c
> @@ -890,15 +890,17 @@ static int fastrpc_put_args(struct fastrpc_invoke_ctx *ctx,
>  	inbufs = REMOTE_SCALARS_INBUFS(ctx->sc);
>  
>  	for (i = inbufs; i < ctx->nbufs; ++i) {
> -		void *src = (void *)(uintptr_t)rpra[i].pv;
> -		void *dst = (void *)(uintptr_t)ctx->args[i].ptr;
> -		u64 len = rpra[i].len;
> +		if (!ctx->maps[i]) {
> +			void *src = (void *)(uintptr_t)rpra[i].pv;
> +			void *dst = (void *)(uintptr_t)ctx->args[i].ptr;

uintptr_t is not a kernel variable type.  Please use the real kernel
type for this as you are touching these lines.

> +			u64 len = rpra[i].len;
>  
> -		if (!kernel) {
> -			if (copy_to_user((void __user *)dst, src, len))
> -				return -EFAULT;
> -		} else {
> -			memcpy(dst, src, len);
> +			if (!kernel) {
> +				if (copy_to_user((void __user *)dst, src, len))
> +					return -EFAULT;
> +			} else {
> +				memcpy(dst, src, len);
> +			}

So you were copying buffers that didn't need to be copied?  So you are
now doing less work?  Or is this fixing a bug where you were copying
things that you should not have been copying?

What commit does this fix?  Does this need to go to the stable kernel
trees?

thanks,

greg k-h

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ