mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ekansh Gupta <quic_ekangupt@quicinc.com>
To: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Cc: <srinivas.kandagatla@linaro.org>, <linux-arm-msm@vger.kernel.org>,
	<gregkh@linuxfoundation.org>, <quic_bkumar@quicinc.com>,
	<linux-kernel@vger.kernel.org>, <quic_chennak@quicinc.com>,
	<dri-devel@lists.freedesktop.org>, <arnd@arndb.de>,
	stable <stable@kernel.org>
Subject: Re: [PATCH v1 1/2] misc: fastrpc: Fix registered buffer page address
Date: Thu, 9 Jan 2025 11:09:30 +0530	[thread overview]
Message-ID: <ed96e4b5-a0a0-4c0e-b2ef-e06ea9d3718a@quicinc.com> (raw)
In-Reply-To: <rhy3yvsnhdud45mesempnwyv5faxfkbj2ba76k6dbm7krwl77y@mnpi5jzykjg3>




On 12/18/2024 4:42 PM, Dmitry Baryshkov wrote:
> On Wed, Dec 18, 2024 at 03:54:28PM +0530, Ekansh Gupta wrote:
>> For registered  buffers, fastrpc driver sends the buffer information
>> to remote subsystem. There is a problem with current implementation
>> where the page address is being sent with an offset leading to
>> improper buffer address on DSP. This is leads to functional failures
>> as DSP expects base address in page information and extracts offset
>> information from remote arguments. Mask the offset and pass the base
>> page address to DSP.
>>
>> Fixes: 80f3afd72bd4 ("misc: fastrpc: consider address offset before sending to DSP")
> This was committed in 2019. Are you saying that the driver has been
> broken since that time? If so, what is the impact? Because I've
> definitely been running fastrpc workload after that moment.
>
> Also, is there any reason for neglecting checkpatch warning?
Hi Dmitry,

This issue is observed is a corner case when some buffer which is registered with fastrpc
framework is passed with some offset by user and then the DSP implementation tried to
read the data. As DSP expects base address and takes care of offsetting with remote
arguments, passing an offsetted address will result in some unexpected data read in DSP.

All generic usecases usually pass the buffer as it is hence is problem is not usually observed. If
someone tries to pass offsetted buffer and then tries to compare data at HLOS and DSP end,
then the ambiguity will be observed.

Apologies for delay in response as I was traveling with very limited internet access.

--ekansh
>
>> Cc: stable <stable@kernel.org>
>> Signed-off-by: Ekansh Gupta <quic_ekangupt@quicinc.com>
>> ---
>>  drivers/misc/fastrpc.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/misc/fastrpc.c b/drivers/misc/fastrpc.c
>> index 48d08eeb2d20..cfa1546c9e3f 100644
>> --- a/drivers/misc/fastrpc.c
>> +++ b/drivers/misc/fastrpc.c
>> @@ -992,7 +992,7 @@ static int fastrpc_get_args(u32 kernel, struct fastrpc_invoke_ctx *ctx)
>>  			mmap_read_lock(current->mm);
>>  			vma = find_vma(current->mm, ctx->args[i].ptr);
>>  			if (vma)
>> -				pages[i].addr += ctx->args[i].ptr -
>> +				pages[i].addr += (ctx->args[i].ptr & PAGE_MASK) -
>>  						 vma->vm_start;
>>  			mmap_read_unlock(current->mm);
>>  
>> -- 
>> 2.34.1
>>


  reply	other threads:[~2025-01-09  5:39 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-18 10:24 [PATCH v1 0/2] Add missing fixes in fastrpc_get_args Ekansh Gupta
2024-12-18 10:24 ` [PATCH v1 1/2] misc: fastrpc: Fix registered buffer page address Ekansh Gupta
2024-12-18 11:12   ` Dmitry Baryshkov
2025-01-09  5:39     ` Ekansh Gupta [this message]
2025-01-09 12:25       ` Dmitry Baryshkov
2024-12-18 10:24 ` [PATCH v1 2/2] misc: fastrpc: Fix copy buffer page size Ekansh Gupta
2024-12-18 11:14   ` Dmitry Baryshkov
2024-12-18 11:11 ` [PATCH v1 0/2] Add missing fixes in fastrpc_get_args Dmitry Baryshkov
2024-12-30 16:15 ` Srinivas Kandagatla
2024-12-30 18:22   ` Dmitry Baryshkov
2024-12-30 20:32     ` Srinivas Kandagatla
2024-12-30 23:51       ` Dmitry Baryshkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ed96e4b5-a0a0-4c0e-b2ef-e06ea9d3718a@quicinc.com \
    --to=quic_ekangupt@quicinc.com \
    --cc=arnd@arndb.de \
    --cc=dmitry.baryshkov@linaro.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=quic_bkumar@quicinc.com \
    --cc=quic_chennak@quicinc.com \
    --cc=srinivas.kandagatla@linaro.org \
    --cc=stable@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®