Commit Graph

136 Commits

Author SHA1 Message Date
Linux Build Service Account
f3294982e8 Merge b18ae2cb6b on remote branch
Change-Id: I1a13150b54046d36ff065f6045e2f4277253cbee
2023-12-12 11:31:05 -08:00
ntarte
c46358d49d msm: adsprpc: Fix UAF in fastrpc_print_debug_data
In fastrpc_print_debug_data accessing fl will cause
UAF condition if is_ramdump_enable is not set. In this
case, there won't be any wait condition in fastrpc_file_free
so fl will be freed in between accessing data. To fix this,
check is_ramdump_enable before accessing fl data.

Signed-off-by: quic_anane <quic_anane@quicinc.com>
Change-Id: Ia4670a73f887e17afae3cfeb7e6c6457b3337ae9
(cherry picked from commit b18ae2cb6b)
2023-11-27 16:02:15 +05:30
Linux Build Service Account
fe8c6eae03 Merge 2ddcb6c817 on remote branch
Change-Id: I107e7bce4b862edb6e34238a154a2dd38be73fb7
2023-11-22 09:52:01 -08:00
quic_anane
b18ae2cb6b msm: adsprpc: Fix UAF in fastrpc_print_debug_data
In fastrpc_print_debug_data accessing fl will cause
UAF condition if is_ramdump_enable is not set. In this
case, there won't be any wait condition in fastrpc_file_free
so fl will be freed in between accessing data. To fix this,
check is_ramdump_enable before accessing fl data.

Signed-off-by: quic_anane <quic_anane@quicinc.com>
Change-Id: Ia4670a73f887e17afae3cfeb7e6c6457b3337ae9
2023-11-08 12:12:11 +05:30
Ansa Ahmed
2ddcb6c817 Merge "msm: adsprpc: fix memory leak scenario in print debug data" into dsp-kernel.lnx.1.0 2023-11-03 02:45:01 -07:00
Ansa Ahmed
5c26a308b1 msm: adsprpc: fix memory leak scenario in print debug data
Add proper return path to ensure that allocated memory for gmsglog
variables is freed before exiting. In error cases when returning
from the function without proper exit handling, not freeing allocated
memory leads to memory leak.

Change-Id: I718a6a3d1fef8598cb67e7d627bde00a8b009324
Signed-off-by: Ansa Ahmed <quic_ansa@quicinc.com>
2023-11-02 15:18:49 -07:00
qctecmdr
e74c177794 Merge "msm: adsprpc : Mark tgid_frpc unuse after device unregister" 2023-10-31 04:08:15 -07:00
Linux Build Service Account
ac753ca808 Merge 98ca55499e on remote branch
Change-Id: I1aa15a0245ed4fd9c3578fad71b46718d4e17f19
2023-10-20 04:25:18 -07:00
Santosh Sakore
5065a3b879 msm: adsprpc : Mark tgid_frpc unuse after device unregister
In fastrpc_file_free tgid_frpc is marked as unused before device
unregister. And current tgid_frpc can be used by to other sessions
from same process, which will lead to device register failures. To
avoid this scenario, mark tgid_frpc available after device unregister.

Change-Id: I6ba77af3a2b6d0d9aa961459dfe2bf163d5aede2
Signed-off-by: Santosh Sakore <quic_ssakore@quicinc.com>
2023-10-12 06:23:50 -07:00
qctecmdr
25171a642b Merge "Check product type before enabling driver" 2023-10-11 22:58:10 -07:00
Anvesh Jain P
f633ed34d1 Check product type before enabling driver
Add condition to enable driver for non GVM target.
Virtual fastrpc driver is used for target based on
hypervisor, skipping driver compilation.

Signed-off-by: Anvesh Jain P <quic_ajainp@quicinc.com>
Change-Id: I1ac5c0e29f259cbd05f426ca51cd945b695078c9
2023-10-10 12:44:50 +05:30
DEEPAK SANNAPAREDDY
c37154e2e4 msm: adsprpc : Fix use after free in fastrpc_internal_mem_unmap
Thread 1 can make a to call fastrpc_mmap_create under internal mem map
and release fl->map_mutex. Thread 2 can make call to internal mem unmap,
acquire fl->map_mutex and get same map though fastrpc_mmap_remove.
Thread 1 fail in fastrpc_mem_map_to_dsp jumps to bail and do map free.
Thread 2 still holds same map which can lead use after free. Serialize
fastrpc internal mem map and unmap.

