All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Sebastian Ene" <sebastianene@google.com>
Cc: "Oliver Upton" <oupton@kernel.org>,
	kvmarm@lists.linux.dev, "Marc Zyngier" <maz@kernel.org>
Subject: Re: [PATCH v6 5/7] KVM: arm64: Support FFA_NOTIFICATION_GET in host handler
Date: Fri, 26 Jun 2026 07:59:14 +0000	[thread overview]
Message-ID: <20260626075914.970411F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260626074545.433234-6-sebastianene@google.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] `do_ffa_notif_set` fails to validate the upper 16 bits of the flags parameter, violating the MBZ requirement before proxying the call to TrustZone.
--

commit dc6778bf3607c00222a50fb85f58ca74257482ea
Author: Sebastian Ene <sebastianene@google.com>

KVM: arm64: Support FFA_NOTIFICATION_GET in host handler

Allow FF-A notification GET messages to be proxied from the pKVM
hypervisor to Trustzone and verify the arguments sent from the host
driver.

> diff --git a/arch/arm64/kvm/hyp/nvhe/ffa.c b/arch/arm64/kvm/hyp/nvhe/ffa.c
> index 2bb16aa414f9f..c22fe45147414 100644
> --- a/arch/arm64/kvm/hyp/nvhe/ffa.c
> +++ b/arch/arm64/kvm/hyp/nvhe/ffa.c
[ ... ]
> @@ -938,6 +937,27 @@ static void do_ffa_notif_set(struct arm_smccc_1_2_regs *res,
>  	hyp_smccc_1_2_smc(args, res);
>  }

[Severity: Medium]
This is a pre-existing issue, but looking at do_ffa_notif_set() just above
this diff, it uses GENMASK(15, 2) to validate the flags parameter:

arch/arm64/kvm/hyp/nvhe/ffa.c:do_ffa_notif_set() {
    ...
	if (flags & GENMASK(15, 2)) {
		ffa_to_smccc_res(res, FFA_RET_INVALID_PARAMETERS);
		return;
	}
    ...
}

Does this fail to validate the upper 16 bits of the flags parameter?

The FF-A 1.1 specification defines bits [31:2] of the flags parameter (W2)
in FFA_NOTIFICATION_SET as Reserved (Must Be Zero).

By using GENMASK(15, 2), the validation logic only checks if bits 2 through 15
are zero, ignoring bits 16 through 31. This allows unvalidated, non-zero
reserved bits to bypass the strict MBZ checks and be forwarded to EL3.

>  
> +static void do_ffa_notif_get(struct arm_smccc_1_2_regs *res,
> +			     struct kvm_cpu_context *ctxt)
[ ... ]

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260626074545.433234-1-sebastianene@google.com?part=5

  reply	other threads:[~2026-06-26  7:59 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-26  7:45 [PATCH v6 0/7] KVM: arm64: Forward FFA_NOTIFICATION* calls to TrustZone Sebastian Ene
2026-06-26  7:45 ` [PATCH v6 1/7] KVM: arm64: Forward FFA_NOTIFICATION_BITMAP calls to Trustzone Sebastian Ene
2026-06-26  7:45 ` [PATCH v6 2/7] KVM: arm64: Support FFA_NOTIFICATION_BIND in host handler Sebastian Ene
2026-06-26  7:45 ` [PATCH v6 3/7] KVM: arm64: Support FFA_NOTIFICATION_UNBIND " Sebastian Ene
2026-06-26  7:45 ` [PATCH v6 4/7] KVM: arm64: Support FFA_NOTIFICATION_SET " Sebastian Ene
2026-06-26  7:55   ` sashiko-bot
2026-06-26  7:45 ` [PATCH v6 5/7] KVM: arm64: Support FFA_NOTIFICATION_GET " Sebastian Ene
2026-06-26  7:59   ` sashiko-bot [this message]
2026-06-26  7:45 ` [PATCH v6 6/7] KVM: arm64: Support FFA_NOTIFICATION_INFO_GET " Sebastian Ene
2026-06-26  7:45 ` [PATCH v6 7/7] KVM: arm64: Enforce strict SBZ checks in the FF-A proxy Sebastian Ene
2026-06-26  7:56   ` sashiko-bot
2026-06-26  9:11   ` Will Deacon
2026-06-26  9:24     ` Sebastian Ene
2026-06-26 10:55       ` Will Deacon

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=20260626075914.970411F000E9@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.