All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Anvesh Jain P" <anvesh.p@oss.qualcomm.com>
Cc: devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v3 3/4] remoteproc: qcom: pas: Add coredump support for secondary processors
Date: Wed, 18 Nov 2026 16:03:06 +0000	[thread overview]
Message-ID: <sashiko-outbox-221408@kernel.org> (raw)
In-Reply-To: <20261118-oob-support-glymur-v3-3-2cbdfe208d56@oss.qualcomm.com>

Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Medium] remoteproc: qcom: pas: duplicate dump segments in
  qcom_pas_load() on recovery
- [Medium] remoteproc: qcom: pas: secondary coredump after masked
  shutdown failure
--

commit 18ab6cc078bc90d357be63c7984c43a899ef428d
Author: Anvesh Jain P <anvesh.p@oss.qualcomm.com>

remoteproc: qcom: pas: Add coredump support for secondary processors

This commit adds coredump support for PAS remoteproc instances with a
secondary processor by registering dump segments for the secondary
firmware and mapping the secondary carveout during coredump collection.

> diff --git a/drivers/remoteproc/qcom_q6v5_pas.c b/drivers/remoteproc/qcom_q6v5_pas.c
> index 1c8c0c22c34d1..a167bd6072c94 100644
> --- a/drivers/remoteproc/qcom_q6v5_pas.c
> +++ b/drivers/remoteproc/qcom_q6v5_pas.c
[ ... ]
> @@ -336,6 +342,17 @@ static int qcom_pas_load(struct rproc *rproc, const struct firmware *fw)
>  		}
>  	}
>  
> +	if (pas->secondary_pas_id) {
> +		ret = qcom_register_dump_segments(rproc, pas->secondary_firmware);
> +		if (ret) {
> +			dev_err(pas->dev,
> +				"failed to register secondary dump segments: %d\n", ret);
> +			rproc_coredump_cleanup(rproc);
> +			qcom_pas_release_firmware(pas);
> +			return ret;
> +		}
> +	}
> +
>  	return 0;
>  }

[Severity: Medium]
Does registering secondary dump segments in qcom_pas_load() append
duplicate rproc_dump_segment entries to rproc->dump_segments on every
crash recovery?

Primary dump segments are registered in qcom_pas_parse_firmware(), which
runs only during rproc_fw_boot().  On crash recovery,
rproc_boot_recovery() runs rproc->ops->coredump() and then calls
rproc_start() -> rproc_load_segments() -> qcom_pas_load() without
clearing rproc->dump_segments, so each recovery allocates and appends
another copy of the secondary segments and produces corrupted coredump
ELFs with duplicate PT_LOAD headers.  In addition, if
qcom_register_dump_segments() fails here during recovery,
rproc_coredump_cleanup(rproc) wipes the primary segments that were
registered at initial boot and will not be re-registered on later
recoveries.

[ ... ]

> @@ -748,11 +787,28 @@ static void qcom_pas_coredump(struct rproc *rproc)
>  {
>  	struct qcom_pas *pas = rproc->priv;
>  
> -	pas->mem_region = qcom_pas_ctx_map(pas->pas_ctx);
> +	if (list_empty(&rproc->dump_segments))
> +		return;
> +
> +	if (!pas->mem_region)
> +		pas->mem_region = qcom_pas_ctx_map(pas->pas_ctx);
>  	if (!pas->mem_region)
>  		return;
>  
> +	if (qcom_pas_has_secondary(pas) && !pas->secondary_mem_region) {
> +		pas->secondary_mem_region =
> +			qcom_pas_ctx_map(pas->secondary_pas_ctx);
> +		if (!pas->secondary_mem_region)
> +			dev_err(pas->dev, "unable to map secondary memory for coredump\n");
> +	}
> +
>  	rproc_coredump(rproc);

[Severity: Medium]
Can rproc_coredump() read pas->secondary_mem_region while the secondary
carveout is still locked by TrustZone or the hypervisor if shutting down
pas->secondary_pas_id failed?

rproc_boot_recovery() only skips coredump when rproc_stop() returns an
error, as fixed for primary and DTB PAS IDs in commit 9db31edf92dd
("remoteproc: qcom_q6v5_pas: Fix error masking in qcom_pas_stop()").
However, qcom_pas_stop() overwrites the return value of
qcom_pas_shutdown(pas->secondary_pas_id) with the subsequent shutdown
calls:

drivers/remoteproc/qcom_q6v5_pas.c:qcom_pas_stop() {
	...
	if (pas->secondary_pas_id) {
		ret = qcom_pas_shutdown(pas->secondary_pas_id);
		if (ret && pas->decrypt_shutdown)
			ret = qcom_pas_shutdown_poll_decrypt(pas->secondary_pas_id);
		if (ret)
			dev_err(pas->dev, "failed to shutdown secondary: %d\n", ret);
	...
	}
	...
	ret = qcom_pas_shutdown(pas->pas_id);
}

If the secondary shutdown fails while the primary shutdown succeeds,
qcom_pas_stop() returns 0 and rproc_coredump() reads the still-protected
secondary carveout, triggering an XPU or stage-2 access violation.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261118-oob-support-glymur-v3-0-2cbdfe208d56@oss.qualcomm.com?part=3

  reply	other threads:[~2026-11-18 16:03 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-18 15:36 [PATCH v3 0/4] Add Glymur OOBMSS support Anvesh Jain P
2026-11-18 15:36 ` [PATCH v3 1/4] dt-bindings: remoteproc: qcom: Add Glymur OOBMSS PAS Anvesh Jain P
2026-11-18 15:36 ` [PATCH v3 2/4] remoteproc: qcom: pas: Support secondary images Anvesh Jain P
2026-11-18 15:56   ` sashiko-bot
2026-11-19 14:51     ` Anvesh Jain P
2026-11-18 15:36 ` [PATCH v3 3/4] remoteproc: qcom: pas: Add coredump support for secondary processors Anvesh Jain P
2026-11-18 16:03   ` sashiko-bot [this message]
2026-11-18 15:36 ` [PATCH v3 4/4] remoteproc: qcom: pas: Add Glymur OOBMSS PAS parameters Anvesh Jain P
2026-11-18 16:24   ` sashiko-bot

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=sashiko-outbox-221408@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=anvesh.p@oss.qualcomm.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.