Change-Id: I54a3602914b43fc67635c0de193bd21aa13daaa3
Signed-off-by: DEEPAK SANNAPAREDDY <quic_sdeeredd@quicinc.com>
2023-10-09 18:55:45 +05:30
DEEPAK SANNAPAREDDY
98ca55499e msm: adsprpc : Fix use after free in fastrpc_internal_mem_unmap
Thread 1 can make a to call fastrpc_mmap_create under internal mem map
and release fl->map_mutex. Thread 2 can make call to internal mem unmap,
acquire fl->map_mutex and get same map though fastrpc_mmap_remove.
Thread 1 fail in fastrpc_mem_map_to_dsp jumps to bail and do map free.
Thread 2 still holds same map which can lead use after free. Serialize
fastrpc internal mem map and unmap.

Change-Id: I54a3602914b43fc67635c0de193bd21aa13daaa3
Signed-off-by: DEEPAK SANNAPAREDDY <quic_sdeeredd@quicinc.com>
2023-10-09 11:48:56 +05:30
Linux Build Service Account
a51531eb39 Merge 4198880546 on remote branch
Change-Id: Ideb2f6c790d9d5edf8c13722847183cbe70ae8ec
2023-10-03 13:06:55 -07:00
DEEPAK SANNAPAREDDY
3a1e7d8111 msm: adsprpc: Handle UAF in process shell memory
Added flag to indicate memory used
in process initialization. And, this memory
would not removed in internal unmap to avoid
UAF or double free.

Change-Id: Ie470fe58ac334421d186feb41fa67bd24bb5efea
Signed-off-by: DEEPAK SANNAPAREDDY <quic_sdeeredd@quicinc.com>
2023-09-22 16:32:06 +05:30
Linux Build Service Account
bb3fee77c6 Merge 955d53fcac on remote branch
Change-Id: Ie2fa9b418c2b491caf0827f39b072d680337af87
2023-09-21 07:57:13 -07:00
DEEPAK SANNAPAREDDY
4198880546 msm: Add holi module support
Add holi module to support holi target

Change-Id: Ie7557e5d7dd725576286f08b4050b53d70cf8f27
2023-09-12 23:41:01 +05:30
Linux Build Service Account
b25544b738 Merge 7fd02f3859 on remote branch
Change-Id: I9b926588408013e5dfd871aee12e5d3356da20ba
2023-09-05 09:07:21 -07:00
Krishna Dogney
955d53fcac Revert "msm: adsprpc: Validate sessions of process are of same pd type on same dsp."
This reverts commit 49d8960d0c.

Reason for revert: This change will block applications which will create
multiple sessions with different pd type. Hence need to revert the change.
Keeping 3rd party app to create multiple session intact.

Signed-off-by: Krishna Dogney <quic_kdogney@quicinc.com>
Change-Id: I1bef85d37bd003b752db05d42530d3ddfad0f726
2023-08-29 15:20:47 -07:00
Ansa Ahmed
6087dc5827 msm: adsprpc: Usage of HLIST for async queue instead of LIST
To avoid queueing of a duplicate job that may belong to a freed ctx,
update async queue type from LIST to HLIST to avoid appending unhashed
nodes back to queue. Thread race can occur between thread undergoing
SSR routine and invoke response thread for FASTRPC_INVOKE2_ASYNC_RESPONSE
to queue job to the async queue.

Change-Id: Iebcd0e82f22ceb64d0f89e8458d6329c08c62bdc
Signed-off-by: Ansa Ahmed <quic_ansa@quicinc.com>
2023-08-28 06:14:36 -07:00
V S Ganga VaraPrasad (VARA) Adabala
7b85330500 Revert "Revert "dsp-kernel: make pm relax vote when process is exiting""
This reverts commit fb1fbff95a.

