From: sashiko-bot@kernel.org
To: "Sebastian Ene" <sebastianene@google.com>
Cc: kvmarm@lists.linux.dev, "Oliver Upton" <oupton@kernel.org>,
"Marc Zyngier" <maz@kernel.org>
Subject: Re: [PATCH v9 6/6] KVM: arm64: Zero out the stack initialized data in the FFA handler
Date: Thu, 02 Jul 2026 10:48:46 +0000 [thread overview]
Message-ID: <20260702104846.F157E1F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <20260702103848.1647249-7-sebastianene@google.com>
Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
Pre-existing issues:
- [High] EL2 silently accepts a downgrade response from EL3 and incorrectly uses the host's requested version as the negotiated version, leading to version desynchronization.
- [Medium] Host can trigger a reliable EL2 hypervisor panic (Denial of Service) by passing a fake handle to FFA_MEM_FRAG_TX alongside an invalid PFN during rollback.
- [Medium] Optional FF-A 1.1/1.2 interfaces not implemented by pKVM are not masked in `FFA_FEATURES` queries, allowing them to be passed through to EL3.
--
commit 04220564e97901b7aa4aa40ada1444ec9b7ccea7
Author: Sebastian Ene <sebastianene@google.com>
KVM: arm64: Zero out the stack initialized data in the FFA handler
This commit initializes the arm_smccc_1_2_regs structure with zeros in
kvm_host_ffa_handler to prevent leaking hypervisor stack data.
Link: https://lore.kernel.org/all/20260616160016.C62C81F000E9@smtp.kernel.org/
> diff --git a/arch/arm64/kvm/hyp/nvhe/ffa.c b/arch/arm64/kvm/hyp/nvhe/ffa.c
> index 9c96e72e522e5..a327c2bbb6b64 100644
> --- a/arch/arm64/kvm/hyp/nvhe/ffa.c
> +++ b/arch/arm64/kvm/hyp/nvhe/ffa.c
> @@ -880,7 +880,7 @@ static void do_ffa_part_get(struct arm_smccc_1_2_regs *res,
>
> bool kvm_host_ffa_handler(struct kvm_cpu_context *host_ctxt, u32 func_id)
> {
> - struct arm_smccc_1_2_regs res;
> + struct arm_smccc_1_2_regs res = {0};
While reviewing this code, I noticed a few pre-existing issues in the same
file.
arch/arm64/kvm/hyp/nvhe/ffa.c:do_ffa_version() {
...
hyp_smccc_1_2_smc(&(struct arm_smccc_1_2_regs) {
.a0 = FFA_VERSION,
.a1 = ffa_req_version,
}, res);
if ((s32)res->a0 == FFA_RET_NOT_SUPPORTED)
goto unlock;
hyp_ffa_version = ffa_req_version;
...
}
[Severity: High]
This is a pre-existing issue, but does EL2 silently accept a downgrade
response from EL3 here and incorrectly use the host's requested version as
the negotiated version?
If EL3 accepts but returns an even lower version in res->a0, EL2 ignores it
and sets hyp_ffa_version = ffa_req_version.
Could this version desynchronization between EL2 and EL3 lead to mismatched
memory descriptor parsing and break guest isolation?
arch/arm64/kvm/hyp/nvhe/ffa.c:do_ffa_mem_frag_tx() {
...
ret = ffa_host_share_ranges(buf, nr_ranges);
if (ret) {
/*
* We're effectively aborting the transaction, so we need
* to restore the global state back to what it was prior to
* transmission of the first fragment.
*/
ffa_mem_reclaim(res, handle_lo, handle_hi, 0);
WARN_ON(res->a0 != FFA_SUCCESS);
goto out_unlock;
}
...
}
[Severity: Medium]
This isn't a bug introduced by this patch, but can the host trigger a
reliable EL2 hypervisor panic here?
If the host provides an invalid memory range, ffa_host_share_ranges() fails.
In the rollback path, if the host also provided an unauthorized or fake
handle_lo or handle_hi, EL3 rejects the reclaim and returns an error.
Does this cause EL2 to hit the WARN_ON(res->a0 != FFA_SUCCESS), which expands
to a fatal BUG() and causes a denial of service?
arch/arm64/kvm/hyp/nvhe/ffa.c:ffa_call_supported() {
...
/* Optional notification interfaces added in FF-A 1.1 */
case FFA_NOTIFICATION_BITMAP_CREATE:
...
case FFA_PARTITION_INFO_GET_REGS:
return false;
}
return true;
}
arch/arm64/kvm/hyp/nvhe/ffa.c:do_ffa_features() {
...
switch (id) {
case FFA_MEM_SHARE:
...
goto out_handled;
default:
return false;
}
...
}
[Severity: Medium]
This is a pre-existing issue, but are we missing masking for optional
FF-A 1.1/1.2 interfaces not implemented by pKVM?
ffa_call_supported() omits several optional interfaces such as
FFA_FN64_NOTIFICATION_INFO_GET and FFA_MSG_SEND2, returning true for them.
Then in do_ffa_features(), it returns false for these unhandled queries,
causing kvm_host_ffa_handler() to forward the query to EL3.
Could this incorrectly advertise optional FF-A features to the host that the
hypervisor does not actually implement?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260702103848.1647249-1-sebastianene@google.com?part=6
next prev parent reply other threads:[~2026-07-02 10:48 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-02 10:38 [PATCH v9 0/6] arm_ffa, KVM: Fix FF-A emad offset calculations Sebastian Ene via OP-TEE
2026-07-02 10:38 ` Sebastian Ene
2026-07-02 10:38 ` [PATCH v9 1/6] firmware: arm_ffa: Fix out-of-bound writes in ffa_setup_and_transmit() Sebastian Ene
2026-07-02 10:38 ` Sebastian Ene via OP-TEE
2026-07-02 10:38 ` [PATCH v9 2/6] firmware: arm_ffa: Fix Endpoint Memory Access Descriptor offset calculation Sebastian Ene
2026-07-02 10:38 ` Sebastian Ene via OP-TEE
2026-07-02 10:38 ` [PATCH v9 3/6] KVM: arm64: Fix bounds checking in do_ffa_mem_reclaim() Sebastian Ene
2026-07-02 10:38 ` Sebastian Ene via OP-TEE
2026-07-02 10:38 ` [PATCH v9 4/6] KVM: arm64: Validate the offset to the mem access descriptor Sebastian Ene
2026-07-02 10:38 ` Sebastian Ene via OP-TEE
2026-07-03 10:35 ` Vincent Donnefort via OP-TEE
2026-07-03 10:35 ` Vincent Donnefort
2026-07-02 10:38 ` [PATCH v9 5/6] KVM: arm64: Ensure FFA ranges are page aligned Sebastian Ene
2026-07-02 10:38 ` Sebastian Ene via OP-TEE
2026-07-02 10:38 ` [PATCH v9 6/6] KVM: arm64: Zero out the stack initialized data in the FFA handler Sebastian Ene
2026-07-02 10:38 ` Sebastian Ene via OP-TEE
2026-07-02 10:48 ` sashiko-bot [this message]
2026-07-07 10:58 ` (subset) [PATCH v9 0/6] arm_ffa, KVM: Fix FF-A emad offset calculations Marc Zyngier
2026-07-07 10:58 ` Marc Zyngier via OP-TEE
2026-07-07 11:56 ` Will Deacon
2026-07-07 11:56 ` Will Deacon via OP-TEE
2026-07-07 14:03 ` Marc Zyngier
2026-07-07 14:03 ` Marc Zyngier via OP-TEE
2026-07-07 14:04 ` Marc Zyngier
2026-07-07 14:04 ` Marc Zyngier via OP-TEE
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=20260702104846.F157E1F00A3A@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 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.