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 4/4] remoteproc: qcom: pas: Add Glymur OOBMSS PAS parameters
Date: Wed, 18 Nov 2026 16:24:11 +0000	[thread overview]
Message-ID: <sashiko-outbox-221469@kernel.org> (raw)
In-Reply-To: <20261118-oob-support-glymur-v3-4-2cbdfe208d56@oss.qualcomm.com>

Thank you for your contribution! Sashiko AI review found 3 potential
issues to consider:
- [Medium] remoteproc: qcom: pas: broken secondary dump segments in
  qcom_pas_load()
- [Medium] remoteproc: qcom: pas: secondary shutdown errors lost in
  qcom_pas_stop()
- [Medium] remoteproc: qcom: pas: firmware leak after qcom_pas_load() on
  start error
--

commit 3641ec429dbae3576cd54c539314ea4edd45ce32
Author: Anvesh Jain P <anvesh.p@oss.qualcomm.com>

remoteproc: qcom: pas: Add Glymur OOBMSS PAS parameters

This commit adds PAS resource parameters and the qcom,glymur-oobmss-pas
compatible entry for the OOBMSS subsystem on Glymur platforms.

> diff --git a/drivers/remoteproc/qcom_q6v5_pas.c b/drivers/remoteproc/qcom_q6v5_pas.c
> index a167bd6072c94..5cc529e2923ca 100644
> --- a/drivers/remoteproc/qcom_q6v5_pas.c
> +++ b/drivers/remoteproc/qcom_q6v5_pas.c
> @@ -2182,6 +2182,30 @@ static const struct qcom_pas_data kaanapali_soccp_resource = {
>  	.early_boot = true,
>  };
>  
> +static const struct qcom_pas_data glymur_oobmss_resource = {
> +	.crash_reason_smem = 669,
> +	.firmware_name = "oobmss_tee.mbn",
> +	.dtb_firmware_name = "oobmss_qc_dtb.mbn",
> +	.secondary_firmware_name = "oobmss_ns.mbn",
> +	.secondary_dtb_firmware_name = "oobmss_oem_dtb.mbn",
> +	.pas_id = 0x42,
> +	.dtb_pas_id = 0x43,
> +	.secondary_pas_id = 0x44,
> +	.secondary_dtb_pas_id = 0x45,

[Severity: Medium]
Can this leak pas->secondary_dtb_firmware, pas->secondary_firmware and
pas->dtb_firmware if starting the remoteproc fails after qcom_pas_load()
succeeds?

qcom_pas_load() requests all three firmware blobs, while
qcom_pas_release_firmware() is only called from qcom_pas_start() on
success or under its disable_irqs error label.  If
rproc_prepare_subdevices() fails in rproc_start() before calling
qcom_pas_start(), rproc_fw_boot() unwinds through qcom_pas_unprepare(),
which releases metadata contexts without calling
qcom_pas_release_firmware().  In addition, if qcom_q6v5_prepare() fails at
the start of qcom_pas_start(), it returns early before disable_irqs,
leaking the three struct firmware allocations and leaving pas->firmware
dangling:

drivers/remoteproc/qcom_q6v5_pas.c:qcom_pas_start() {
	...
	ret = qcom_q6v5_prepare(&pas->q6v5);
	if (ret)
		return ret;
	...
disable_irqs:
	qcom_q6v5_unprepare(&pas->q6v5);
	qcom_pas_release_firmware(pas);
	...
}

> +	.proxy_pd_names = (char *[]){
> +		"cx",
> +		"mx",
> +		NULL
> +	},
> +	.ssr_name = "oobmss",
> +	.sysmon_name = "oobmss",
> +	.ssctl_id = 0x21,
> +	.auto_boot = true,
> +	.early_boot = true,

[Severity: Medium]
How are coredump segments handled across attach and crash recovery when
both secondary_pas_id and early_boot are enabled?

Primary dump segments are registered in qcom_pas_parse_firmware()
(rproc->ops->parse_fw), whereas secondary dump segments are registered in
qcom_pas_load() (rproc->ops->load):

drivers/remoteproc/qcom_q6v5_pas.c:qcom_pas_load() {
	...
	if (pas->secondary_pas_id) {
		ret = qcom_register_dump_segments(rproc, pas->secondary_firmware);
	...
}

With early_boot set, qcom_pas_probe() starts in RPROC_DETACHED and
rproc_boot() attaches via rproc_attach() -> qcom_pas_attach() without
calling parse_fw or load, leaving rproc->dump_segments empty so
qcom_pas_coredump() skips dumping on the first crash.  During recovery,
rproc_boot_recovery() runs rproc_start() -> rproc_load_segments() ->
qcom_pas_load() without calling rproc_resource_cleanup() or
rproc_parse_fw().  As a result, primary dump segments are still missing
after recovery from early_boot attach, and each subsequent crash recovery
appends another duplicate set of secondary dump segments to
rproc->dump_segments.

> +	.needs_tzmem = true,
> +	.decrypt_shutdown = true,
> +};

[Severity: Medium]
Does qcom_pas_stop() discard shutdown errors from pas->secondary_pas_id
and pas->secondary_dtb_pas_id?

Unlike the pas->dtb_pas_id block, which saves its status in dtb_ret and
preserves an earlier error, qcom_pas_stop() reuses ret and unconditionally
overwrites it when shutting down pas->secondary_dtb_pas_id and
pas->pas_id:

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 (pas->secondary_dtb_pas_id) {
		ret = qcom_pas_shutdown(pas->secondary_dtb_pas_id);
		...
	}

	ret = qcom_pas_shutdown(pas->pas_id);
	...
}

If shutting down secondary_pas_id or secondary_dtb_pas_id fails while
pas_id and dtb_pas_id succeed, qcom_pas_stop() returns 0.  During
rproc_boot_recovery(), a masked stop failure lets execution continue into
qcom_pas_coredump(), which maps pas->secondary_pas_ctx and reads
pas->secondary_mem_region even though the secondary PAS shutdown failed.

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

      reply	other threads:[~2026-11-18 16:24 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
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 [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=sashiko-outbox-221469@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.