Signed-off-by: V S Ganga VaraPrasad (VARA) Adabala <quic_vadabala@quicinc.com>
2023-08-27 16:07:36 +05:30
quic_anane
7fd02f3859 msm: adsprpc: handle failures during fastrpc device init
Currenty in case where CMA alloc fails in fastrpc_device_init,
a warning is issued. But the error code is not reset. With this
change, above issue is handled properly and if CMA allocation is
successful, then only add the information to the channel structure.

Change-Id: I15aa32e82cecedaf4e2da7275cef13369b3429bc
Signed-off-by: quic_anane <quic_anane@quicinc.com>
2023-08-26 00:19:42 +05:30
Linux Build Service Account
e737473869 Merge "Merge 322b6a2596 on remote branch" into dsp-kernel.lnx.1.0.r2-rel 2023-08-24 23:31:35 -07:00
Linux Build Service Account
6bf2859ed0 Merge 322b6a2596 on remote branch
Change-Id: I10161734196c8368350bfe001776e514970e0080
2023-08-24 06:25:00 -07:00
Linux Image Build Automation
fb1fbff95a Revert "dsp-kernel: make pm relax vote when process is exiting"
This reverts commit 6dd07d6578.

Change-Id: I698b0f770e4aff4c99bfd2635d4a236023b7a5dd
Signed-off-by: Linux Image Build Automation <quic_ibautomat@quicinc.com>
2023-08-23 16:19:38 -07:00
Ramesh Nallagopu
b92e5483d4 msm: adsprpc: add warning log for non-ion buffer
Print non-ion buffer details as warning to help in size issues debugging.

Change-Id: Ib96af6d202620e06cd9ed15f2698f6eac5c3a444
Signed-off-by: Ramesh Nallagopu <quic_rnallago@quicinc.com>
2023-08-23 07:16:26 -07:00
Edgar Flores
e32585b2b4 adsprpc: tvm: Obtain buffer attributes to determine ownership and access
Query buffer's attributes to determine if buffer should be mapped to secure
context bank.
Query buffer's HLOS access and return error from TVM driver if HLOS has
access to buffer.

Change-Id: Ia6d02b28929e1126a01c69a8425b6797fbee3506
2023-08-22 14:07:10 -07:00
Krishna Dogney
49d8960d0c msm: adsprpc: Validate sessions of process are of same pd type on same dsp.
Currently, a single process can create multiple sessions of different pd types.
 Now, force all sessions of a process to be of same pd type on same dsp. Also,
allow untrusted apps to create multiple sessions on dsp.

Signed-off-by: Krishna Dogney <quic_kdogney@quicinc.com>
Change-Id:I98c97c1ceeefa303cee4909ccca280a2430da908
2023-08-21 10:04:31 -07:00
Edgar Flores
b0308ca14e adsprpc: tvm: Forcing compatibility flag to true for TVM
Setting flag to true in TVM to force TVM driver to use APIs
adsp_process_group_mmap64 and adsp_process_group_munmap64 instead
of adsp_process_group_mmap and adsp_process_group_munmap.

Change-Id: Ibbeb7f4177f11e75b1150e011090347219f04806
2023-08-17 11:46:23 -07:00
Thyagarajan Venkatanarayanan
02257e15e3 msm: adsprpc: add ftrace for dspsignal events for perf debugging
Define new ftrace to log dspsignal events like signalling, waiting,
waking up, completing and cancelling wait. These ftraces can be
used in performance debugging of dspqueue overheads.

Change-Id: Iaf5f3df0f7ba3bd3da94f7614724b8f63ca09ed6
Signed-off-by: Thyagarajan Venkatanarayanan <quic_venkatan@quicinc.com>
2023-08-16 10:58:45 -07:00
nishant chaubey
6dd07d6578 dsp-kernel: make pm relax vote when process is exiting
If process is exiting and pm wakelock is not released, cpu
can't go to sleep. Relax wakeup source during file_free to
allow cpu to go to sleep.

