Kernel KVM virtualization development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Suzuki K Poulose" <suzuki.poulose@arm.com>
Cc: "Oliver Upton" <oupton@kernel.org>,
	"Marc Zyngier" <maz@kernel.org>,
	kvmarm@lists.linux.dev, kvm@vger.kernel.org
Subject: Re: [PATCH v18 20/23] KVM: arm64: CCA: Don't expose unsupported capabilities for realm guests
Date: Tue, 15 Sep 2026 16:43:46 +0000	[thread overview]
Message-ID: <20260915164346.D49711F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260915160141.3543048-21-suzuki.poulose@arm.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] kvm: host Denial of Service via WARN_ON_ONCE in kvm_arch_vm_ioctl_allowed()
--

commit f9fdb12a2363dfa41ace289596ec2d2bd95cde48
Author: Suzuki K Poulose <suzuki.poulose@arm.com>
KVM: arm64: CCA: Don't expose unsupported capabilities for realm guests

This commit limits the capabilities allowed for Realm VMs and blocks
vm_ioctls backed by unsupported capabilities. It introduces generic
capability and ioctl filtering helpers kvm_arch_vm_ext_allowed() and
kvm_arch_vm_ioctl_allowed() to support both pKVM and Realm guests.

> diff --git a/arch/arm64/kvm/arm.c b/arch/arm64/kvm/arm.c
> --- a/arch/arm64/kvm/arm.c
> +++ b/arch/arm64/kvm/arm.c
[ ... ]
> +static inline bool kvm_arch_vm_ioctl_allowed(struct kvm *kvm, unsigned int ioctl)
> +{
> +	long ext;
> +	int r;
> +
> +	r = kvm_get_cap_for_kvm_ioctl(ioctl, &ext);
> +	if (WARN_ON_ONCE(r < 0))
> +		return false;

[Severity: High]
Could this allow an unprivileged host userspace process to crash the host?

When kvm_arch_vm_ioctl() receives an unrecognized or garbage ioctl, 
kvm_get_cap_for_kvm_ioctl() returns a negative value. This evaluates to true
and triggers the WARN_ON_ONCE() here. On systems configured with panic_on_warn
(which is common in production and Android environments), this results in a
kernel panic and a complete host denial of service.

[ ... ]
> @@ -2150,7 +2202,7 @@ int kvm_arch_vm_ioctl(struct file *filp, unsigned int ioctl, unsigned long arg)
>  	void __user *argp = (void __user *)arg;
>  	struct kvm_device_attr attr;
>  
> -	if (is_protected_kvm_enabled() && !kvm_pkvm_ioctl_allowed(kvm, ioctl))
> +	if (!kvm_arch_vm_ioctl_allowed(kvm, ioctl))
>  		return -EINVAL;

[Severity: High]
Does removing the is_protected_kvm_enabled() check expose the WARN_ON_ONCE()
above to all ARM64 KVM deployments?

Previously, the warning in kvm_pkvm_ioctl_allowed() was strictly guarded by 
is_protected_kvm_enabled(). By unconditionally calling 
kvm_arch_vm_ioctl_allowed() for all VMs, any local user with access to 
/dev/kvm can open a VM file descriptor and issue an unrecognized ioctl to 
trigger the warning. This exposes the panic condition to all ARM64 KVM 
deployments rather than strictly limiting it to pKVM configurations.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260915160141.3543048-1-suzuki.poulose@arm.com?part=20

  reply	other threads:[~2026-09-15 16:43 UTC|newest]

Thread overview: 54+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-15 16:01 [PATCH v18 00/23] KVM: arm64: CCA: Add basic plumbing for Realms Suzuki K Poulose
2026-09-15 16:01 ` [PATCH v18 01/23] KVM: arm64: protected VM: Handle set_one_reg CNTVCT_EL0/CNTPCT_EL0 Suzuki K Poulose
2026-09-15 16:18   ` sashiko-bot
2026-09-15 16:46   ` Marc Zyngier
2026-09-15 17:48     ` Suzuki K Poulose
2026-09-15 21:20       ` Suzuki K Poulose
2026-09-16  8:16         ` Marc Zyngier
2026-09-16  8:27           ` Suzuki K Poulose
2026-09-15 16:01 ` [PATCH v18 02/23] KVM: arm64: Disable Steal time accounting for protected guests Suzuki K Poulose
2026-09-15 16:01 ` [PATCH v18 03/23] KVM: arm64: Include kvm_emulate.h in kvm/arm_psci.h Suzuki K Poulose
2026-09-15 16:01 ` [PATCH v18 04/23] KVM: arm64: Avoid including linux/kvm_host.h in kvm_pgtable.h Suzuki K Poulose
2026-09-15 16:01 ` [PATCH v18 05/23] KVM: arm64: Track the type of VM in kvm_arch Suzuki K Poulose
2026-09-17 11:24   ` Fuad Tabba
2026-09-18  8:59     ` Suzuki K Poulose
2026-09-18  9:14       ` Fuad Tabba
2026-09-18  9:47         ` Suzuki K Poulose
2026-09-15 16:01 ` [PATCH v18 06/23] KVM: arm64: Refactor the vcpu_load to allow for VM specific callbacks Suzuki K Poulose
2026-09-15 16:01 ` [PATCH v18 07/23] KVM: arm64: Add vcpu load/put call backs for flavors Suzuki K Poulose
2026-09-15 16:01 ` [PATCH v18 08/23] KVM: arm64: Reuse kvm_stage2_unmap_range in kvm_unmap_gfn_range Suzuki K Poulose
2026-09-15 16:01 ` [PATCH v18 09/23] KVM: arm64: Add VM specific callback for S2 MMU operations Suzuki K Poulose
2026-09-15 16:01 ` [PATCH v18 10/23] KVM: arm64: Abstract out memory abort handling Suzuki K Poulose
2026-09-15 16:01 ` [PATCH v18 11/23] KVM: arm64: Use kvm_vm_is_unprotected() for !kvm_vm_is_protected() Suzuki K Poulose
2026-09-17 11:47   ` Fuad Tabba
2026-09-17 16:47     ` Suzuki K Poulose
2026-09-15 16:01 ` [PATCH v18 12/23] KVM: arm64: Widen the scope of "protected" VMs Suzuki K Poulose
2026-09-17 11:44   ` Marc Zyngier
2026-09-17 17:06     ` Suzuki K Poulose
2026-09-17 11:51   ` Fuad Tabba
2026-09-17 16:48     ` Suzuki K Poulose
2026-09-17 14:16   ` Joey Gouly
2026-09-15 16:01 ` [PATCH v18 13/23] KVM: arm64: Add a helper for VMs running on hyp that don't trust the host Suzuki K Poulose
2026-09-17 11:55   ` Fuad Tabba
2026-09-15 16:01 ` [PATCH v18 14/23] KVM: arm64: CCA: Add a new mode for supporting Realm guests Suzuki K Poulose
2026-09-15 16:01 ` [PATCH v18 15/23] KVM: arm64: CCA: Add VCPU load/put for Realms Suzuki K Poulose
2026-09-15 16:01 ` [PATCH v18 16/23] KVM: arm64: CCA: Add bare minimal S2 operations for Realm Suzuki K Poulose
2026-09-15 16:01 ` [PATCH v18 17/23] KVM: arm64: CCA: Introduce Realms Suzuki K Poulose
2026-09-15 16:01 ` [PATCH v18 18/23] KVM: arm64: CCA: Mandate VGIC_V3 for Realms Suzuki K Poulose
2026-09-17 12:57   ` Fuad Tabba
2026-09-15 16:01 ` [PATCH v18 19/23] KVM: arm64: CCA: Support timers in realm RECs Suzuki K Poulose
2026-09-15 16:01 ` [PATCH v18 20/23] KVM: arm64: CCA: Don't expose unsupported capabilities for realm guests Suzuki K Poulose
2026-09-15 16:43   ` sashiko-bot [this message]
2026-09-15 17:55     ` Suzuki K Poulose
2026-09-16  8:29       ` Suzuki K Poulose
2026-09-17 13:16   ` Fuad Tabba
2026-09-17 14:56     ` Suzuki K Poulose
2026-09-15 16:01 ` [PATCH v18 21/23] KVM: arm64: CCA: WARN on injected undef exceptions Suzuki K Poulose
2026-09-15 16:01 ` [PATCH v18 22/23] KVM: arm64: CCA: Expose SVE VL register before VCPU finalization Suzuki K Poulose
2026-09-15 16:01 ` [PATCH v18 23/23] KVM: arm64: CCA: Control user register access for Realms Suzuki K Poulose
2026-09-15 16:49   ` sashiko-bot
2026-09-15 17:51     ` Suzuki K Poulose
2026-09-16 19:23 ` [PATCH v18 00/23] KVM: arm64: CCA: Add basic plumbing " Mathieu Poirier
2026-09-22  9:22   ` Aneesh Kumar K.V
2026-09-23 14:32     ` Mathieu Poirier
2026-09-17 14:32 ` 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=20260915164346.D49711F000FF@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=kvmarm@lists.linux.dev \
    --cc=maz@kernel.org \
    --cc=oupton@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=suzuki.poulose@arm.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