From: sashiko-bot@kernel.org
To: "Fuad Tabba" <fuad.tabba@linux.dev>
Cc: kvmarm@lists.linux.dev, "Oliver Upton" <oupton@kernel.org>,
"Marc Zyngier" <maz@kernel.org>
Subject: Re: [PATCH v1 10/11] KVM: arm64: nVHE: Check hypercall handlers against the declared ABI
Date: Mon, 20 Jul 2026 17:42:29 +0000 [thread overview]
Message-ID: <20260720174229.DF3AB1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260720162412.1401272-1-fuad.tabba@linux.dev>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
Pre-existing issues:
- [Critical] The MDCR_EL2 trap configuration register is unconditionally copied from the untrusted host VCPU on every guest entry, violating pKVM isolation guarantees for protected VMs.
- [Critical] The protected VM's register context (`ctxt`) is copied back to the untrusted host VCPU on every exit, leaking confidential guest state.
--
--- Patch [10]: [PATCH v1 10/11] KVM: arm64: nVHE: Check hypercall handlers against the declared ABI ---
commit 3f8ed457b3a7f1b8aabe10f15d93afe4df7e93a2
Author: Fuad Tabba <fuad.tabba@linux.dev>
KVM: arm64: nVHE: Check hypercall handlers against the declared ABI
This commit generates the unmarshalling of hypercall handlers using
DEFINE_KVM_HOST_HCALL. It checks the handler's parameter list against the
signature declared in kvm_hcall.h to prevent caller/handler disagreements.
Manual DECLARE_REG casts are removed from the handler bodies.
> diff --git a/arch/arm64/kvm/hyp/nvhe/hyp-main.c b/arch/arm64/kvm/hyp/nvhe/hyp-main.c
> --- a/arch/arm64/kvm/hyp/nvhe/hyp-main.c
> +++ b/arch/arm64/kvm/hyp/nvhe/hyp-main.c
[ ... ]
> @@ -228,15 +282,11 @@ static void handle___kvm_vcpu_run(struct kvm_cpu_context *host_ctxt)
> * loading a vcpu. Therefore, if SME features enabled the host
> * is misbehaving.
> */
> - if (unlikely(system_supports_sme() && read_sysreg_s(SYS_SVCR))) {
> - ret = -EINVAL;
> - goto out;
> - }
> + if (unlikely(system_supports_sme() && read_sysreg_s(SYS_SVCR)))
> + return -EINVAL;
>
> - if (!hyp_vcpu) {
> - ret = -EINVAL;
> - goto out;
> - }
> + if (!hyp_vcpu)
> + return -EINVAL;
>
> flush_hyp_vcpu(hyp_vcpu);
[Severity: Critical]
This is a pre-existing issue, but does this function allow the untrusted
host to bypass pKVM isolation guarantees?
Looking at flush_hyp_vcpu() in arch/arm64/kvm/hyp/nvhe/hyp-main.c, the
MDCR_EL2 trap configuration is copied unconditionally from the untrusted
host vCPU on every guest entry:
hyp_vcpu->vcpu.arch.mdcr_el2 = host_vcpu->arch.mdcr_el2;
For a protected VM, the MDCR_EL2 trap configuration should be strictly
EL2-private and initialized internally. By syncing this from the host on
every entry, could the host maliciously reconfigure the guest's debug
traps?
[Severity: Critical]
This is also a pre-existing issue, but does the exit path leak
confidential guest execution state to the host?
In the corresponding sync_hyp_vcpu() function called after the guest
run, the protected VM's register context is copied back to the host
vCPU:
host_vcpu->arch.ctxt = hyp_vcpu->vcpu.arch.ctxt;
Since this copies the hypervisor's private copy of the guest's context
back into the host-controlled structure, won't this allow the host EL1
to directly inspect highly confidential execution state (including
general purpose registers and system registers) after the hypercall
returns?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260720162412.1401272-1-fuad.tabba@linux.dev?part=10
next prev parent reply other threads:[~2026-07-20 17:42 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-20 16:13 [PATCH v1 00/11] KVM: arm64: Restore type-checking across the host/hyp hypercall boundary Fuad Tabba
2026-07-20 16:13 ` [PATCH v1 01/11] tracing: Include linux/types.h in trace_remote_event.h Fuad Tabba
2026-07-20 18:32 ` Steven Rostedt
2026-07-20 16:13 ` [PATCH v1 02/11] KVM: arm64: nVHE: Share the stacktrace per-CPU declarations with EL2 Fuad Tabba
2026-07-20 16:13 ` [PATCH v1 03/11] KVM: arm64: nVHE: Declare the hyp event IDs before defining them Fuad Tabba
2026-07-20 16:13 ` [PATCH v1 04/11] KVM: arm64: nVHE: Use NULL to reset the trace buffer backing pointer Fuad Tabba
2026-07-20 16:13 ` [PATCH v1 05/11] KVM: arm64: nVHE: Run the source checker under C=2 Fuad Tabba
2026-07-20 16:13 ` [PATCH v1 06/11] arm64: pi: Run the source checker on the libfdt objects " Fuad Tabba
2026-07-20 16:13 ` [PATCH v1 07/11] KVM: arm64: nVHE: Pass host VA arguments as pointers Fuad Tabba
2026-07-20 16:13 ` [PATCH v1 08/11] KVM: arm64: Move the host hypercall interface to its own header Fuad Tabba
2026-07-20 16:13 ` [PATCH v1 09/11] KVM: arm64: Type-check hypercall arguments at the caller Fuad Tabba
2026-07-20 17:29 ` sashiko-bot
2026-07-20 17:59 ` Fuad Tabba
2026-07-20 16:24 ` [PATCH v1 10/11] KVM: arm64: nVHE: Check hypercall handlers against the declared ABI Fuad Tabba
2026-07-20 16:24 ` [PATCH v1 11/11] KVM: arm64: Tag host-VA hypercall parameters __hostva Fuad Tabba
2026-07-20 17:55 ` sashiko-bot
2026-07-20 18:24 ` Fuad Tabba
2026-07-20 17:42 ` sashiko-bot [this message]
2026-07-20 18:01 ` [PATCH v1 10/11] KVM: arm64: nVHE: Check hypercall handlers against the declared ABI Fuad Tabba
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=20260720174229.DF3AB1F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=fuad.tabba@linux.dev \
--cc=kvmarm@lists.linux.dev \
--cc=maz@kernel.org \
--cc=oupton@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.