All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Fuad Tabba" <fuad.tabba@linux.dev>
Cc: "Oliver Upton" <oupton@kernel.org>,
	"Marc Zyngier" <maz@kernel.org>,
	kvmarm@lists.linux.dev
Subject: Re: [PATCH] KVM: arm64: Reject the stage-2 MMU pointer hypercalls under pKVM
Date: Mon, 14 Sep 2026 17:58:31 +0000	[thread overview]
Message-ID: <20260914175832.2A2D91F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260914174521.832575-1-fuad.tabba@linux.dev>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [Critical] Hypercall handlers `handle___kvm_adjust_pc`, `handle___vgic_v5_save_apr`, and `handle___vgic_v5_restore_vmcr_apr` dereference host-provided pointers via `kern_hyp_va()` without validation, allowing a malicious host to corrupt EL2-private memory under pKVM.
--

commit 6af3790e411879ef8c99b26ae2afdc619730e489
Author: Fuad Tabba <fuad.tabba@linux.dev>

KVM: arm64: Reject the stage-2 MMU pointer hypercalls under pKVM

This patch updates five stage-2 MMU pointer hypercalls to reject execution when
pKVM is enabled. It adds an is_protected_kvm_enabled() check to prevent
invalid execution paths.

Link: https://lore.kernel.org/all/20260914130152.F0D5F1F000FF@smtp.kernel.org/

> diff --git a/arch/arm64/kvm/hyp/nvhe/hyp-main.c b/arch/arm64/kvm/hyp/nvhe/hyp-main.c
> index 9a3b92e626adb..4b0d00e55e2ea 100644
> --- a/arch/arm64/kvm/hyp/nvhe/hyp-main.c
> +++ b/arch/arm64/kvm/hyp/nvhe/hyp-main.c

[ ... ]

arch/arm64/kvm/hyp/nvhe/hyp-main.c:handle___kvm_adjust_pc() {
	DECLARE_REG(struct kvm_vcpu *, vcpu, host_ctxt, 1);

	__kvm_adjust_pc(kern_hyp_va(vcpu));
}

[Severity: Critical]
This is a pre-existing issue, but does this code allow a malicious host to
corrupt EL2-private memory?

The unvalidated host pointer vcpu is passed directly to __kvm_adjust_pc
which mutates it. An untrusted host could invoke the
__KVM_HOST_SMCCC_FUNC___kvm_adjust_pc hypercall with a crafted pointer (e.g.,
an EL2 private-memory pointer which is idempotent under kern_hyp_va()). The
handler handle___kvm_adjust_pc directly passes this unvalidated pointer to the
underlying function, which dereferences it. This could allow the host to
overwrite arbitrary EL2 memory or leak its contents into system registers.

arch/arm64/kvm/hyp/nvhe/hyp-main.c:handle___vgic_v5_save_apr() {
	DECLARE_REG(struct vgic_v5_cpu_if *, cpu_if, host_ctxt, 1);

	__vgic_v5_save_apr(kern_hyp_va(cpu_if));
}

arch/arm64/kvm/hyp/nvhe/hyp-main.c:handle___vgic_v5_restore_vmcr_apr() {
	DECLARE_REG(struct vgic_v5_cpu_if *, cpu_if, host_ctxt, 1);

	__vgic_v5_restore_vmcr_apr(kern_hyp_va(cpu_if));
}

[Severity: Critical]
This is a pre-existing issue, but can these handlers corrupt EL2 memory under
pKVM?

Similar to the above, the unvalidated host pointer cpu_if is dereferenced and
written to by __vgic_v5_save_apr and __vgic_v5_restore_vmcr_apr. An
untrusted host could invoke the corresponding hypercalls with a crafted pointer,
allowing a malicious host to corrupt EL2-private memory.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260914174521.832575-1-fuad.tabba@linux.dev?part=1

  reply	other threads:[~2026-09-14 17:58 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-14 17:45 [PATCH] KVM: arm64: Reject the stage-2 MMU pointer hypercalls under pKVM Fuad Tabba
2026-09-14 17:58 ` sashiko-bot [this message]
2026-09-14 18:11   ` Fuad Tabba
2026-09-15  9:20     ` Marc Zyngier
2026-09-15  9:24 ` Marc Zyngier
2026-09-15  9:30   ` 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=20260914175832.2A2D91F000FF@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.