提交图

187 次代码提交

作者 SHA1 备注 提交日期
Santosh
4cb6d58c44 dsp-kernel: Validate the CID before accessing the channel mutex
In the early stages of fastrpc_internal_invoke, we validate the user CID
and handle failure cases. However, in the error scenario, an invalid CID
can lead to issues when accessing the channel mutex. To prevent this, we
should validate the CID before accessing the channel mutex via fastrpc
user structure.

Change-Id: Ic1f7ae01a749b57c9b9e69210314d694ebcf300b
Signed-off-by: Santosh <quic_ssakore@quicinc.com>
2024-06-24 10:13:18 -07:00
Abhishek Singh
dab8bb801d dsp-kernel: Handle the spinlock recursion
Currently, in print_debug_data, kref_put is being called inside the
global lock, and the same lock is taken in the release callback of
kref_put, leading to spinlock recursion. There is no need to get and
put the reference for the fastrpce file inside this function because
we have already taken the reference inside the update_ramdump_status
while adding the init memory entry to the chan->initmems list.
Moreover, the same list will be used in print_debug_data.

Signed-off-by: Abhishek Singh <quic_abhishes@quicinc.com>
Change-Id: Ifdc8b3e0c2bbc5cc4237eedaa24c8cd766262dfe
(cherry picked from commit 3463a894b8)
2024-06-20 23:58:54 -07:00
Linux Build Service Account
efb2e9b453 Merge 91e7a6d3a6 on remote branch
Change-Id: I864d24f21c259b705ee081b2886502c9f02ad992
2024-06-19 07:58:14 -07:00
qctecmdr
91e7a6d3a6 Merge "msm: adsprpc: Add support for cdsp1 remoteproc" 2024-06-07 18:59:00 -07:00
Linux Build Service Account
a6e179ab88 Merge cbac754e8e on remote branch
Change-Id: I72cb100e24d51f3c3def87d9ed81bdc967842f91
2024-06-07 06:56:24 -07:00
Anvesh Jain P
dbd9441b48 msm: adsprpc: Add support for cdsp1 remoteproc
The fastrpc driver supports 4 remoteproc. There are some
products such as automotive which support cdsp1 remoteproc.
Add changes to support cdsp1 remoteproc.

Change-Id: I3a9b221c53ccd4331de089ab38ccd6d715db4bf4
Signed-off-by: Anvesh Jain P <quic_ajainp@quicinc.com>
2024-06-06 10:50:53 +05:30
qctecmdr
f2961aceca Merge "dsp-kernel: Adding locks while printing debug data" 2024-05-30 05:06:28 -07:00
qctecmdr
f5bccbffe3 Merge "dsp-kernel: Move the ssrcount access within a critical section" 2024-05-28 20:37:25 -07:00
Ansa Ahmed
dea40cdd29 dsp-kernel: Adding locks while printing debug data
Add locking mechanism while printing file map and cma map in print
debug data.

Change-Id: I36484d763b56ec88413ca9394c08ff30d85e664a
Signed-off-by: Ansa Ahmed <quic_ansa@quicinc.com>
2024-05-28 10:12:42 -07:00
Abhishek Singh
8d872e2880 dsp-kernel: Dequeue the CMA mini dump node to avoid infinite loop
Currently, the CMA mini dump node is not being dequeued, leading to an
infinite loop. Dequeue the CMA mini dump node as well along with all
the init mems.

Signed-off-by: Abhishek Singh <quic_abhishes@quicinc.com>
Change-Id: Ie5c24ee4ce43c798ed40a8d766371449bcf27b68
(cherry picked from commit 74775598d4)
2024-05-28 10:11:01 -07:00
Minghao Xue
0abf6ac7b3 dsp-kernel: Handle dspsignal_wait based on timeout
Currently, dsp signal waits definite timeout even though
time out set to indefinite wait and returns timeout error.
Fix is added proper check for waiting indefinitely and
returned proper error code.

Change-Id: Ib4d8835cee6c686dae45f8b5ddf128d24c28cdad
Signed-off-by: Minghao Xue <quic_mingxue@quicinc.com>
2024-05-28 16:56:01 +08:00
Santosh Sakore
a5ee0494e9 dsp-kernel: Move the ssrcount access within a critical section
The subsystem ssrcount is write-protected with a channel mutex. In a
few places, the code accesses it outside the critical section, which
can result in false reads during a race condition. To address this,
move the ssrcount access within a critical section.

