Public bug reported:
**Description:**
### Impact
In `linux-image-7.3.0-38-qcom-x1e` (`drivers/misc/fastrpc.c`), commit
`e85eb5feca8e` (`misc: fastrpc: fix use-after-free of fastrpc_user in workqueue
context`, CVE-2026-53161) introduced a circular `kref` deadlock between `struct
fastrpc_user` (`fl`) and `struct fastrpc_invoke_ctx` (`ctx`):
1. `fastrpc_context_alloc()` takes `fastrpc_user_get(fl)` and queues `ctx` onto
`fl->pending`.
2. When a process exits abnormally (`SIGABRT`/`SIGKILL`) while a thread is
waiting in `fastrpc_internal_invoke()` (`-ERESTARTSYS`), `ctx` remains on
`fl->pending` holding a reference on `fl`.
3. `fastrpc_device_release()` calls `fastrpc_session_free(cctx, fl->sctx)` and
`fastrpc_user_put(fl)` **without draining `fl->pending`**.
4. The `fl->pending` drain loop lives inside `fastrpc_user_free()`, which can
never execute while `fl->pending` holds a `ctx` referencing `fl`.
As a result, **one crashed/killed NPU process (`llama-bench` / `llama-server` /
QAIRT)**:
- Permanently leaks all mapped DMA-bufs (**~10 GiB RAM** in our 27B model test).
- Permanently exhausts the recycled `compute-cb` 32-bit SMMU IOVA space so
every subsequent NPU launch fails with `-ENOMEM` until reboot:
```text
kernel: qcom,fastrpc-cb 32300000.remoteproc:glink-edge:fastrpc:compute-cb@2:
failed to map buffer, fd = 18
strace: ioctl(8, FASTRPC_IOCTL_MEM_MAP, ...) = -1 ENOMEM (Cannot allocate
memory)
```
### Upstream Status
This regression from `e85eb5feca8e` has an active upstream fix on
`linux-arm-msm`:
- `[PATCH v2] misc: fastrpc: fix fastrpc_user leak on abnormal process exit`
(RenĂª de Souza Pinto, Nov 2026).
We also verified an equivalent minimal patch (attached) that drains
`fl->pending` in `fastrpc_device_release()` and moves
`fastrpc_session_free()` into `fastrpc_user_free()` so the SMMU context
bank is never recycled before `fl->maps` are unmapped.
### Hardware Verification (`Lenovo IdeaCentre Mini 01Q8X10`, `x1p42100`,
`7.3.0-38-qcom-x1e`)
- **Stock `7.3.0-38-qcom-x1e`:** 1 aborted 27B `llama-bench` run leaks ~10 GiB
RAM (`4.4 GiB -> 14 GiB used`) and permanently breaks subsequent `0.5B` NPU
runs (`-ENOMEM`) until reboot.
- **With patch applied:** Repeated aborted 27B runs leak **0.0 GiB RAM** (`28
GiB available` before & after), and `HTP0` recovers immediately (`2,701 t/s`).
Please backport the upstream fix to `linux-qcom-x1e`!
** Affects: linux (Ubuntu)
Importance: Undecided
Status: New
** Patch added:
"0001-misc-fastrpc-fix-circular-kref-leak-on-interrupted-invoke.patch"
https://bugs.launchpad.net/bugs/2178549/+attachment/6022525/+files/0001-misc-fastrpc-fix-circular-kref-leak-on-interrupted-invoke.patch
--
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2178549
Title:
[qcom-x1e] fastrpc: circular kref leak on interrupted invoke
permanently leaks RAM (~10 GiB) and exhausts compute-cb SMMU IOVA
(-ENOMEM)
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/2178549/+subscriptions
--
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs