Skip to content

remoteproc: qcom: Fix DA-to-VA bounds checks

Atul Akella linux-arm-msm linux-remoteproc lkml stable 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest4 patches 0 repliesNew

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4remoteproc: qcom: Fix bounds check in adsp_da_to_va()drivers/remoteproc/qcom_q6v5_adsp.c+4 -20 replies
2/4remoteproc: qcom: Fix bounds check in qcom_pas_da_to_va()drivers/remoteproc/qcom_q6v5_pas.c+4 -20 replies
3/4remoteproc: qcom: Fix bounds check in q6v5_wcss_da_to_va()drivers/remoteproc/qcom_q6v5_wcss.c+4 -20 replies
4/4remoteproc: qcom: Fix bounds check in wcnss_da_to_va()drivers/remoteproc/qcom_wcnss.c+4 -20 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/4] remoteproc: qcom: Fix DA-to-VA bounds checks

This series fixes the same bounds check bug in da_to_va() across four Qualcomm remoteproc PIL drivers: qcom_q6v5_adsp, qcom_q6v5_pas, qcom_q6v5_wcss, and qcom_wcnss.

In each driver, offset is a signed 32bit integer assigned from the 64 bit difference da - <base>, where both operands are u64. If da is smaller than <base>, the subtraction underflows before the result is truncated on assignment. This can produce a small positive offset and bypass the existing underflow check. Separately, the offset + len bounds check can overflow.

da and len originate from firmware ELF program headers (p_paddr and p_memsz) via rproc_da_to_va(). The returned address is used by the ELF loader to write firmware segments, so a malformed firmware image can cause writes outside the carveout.

Each patch keeps offset in u64, rejects addresses below the relocation base before subtraction, and uses a subtraction based bounds check to avoid overflow.

Atul Akella (4):
remoteproc: qcom: Fix bounds check in adsp_da_to_va()
remoteproc: qcom: Fix bounds check in qcom_pas_da_to_va()
remoteproc: qcom: Fix bounds check in q6v5_wcss_da_to_va()
remoteproc: qcom: Fix bounds check in wcnss_da_to_va()

 drivers/remoteproc/qcom_q6v5_adsp.c | 6 ++++--
 drivers/remoteproc/qcom_q6v5_pas.c  | 6 ++++--
 drivers/remoteproc/qcom_q6v5_wcss.c | 6 ++++--
 drivers/remoteproc/qcom_wcnss.c     | 6 ++++--
 4 files changed, 16 insertions(+), 8 deletions(-)
Signature · 1 line
2.43.0