mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Gopikrishna Garmidi <gopikrishna.garmidi@oss.qualcomm.com>
To: Atul Akella <atul.akella@gmail.com>,
	andersson@kernel.org, mathieu.poirier@linaro.org,
	sibi.sankar@oss.qualcomm.com, quic_srichara@quicinc.com
Cc: linux-remoteproc@vger.kernel.org, linux-arm-msm@vger.kernel.org,
	linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH 4/4] remoteproc: qcom: Fix bounds check in wcnss_da_to_va()
Date: Fri, 27 Nov 2026 15:20:53 +0530	[thread overview]
Message-ID: <920b2c6b-53c4-46d8-b949-9c50795ca15e@oss.qualcomm.com> (raw)
In-Reply-To: <20261106184312.100-5-atul.akella@gmail.com>



On 11/7/2026 12:13 AM, Atul Akella wrote:
> offset is calculated as da - wcnss->mem_reloc and stored in a
> 32 bit signed int, while da and wcnss->mem_reloc are both u64.
> For a sufficiently small da, the 64bit difference is truncated
> into the 32 bit int, bypassing the offset < 0 underflow check
> with a small positive value. Additionally, offset + len >
> wcnss->mem_size can itself overflow when offset and len are both
> large, providing a second bypass.
> 
> da and len come from firmware's ELF program headers via
> rproc_da_to_va(), and the result is used by the ELF loader
> to write firmware segments, so a malformed firmware image can
> cause writes outside the carveout.
> 
> Rewrite the bounds check entirely in u64 arithmetic. Reject
> underflow before computing offset (da < wcnss->mem_reloc).
> Replace the addition based overflow check with a
> subtraction based one (len > wcnss->mem_size - offset) so no
> intermediate sum can wrap.
> 
> Fixes: aed361adca9f ("remoteproc: qcom: Introduce WCNSS peripheral image loader")
> Cc: stable@vger.kernel.org
> Signed-off-by: Atul Akella <atul.akella@gmail.com>
> ---

Reviewed-by: Gopikrishna Garmidi <gopikrishna.garmidi@oss.qualcomm.com>

Thanks,
Gopikrishna

      reply	other threads:[~2026-11-27  9:51 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-06 18:43 [PATCH 0/4] remoteproc: qcom: Fix DA-to-VA bounds checks Atul Akella
2026-11-06 18:43 ` [PATCH 1/4] remoteproc: qcom: Fix bounds check in adsp_da_to_va() Atul Akella
2026-11-27  9:48   ` Gopikrishna Garmidi
2026-11-06 18:43 ` [PATCH 2/4] remoteproc: qcom: Fix bounds check in qcom_pas_da_to_va() Atul Akella
2026-11-27  9:49   ` Gopikrishna Garmidi
2026-11-06 18:43 ` [PATCH 3/4] remoteproc: qcom: Fix bounds check in q6v5_wcss_da_to_va() Atul Akella
2026-11-27  9:49   ` Gopikrishna Garmidi
2026-11-06 18:43 ` [PATCH 4/4] remoteproc: qcom: Fix bounds check in wcnss_da_to_va() Atul Akella
2026-11-27  9:50   ` Gopikrishna Garmidi [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=920b2c6b-53c4-46d8-b949-9c50795ca15e@oss.qualcomm.com \
    --to=gopikrishna.garmidi@oss.qualcomm.com \
    --cc=andersson@kernel.org \
    --cc=atul.akella@gmail.com \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-remoteproc@vger.kernel.org \
    --cc=mathieu.poirier@linaro.org \
    --cc=quic_srichara@quicinc.com \
    --cc=sibi.sankar@oss.qualcomm.com \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®