From: sashiko-bot@kernel.org
To: "Sebastian Ene" <sebastianene@google.com>
Cc: "Marc Zyngier" <maz@kernel.org>,
kvmarm@lists.linux.dev, "Oliver Upton" <oupton@kernel.org>
Subject: Re: [PATCH v5 1/7] KVM: arm64: Enforce strict SBZ checks in the FF-A proxy
Date: Tue, 23 Jun 2026 12:06:59 +0000 [thread overview]
Message-ID: <20260623120700.1356B1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260623115354.632361-2-sebastianene@google.com>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] The strict SBZ check for unused arguments does not ignore the upper 32 bits for SMC32 calls, violating the SMCCC and FF-A specifications.
- [Medium] The FFA_FEATURES handler incorrectly returns FFA_RET_INVALID_PARAMETERS instead of FFA_RET_NOT_SUPPORTED when unused arguments are non-zero.
--
commit d261b7516c8a6d707698f336a32184a5de586911
Author: Sebastian Ene <sebastianene@google.com>
KVM: arm64: Enforce strict SBZ checks in the FF-A proxy
Introduce a helper method ffa_check_unused_args_sbz to enforce strict
arguments checking when the hypervisor acts as a relayer between the
host and Trustzone.
> diff --git a/arch/arm64/kvm/hyp/nvhe/ffa.c b/arch/arm64/kvm/hyp/nvhe/ffa.c
> index 1af722771178a..78bb043b33ee0 100644
> --- a/arch/arm64/kvm/hyp/nvhe/ffa.c
> +++ b/arch/arm64/kvm/hyp/nvhe/ffa.c
> @@ -71,6 +71,20 @@ static u32 hyp_ffa_version;
> static bool has_version_negotiated;
> static hyp_spinlock_t version_lock;
>
> +static bool ffa_check_unused_args_sbz(struct kvm_cpu_context *ctxt, int first_reg)
> +{
> + DECLARE_REG(u32, func_id, ctxt, 0);
> + int reg, end_reg;
> +
> + end_reg = ARM_SMCCC_IS_64(func_id) ? 17 : 7;
> + for (reg = first_reg; reg <= end_reg; reg++) {
> + if (cpu_reg(ctxt, reg))
[Severity: High]
Does this correctly handle the upper 32 bits for SMC32 calls?
According to the SMCCC, for SMC32 calls, the upper 32 bits of X registers are
unknown, and the host is not required to clear them. Since cpu_reg() returns
the full 64-bit register value, this might erroneously reject valid host FF-A
SMC32 calls if there is residual data in the upper 32 bits.
> + return true;
> + }
> +
> + return false;
> +}
[ ... ]
> @@ -890,6 +939,11 @@ bool kvm_host_ffa_handler(struct kvm_cpu_context *host_ctxt, u32 func_id)
>
> switch (func_id) {
> case FFA_FEATURES:
> + if (ffa_check_unused_args_sbz(host_ctxt, 3)) {
> + ffa_to_smccc_res(&res, FFA_RET_INVALID_PARAMETERS);
[Severity: Medium]
Should this return FFA_RET_NOT_SUPPORTED instead?
According to the FF-A specification, if an unused parameter is non-zero in an
FFA_FEATURES call, the implementation must return FFA_RET_NOT_SUPPORTED.
Returning FFA_RET_INVALID_PARAMETERS might violate the FF-A ABI and confuse the
host driver during capability negotiation.
> + goto out_handled;
> + }
> +
> if (!do_ffa_features(&res, host_ctxt))
> return false;
> goto out_handled;
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260623115354.632361-1-sebastianene@google.com?part=1
next prev parent reply other threads:[~2026-06-23 12:07 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-23 11:53 [PATCH v5 0/7] KVM: arm64: Forward FFA_NOTIFICATION* calls to TrustZone Sebastian Ene
2026-06-23 11:53 ` [PATCH v5 1/7] KVM: arm64: Enforce strict SBZ checks in the FF-A proxy Sebastian Ene
2026-06-23 12:06 ` sashiko-bot [this message]
2026-06-25 13:16 ` Will Deacon
2026-06-26 7:48 ` Sebastian Ene
2026-06-23 11:53 ` [PATCH v5 2/7] KVM: arm64: Forward FFA_NOTIFICATION_BITMAP calls to Trustzone Sebastian Ene
2026-06-23 11:53 ` [PATCH v5 3/7] KVM: arm64: Support FFA_NOTIFICATION_BIND in host handler Sebastian Ene
2026-06-23 12:07 ` sashiko-bot
2026-06-23 11:53 ` [PATCH v5 4/7] KVM: arm64: Support FFA_NOTIFICATION_UNBIND " Sebastian Ene
2026-06-23 12:05 ` sashiko-bot
2026-06-23 11:53 ` [PATCH v5 5/7] KVM: arm64: Support FFA_NOTIFICATION_SET " Sebastian Ene
2026-06-23 12:01 ` sashiko-bot
2026-06-23 11:53 ` [PATCH v5 6/7] KVM: arm64: Support FFA_NOTIFICATION_GET " Sebastian Ene
2026-06-23 11:53 ` [PATCH v5 7/7] KVM: arm64: Support FFA_NOTIFICATION_INFO_GET " Sebastian Ene
2026-06-23 12:07 ` 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=20260623120700.1356B1F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=kvmarm@lists.linux.dev \
--cc=maz@kernel.org \
--cc=oupton@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=sebastianene@google.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