Change-Id: I1be9d6b295c123e657dac90ba7fa013cd2f42bae
Signed-off-by: nishant chaubey <quic_chaubey@quicinc.com>
Signed-off-by: Linux Image Build Automation <quic_ibautomat@quicinc.com>
2023-08-14 14:01:53 -07:00
quic_anane
322b6a2596 msm: Add cliffs module support
Add cliffs module to support cliffs target

Signed-off-by: quic_anane <quic_anane@quicinc.com>
2023-08-09 22:32:55 -07:00
Linux Build Service Account
ec91eedae1 Merge e986aa6a2f on remote branch
Change-Id: I564f5f37a130d9339cd6da7e8368a5e6b9cd088d
2023-08-07 19:55:50 -07:00
nishant chaubey
ee0b4fc8a6 dsp-kernel: make pm relax vote when process is exiting
If process is exiting and pm wakelock is not released, cpu
can't go to sleep. Relax wakeup source during file_free to
allow cpu to go to sleep.

Change-Id: Ie6161edbd43f1fb11f36fbb8f913ceaf92e89736
Signed-off-by: nishant chaubey <quic_chaubey@quicinc.com>
2023-08-01 22:13:41 -07:00
nishant chaubey
e986aa6a2f msm: adsprpc: add tgid to frpc_tgid conversion debug logs
Currently we send custom tgid instead of original tgid to DSP.
It is difficult to debug issues only with DSP logs, dumps and
logcat. Add original tgid to custom tgid conversion log to help
in debug.

Change-Id: If05bae05bce69cf513cef0bd1672f78856c11ea8
Signed-off-by: nishant chaubey <quic_chaubey@quicinc.com>
2023-07-31 18:06:14 -07:00
Linux Image Build Automation
32d85c1e83 Revert "msm: adsprpc: Fail set session info on subsequent calls"
This reverts commit e72afbb1ef.

Change-Id: Ie0b1e84d2306456ae66c41a811f3a43b1ff2d4de
Signed-off-by: Linux Image Build Automation <quic_ibautomat@quicinc.com>
2023-07-31 13:05:41 -07:00
Linux Image Build Automation
079b05c23e Revert "msm: adsprpc: Unique handles for different remote sub systems"
This reverts commit c982dc242f.

Change-Id: I453a3f993b31699cf906d400fdb70590fa6b8367
Signed-off-by: Linux Image Build Automation <quic_ibautomat@quicinc.com>
2023-07-31 13:02:09 -07:00
Santosh Sakore
cccaae9d74 msm: adsprpc: Return fail when hyp assign failed.
Currently the error code from hype assign failure is over writing by
fastrpc_unmap_on_dsp success and returning the false success. So added
separate variable to capture the error from fastrpc_unmap_on_dsp.

Change-Id: I6444635925416d8ef96800a02e8a1e3e550fa011
Acked-by: Ramesh Nallagopu <rnallago@qti.qualcomm.com>
Signed-off-by: Santosh Sakore <quic_ssakore@quicinc.com>
2023-07-28 19:18:01 +05:30
Himateja Reddy
c982dc242f msm: adsprpc: Unique handles for different remote sub systems
Currently handles are unique only for a particular sub systems,
but they are not unique across all remote sub systems. Assign
unique handle to each session of the remote sub system.

Change-Id: Ie246f80c440d684c8fcb30ad0103da069c82ab6e
Signed-off-by: Himateja Reddy <quic_hmreddy@quicinc.com>
Signed-off-by: Linux Image Build Automation <quic_ibautomat@quicinc.com>
2023-07-27 14:46:16 -07:00
Himateja Reddy
e72afbb1ef msm: adsprpc: Fail set session info on subsequent calls
Currently there is no check if set session info is invoked
multiple times. Multiple calls to session info leaks memory
and process identifiers. Fail set session info on subsequent
calls.

Signed-off-by: Himateja Reddy <quic_hmreddy@quicinc.com>
(cherry picked from commit 1a5889127e7b0ff6974e50d762708bc2ef2d3a6c)
Signed-off-by: Linux Image Build Automation <quic_ibautomat@quicinc.com>