Change-Id: I7df1e05fd892277a10514e3759f7ea67c51bac3b
Signed-off-by: Santosh <quic_ssakore@quicinc.com>
2024-05-28 13:03:15 +05:30
qctecmdr
fc1f38402c Merge "dsp-kernel: Dequeue the CMA mini dump node to avoid infinite loop" 2024-05-27 03:48:43 -07:00
Abhishek Singh
74775598d4 dsp-kernel: Dequeue the CMA mini dump node to avoid infinite loop
Currently, the CMA mini dump node is not being dequeued, leading to an
infinite loop. Dequeue the CMA mini dump node as well along with all
the init mems.

Signed-off-by: Abhishek Singh <quic_abhishes@quicinc.com>
Change-Id: Ie5c24ee4ce43c798ed40a8d766371449bcf27b68
2024-05-27 11:33:31 +05:30
Ansa Ahmed
d028daccf5 dsp-kernel: Adding locks while printing debug data
Add locking mechanism while printing file map and cma map in print
debug data.

Change-Id: I36484d763b56ec88413ca9394c08ff30d85e664a
Signed-off-by: Ansa Ahmed <quic_ansa@quicinc.com>
2024-05-21 16:03:30 +05:30
Linux Build Service Account
9133607ddd Merge bc325e5025 on remote branch
Change-Id: I3a38af78c738d436f15b3592ce37ea7b52e8cc15
2024-05-17 03:24:24 -07:00
qctecmdr
cbac754e8e Merge "dsp-kernel: use-after-free (UAF) in global maps" 2024-05-16 09:35:18 -07:00
qctecmdr
17f348ad7a Merge "msm: Add anorak module support" 2024-05-13 21:37:33 -07:00
Sudheer Gummalla
26d80835ad msm: Add anorak module support
Add anorak module to support anorak target

Change-Id: Ifc81c5c4b02c40eaa7d2281c5a4c374657457514
Signed-off-by: Sudheer Gummalla <quic_gummalla@quicinc.com>
2024-05-09 13:00:44 +05:30
Abhishek Singh
3c85f07825 dsp-kernel: Handle spin lock in error scenarios
Currently, the code flow bails out without releasing the spin lock,
leading to spin lock recursion. Additionally, the free function is
called during this bail, which is a sleep function. To address this
issue, ensure that the spin lock is released before proceeding to the
bail.

Change-Id: I57884049d7799c3c69eccb4fa2db043b073d5312
Signed-off-by: Abhishek Singh <quic_abhishes@quicinc.com>
2024-05-03 09:27:58 -07:00
Abhishek Singh
bc325e5025 dsp-kernel: Handle spin lock in error scenarios
Currently, the code flow bails out without releasing the spin lock,
leading to spin lock recursion. Additionally, the free function is
called during this bail, which is a sleep function. To address this
issue, ensure that the spin lock is released before proceeding to the
bail.

Change-Id: I57884049d7799c3c69eccb4fa2db043b073d5312
Signed-off-by: Abhishek Singh <quic_abhishes@quicinc.com>
2024-05-02 00:24:39 -07:00
Linux Build Service Account
7023cf8949 Merge 963c25dc25 on remote branch
Change-Id: I3b7fe6c805c313b0f9fc8369c029c18863e103a0
2024-04-30 07:32:59 -07:00
Abhishek Singh
6dab51a3af dsp-kernel: use-after-free (UAF) in global maps
Currently, remote heap maps get added to the global list before the
fastrpc_internal_mmap function completes the mapping. Meanwhile, the
fastrpc_internal_munmap function accesses the map, starts unmapping, and
frees the map before the fastrpc_internal_mmap function completes,
resulting in a use-after-free (UAF) issue. Add the map to the list after
the fastrpc_internal_mmap function completes the mapping.

Signed-off-by: Abhishek Singh <quic_abhishes@quicinc.com>
Change-Id: I8aa23cf215e53d0613774c2b2657954bca6c72f4
2024-04-27 15:24:20 +05:30
Linux Build Service Account
022d81231f Merge 57edad9997 on remote branch
Change-Id: Ib5b0505fc26ace70446eb802e17d5c021f87ebb2
2024-04-11 09:44:59 -07:00
Ansa Ahmed
963c25dc25 dsp-kernel: Additon of krefs to fastrpc process structure
Add krefs reference counters to fastrpc process objects.
Process structures are used in multiple places and passed
around. Maintaining krefs helps ensure that the release routine
for structure is called after last reference to the pointer
is done.

