From: sashiko-bot@kernel.org
To: "Steven Price" <steven.price@arm.com>
Cc: kvm@vger.kernel.org, "Oliver Upton" <oupton@kernel.org>,
kvmarm@lists.linux.dev, "Marc Zyngier" <maz@kernel.org>
Subject: Re: [PATCH 2/6] firmware: arm_rmm: Add wrappers for direct RMI calls
Date: Wed, 15 Jul 2026 14:49:14 +0000 [thread overview]
Message-ID: <20260715144915.5771F1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260715142739.80398-3-steven.price@arm.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Uninitialized stack variable read in `rmi_granule_tracking_get` and `rmi_features` on systems without SMCCC conduit.
--
--- Patch [2]: [PATCH 2/6] firmware: arm_rmm: Add wrappers for direct RMI calls ---
commit 429eeeda61aa453a82790a92c189fa7325a46943
Author: Steven Price <steven.price@arm.com>
firmware: arm_rmm: Add wrappers for direct RMI calls
This commit adds inline wrapper functions for direct RMI calls to the Realm
Management Monitor (RMM) via SMCCC, dealing with boilerplate and return codes.
> diff --git a/include/linux/arm-rmi-cmds.h b/include/linux/arm-rmi-cmds.h
> new file mode 100644
> index 0000000000000..c038c1d685fad
> --- /dev/null
> +++ b/include/linux/arm-rmi-cmds.h
[ ... ]
> +static inline int rmi_granule_tracking_get(unsigned long start,
> + unsigned long end,
> + unsigned long *out_category,
> + unsigned long *out_state,
> + unsigned long *out_top)
> +{
> + struct arm_smccc_res res;
> +
> + arm_smccc_1_1_invoke(SMC_RMI_GRANULE_TRACKING_GET, start, end, &res);
> +
> + if (out_category)
> + *out_category = res.a1;
> + if (out_state)
> + *out_state = res.a2;
> + if (out_top)
> + *out_top = res.a3;
[Severity: Medium]
Could this copy uninitialized stack memory into the caller's output pointers
if the SMCCC conduit is unavailable?
When arm_smccc_1_1_invoke is executed on a platform without an active
conduit, it falls back to __fail_smccc_1_1():
include/linux/arm-smccc.h:arm_smccc_1_1_invoke() {
...
default:
__fail_smccc_1_1(__VA_ARGS__);
method = SMCCC_CONDUIT_NONE;
break;
...
}
This fallback only initializes res.a0 to SMCCC_RET_NOT_SUPPORTED, leaving
res.a1, res.a2, and res.a3 completely uninitialized.
Because these values are read unconditionally here, this could trigger KMSAN
warnings or leak stack garbage into the output pointers. Should these
assignments be gated behind a check that res.a0 == RMI_SUCCESS?
> +
> + return res.a0;
> +}
[ ... ]
> +static inline int rmi_features(unsigned long index, unsigned long *out)
> +{
> + struct arm_smccc_res res;
> +
> + arm_smccc_1_1_invoke(SMC_RMI_FEATURES, index, &res);
> +
> + if (out)
> + *out = res.a1;
[Severity: Medium]
Does this have the same uninitialized memory read issue when the SMCCC
conduit is not supported?
> + return res.a0;
> +}
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260715142739.80398-1-steven.price@arm.com?part=2
next prev parent reply other threads:[~2026-07-15 14:49 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-15 14:27 [PATCH 0/6] firmware: arm_rmm: Add RMM v2.0 support Steven Price
2026-07-15 14:27 ` [PATCH 1/6] firmware: arm_rmm: Add SMC definitions for calling the RMM Steven Price
2026-07-15 14:38 ` sashiko-bot
2026-07-16 10:59 ` Steven Price
2026-07-15 14:27 ` [PATCH 2/6] firmware: arm_rmm: Add wrappers for direct RMI calls Steven Price
2026-07-15 14:49 ` sashiko-bot [this message]
2026-07-16 14:28 ` Steven Price
2026-07-15 14:27 ` [PATCH 3/6] firmware: arm_rmm: Check for RMI support at init Steven Price
2026-07-15 15:06 ` sashiko-bot
2026-07-16 14:28 ` Steven Price
2026-07-15 14:27 ` [PATCH 4/6] firmware: arm_rmm: Configure the RMM with the host's page size Steven Price
2026-07-15 15:18 ` sashiko-bot
2026-07-16 15:41 ` Steven Price
2026-07-15 14:27 ` [PATCH 5/6] firmware: arm_rmm: Add support for SRO Steven Price
2026-07-15 15:29 ` sashiko-bot
2026-07-16 16:04 ` Steven Price
2026-07-15 14:27 ` [PATCH 6/6] firmware: arm_rmm: Ensure the RMM has GPT entries for memory Steven Price
2026-07-15 15:47 ` 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=20260715144915.5771F1F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=kvm@vger.kernel.org \
--cc=kvmarm@lists.linux.dev \
--cc=maz@kernel.org \
--cc=oupton@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=steven.price@arm.com \
/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