Change-Id: Id3512263274b86f0534fc5fd45bdf62783859ad5
2023-07-27 14:42:46 -07:00
Ansa Ahmed
15b180fee9 msm: adsprpc: Verbose logging in case of dma attachment failures
When dma attachment fails during mmap_create, status
of HLOS memory is logged with sizes occupied by heap and
non heap buffers mapped in fl maps. The purpose of this
data is to get a snapshot of memory usage.

Change-Id: Ie913702a743a8572d9f68c9b58233d28541167b9
Signed-off-by: Ansa Ahmed <quic_ansa@quicinc.com>
2023-07-25 23:33:02 -07:00
qctecmdr
543b55072d Merge "msm: adsprpc: out of bound access for glist_session_ctrl" 2023-07-24 23:53:08 -07:00
DEEPAK SANNAPAREDDY
9e7b2c7220 msm: adsprpc: correct the invocation of dma_buf_begin/end_cpu_access
In case of IO Coherence disabled, to simulate
cache clean and invalidate for output buffers,
used dma_buf_end_cpu_access(DMA_TO_DEVICE)
and dma_buf_begin_cpu_access(DMA_FROM_DEVICE).

Change-Id: Id176a26cb740d168a1a28240874434c626e48d75
Signed-off-by: DEEPAK SANNAPAREDDY <quic_sdeeredd@quicinc.com>
2023-07-22 20:53:20 +05:30
nishant chaubey
9e2564e979 msm: adsprpc: out of bound access for glist_session_ctrl
Check proper index before access glist_session_ctrl
to fix out of bound access.

Change-Id: Id942b0add1bcc99f0c2f8b22ce631a11685ab340
Signed-off-by: nishant chaubey <quic_chaubey@quicinc.com>
2023-07-21 06:07:45 +05:30
Linux Build Service Account
60d50376ee Merge f3bb535dca on remote branch
Change-Id: Ie84806d44567043ae2e2212dcf9223ee57ef1005
2023-07-19 16:34:05 -07:00
Himateja Reddy
be29afe6b2 msm: adsprpc: Unique handles for different remote sub systems
Currently handles are unique only for a particular sub systems,
but they are not unique across all remote sub systems. Assign
unique handle to each session of the remote sub system.

Change-Id: I5cf0e82d87283006e719a3b24ae01a1fcb97c392
Signed-off-by: Himateja Reddy <quic_hmreddy@quicinc.com>
2023-07-19 15:46:02 -07:00
Linux Image Build Automation
12a8dd0f1f Revert "msm: adsprpc: Fail set session info on subsequent calls"
This reverts commit b7614deec2.

Change-Id: I83716eea97831e88af67290342a2214ee53fbe06
Signed-off-by: Linux Image Build Automation <quic_ibautomat@quicinc.com>
2023-07-18 15:53:23 -07:00
Ansa Ahmed
ac57e6d939 msm: adsprpc: Modify global variable spinlocks to avoid spinlock recursion
Spinlock in current scenario can be interrupted thus during ongoing
ISR. If callback received from dsp, attempt to acquire same lock
again will result into recursive spinlock with wait on queue to
acquire lock again. Modify spinlocks with global variable gfa to
non interruptible spinlocks in order to avoid this scenario.

Change-Id: I5ae4864370d94ae0e0e19d3d4939ada41d609234
Signed-off-by: Ansa Ahmed <quic_ansa@quicinc.com>
2023-07-16 22:52:19 -07:00
Himateja Reddy
b7614deec2 msm: adsprpc: Fail set session info on subsequent calls
Currently there is no check if set session info is invoked
multiple times. Multiple calls to session info leaks memory
and process identifiers. Fail set session info on subsequent
calls.

Signed-off-by: Himateja Reddy <quic_hmreddy@quicinc.com>
(cherry picked from commit 1a5889127e7b0ff6974e50d762708bc2ef2d3a6c)
Signed-off-by: Linux Image Build Automation <quic_ibautomat@quicinc.com>

Change-Id: I3b281a6892d8ab1cc1adbb5b9296485ed2738050
2023-07-11 15:37:42 -07:00
qctecmdr
9f3624b73c Merge "msm: adsprpc: Fail set session info on subsequent calls" 2023-07-10 22:05:44 -07:00