Co-developed-by: Abhinav Parihar <quic_parihar@quicinc.com>
Change-Id: I5fd35af3c5581bf69ebfddf56951d76d9a2d10fb
Signed-off-by: Ansa Ahmed <quic_ansa@quicinc.com>
2024-04-10 17:22:30 +05:30
Ramesh Nallagopu
8f36f9526b dsp-kernel: Allow audio PD kill call after audio PDR
Currently, after audio PDR, all invoke calls are discarded in pd status
check, due to this kill does not reach to DSP to clean up the ftq
group in guestOS. Fix is to discard only audio pd attachment and allow
kill message to clean DSP GuestOS resources.

Change-Id: Ica8bff6ed6e81eab4119c59c46fb6be9c0b79704
Signed-off-by: rnallago <quic_rnallago@quicinc.com>
2024-03-29 16:59:21 +05:30
qctecmdr
57edad9997 Merge "adsprpc: Add check to prevent out of bound access" 2024-03-22 04:13:19 -07:00
Linux Build Service Account
2c74ad4f82 Merge 8a799ee9b4 on remote branch
Change-Id: I314654344688742d370b3fc5325a9491c88b5352
2024-03-20 01:37:52 -07:00
qctecmdr
7f8a3c54d4 Merge "adsprpc: Skip ramdump during PDR" 2024-03-14 13:30:54 -07:00
Ramesh Nallagopu
2643292546 adsprpc: Skip ramdump during PDR
The current code collects RAM dumps for both DSP SSR and PDR, but not
required during PDR. Fix is to collect it for SSR and skip it for PDR.

Change-Id: Ibcc9c7291488b67fa0570e86eef5867ba7fcb2ed
Signed-off-by: rnallago <quic_rnallago@quicinc.com>
2024-03-14 17:47:37 +05:30
qctecmdr
8a799ee9b4 Merge "msm: adsprpc : Fix use after free in fastrpc_update_ramdump_status" 2024-03-07 07:27:26 -08:00
qctecmdr
e797e0d37f Merge "dsp-kernel: Handle race-condition in dsp signal" 2024-03-07 05:19:46 -08:00
quic_anane
1d05790e68 dsp-kernel: Handle race-condition in dsp signal
The `fastrpc_dspsignal_wait` function currently checks the
signal state before waiting for a signal from the DSP. However,
if the signal is already received before the check, it results
in an infinite loop, causing excessive resource usage.

This change addresses the race condition by checking both the
pending and signaled states. If the signal is not in the pending
state, it directly checks for the signaled state, resets the states,
and returns to avoid looping.

Change-Id: I00f80780cccf5a7b0e95f961607042efe62d9d30
Signed-off-by: quic_anane <quic_anane@quicinc.com>
2024-03-05 14:15:25 -08:00
Ramesh Nallagopu
cc9738786a msm: adsprpc : Fix use after free in fastrpc_update_ramdump_status
Thread1 can free up the fl->init memory in
fastrpc_init_create_dynamic_process  with fl spin lock, same time thread2
adding fl->init_mem to chan->initmems list with global spin lock in
fastrpc_update_ramdump_status can lead to use after free in
fastrpc_ramdump_collection. Fix is to use global spin lock while
handling fl->init_mem.

Change-Id: I7a497dc962b6967a4d594a3acce55f8ce0eb3a55
Signed-off-by: rnallago <quic_rnallago@quicinc.com>
2024-03-05 22:25:07 +05:30
Ansa Ahmed
4e20907ac2 msm: adsprpc: Handle UAF in fastrpc_mmap_remove_ssr
Currently unlocking the spinlock during maps list iteration
can lead to use after free. Fix is to lock, read one map
from list, stop iteration and unlock, repeate same for all
the maps complete in the list.

Acked-by: Ramesh Nallagopu <rnallago@qti.qualcomm.com>
Change-Id: I834bdcb9dd55a33f6308188ec1f844b7d81cb30e
Signed-off-by: Ansa Ahmed <quic_ansa@quicinc.com>
2024-03-05 11:29:50 +05:30
rnallago
a4befa3f75 adsprpc: Add check to prevent out of bound access
Add -ve value check for index to prevent the array out of bound access.

Change-Id: I0d23e2cb258227ef76779d82ec2c8f6b9cf7f95f
Signed-off-by: rnallago <quic_rnallago@quicinc.com>
2024-03-04 18:24:29 +05:30
quic_anane
207899cb03 dsp-kernel: Check for user input buffer
Add check for user input buffer to fix improper access.

Signed-off-by: quic_anane <quic_anane@quicinc.com>
(cherry picked from commit 23611a1626)

