misc: fastrpc: fix UAF and Oops around SSR teardown
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v2 Latest2 patches 0 repliesNew
- v13 patches 4 repliesSuperseded
Patches in v2 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/2 | misc: fastrpc: wake poll-mode waiters on SSRdrivers/ | +1 | 0 replies | |
| 2/2 | misc: fastrpc: drain in-flight invokes before tearing down context banksdrivers/ | +56 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.
Cover letter [PATCH v2 0/2] misc: fastrpc: fix UAF and Oops around SSR teardown
On Hamoa (X1E80100) IoT EVK the ADSP can restart repeatedly, and every restart has a chance of taking the kernel down with it:
Unable to handle kernel paging request at virtual address fffffdffc1ffffc0
Internal error: Oops: 0000000096000006
CPU: 5 UID: 0 PID: 2766 Comm: adsprpcd
pc : ___free_pages+0x24/0xe0
Call trace:
___free_pages
__free_pages
__dma_direct_free_pages
dma_direct_free
dma_free_attrs
fastrpc_context_free [fastrpc]
fastrpc_internal_invoke [fastrpc]
fastrpc_device_ioctl [fastrpc]The faulting address decodes to a struct page for a PFN that has no vmemmap backing. It comes from dma_free_coherent() being called against a qcom,fastrpc-compute-cb device that of_platform_depopulate() has already unbound: with the IOMMU torn down, the call falls through to dma_direct_free(), which takes the buffer's IOVA for a physical address and hands the resulting page to the page allocator.
fastrpc_rpmsg_remove() wakes every pending invoke with -EPIPE and then immediately depopulates the context banks, with no synchronisation in between, so woken threads race the teardown on their way to fastrpc_context_free().
The series is ordered so each patch stands on its own:
1/2 makes fastrpc_notify_users() wake poll-mode waiters, which today
keep spinning on a buffer the teardown is about to reclaim.
2/2 counts in-flight invokes and drains them before touching any
channel resource.
Jianping Li (2):
misc: fastrpc: wake poll-mode waiters on SSR
misc: fastrpc: drain in-flight invokes before tearing down context
banks
drivers/misc/fastrpc.c | 61 +++++++++++++++++++++++++++++++++++++++--- 1 file changed, 57 insertions(+), 4 deletions(-)
Signature · 1 line
2.43.0