Change-Id: I888ba99d81ca4659858193abfdb16706c989d1c3
2024-02-25 03:09:33 -08:00
Abhishek Singh
941b3f835f msm: adsprpc: Free the memory allocated for status notification
Currently, memory allocated for status notification is only
freed by the notif thread. If notif thread exits, notif entries
will not be freed. Free the notif entries while closing
the fastrpc file.

Change-Id: I8e715a4c449a595ce492379bfc50eaf456bbccf6
Signed-off-by: Abhishek Singh <quic_abhishes@quicinc.com>
2024-02-20 00:08:24 -08:00
qctecmdr
d95b6bb0db Merge "msm: Add volcano module support" 2024-02-08 06:20:35 -08:00
Abhishek Singh
8b49e1eaa0 msm: Add volcano module support
Add volcano module to support volcano target

Signed-off-by: Abhishek Singh <quic_abhishes@quicinc.com>
Change-Id: I02b1c9a14370ceb5bf2ae495e15be7c54f1a3bb6
2024-02-06 11:00:03 +05:30
Linux Build Service Account
0285a156a7 Merge 698dfba608 on remote branch
Change-Id: I3f28983cef832bc88859c2c62560462512c185ca
2024-02-04 09:57:16 -08:00
quic_anane
23611a1626 dsp-kernel: Check for user input buffer
Add check for user input buffer to fix improper access.

Signed-off-by: quic_anane <quic_anane@quicinc.com>
2024-01-25 16:43:12 +05:30
Linux Build Service Account
4b8ecfbc5b Merge f4142dce5c on remote branch
Change-Id: I28f173ce6eb401127cbfbf38ea754c5f073c8ebe
2024-01-24 10:23:08 -08:00
Edgar Flores
698dfba608 msm: adsprpc: Set buffer type in TVM to non-secure
Customer is seeing issue when sharing buffer to secure PD.
Buffer is being set to 'secure buffer type' by trusted driver which
is invalid in TVM.
There are no 'secure' buffers on TVM. All buffers in TVM need to be
marked as 'non-secure'.

Fix is to explicitly mark buffers as 'non-secure' for TVM only.

Change-Id: I80c70bc59dcbd78be4119c1855fd4e5fa2e7d5cb
2024-01-23 16:09:22 -08:00
qctecmdr
f4142dce5c Merge "dsp-kernel: Check pdrcount count along with pd status" 2024-01-04 12:18:51 -08:00
Linux Build Service Account
7ba5981c13 Merge a976ff28cc on remote branch
Change-Id: I4f241aca6df859d4f79f7bdcf26a5b43133df379
2024-01-03 04:39:27 -08:00
Abhishek Singh
a7c28cef64 dsp-kernel: Check pdrcount count along with pd status
Currently, only pd status is checked before sending any request
to DSP. On pd down notification all the pending contexts are
completed with connection reset error. But, if context gets
created after the pd down callback, it is not returned with
connection reset error. If the context is regarding pd attach,
daemon will get attached to DSP pd. And in this scenario, if
daemon gets killed and reconnection happens, ownership of init
memory will be assigned back to HLOS, which will cause SMMU fault.
Check pdr count for audioPD before sending any request to DSP.

Change-Id: Iadf1c9ca718659086fcd6dc8db105f48337933f6
Signed-off-by: Abhishek Singh <quic_abhishes@quicinc.com>
2024-01-02 11:43:30 +05:30
Abhishek Singh
a976ff28cc msm: adsprpc: Avoid double free on map
Decrement and check the ref count of map
inside the lock. Otherwise, two threads may
free the same map.

Change-Id: Iae758752c0d3c296f155f3200adb783c92100a70
Signed-off-by: Abhishek Singh <quic_abhishes@quicinc.com>
2023-12-18 12:32:29 +05:30
Linux Build Service Account
f3294982e8 Merge b18ae2cb6b on remote branch
Change-Id: I1a13150b54046d36ff065f6045e2f4277253cbee
2023-12-12 11:31:05 -08:00
quic_anane
c5d0af46d7 dsp-kernel: add session id for SSR notifications
Currently driver is passing session id as zero when SSR notification
is queued. This will cause issues in case of multisession, only
default session will get the notification. Add a change to pass
proper session ID to make sure all the sessions are getting notified.

Change-Id: I1f3bb7169ff9c7b725e3a69dc098c56197e4cbaf
Signed-off-by: ANANDU KRISHNAN E <quic_anane@quicinc.com>
2023-12-12 01:23:34 -08:00