From: sashiko-bot@kernel.org
To: "Karl Mehltretter" <kmehltretter@gmail.com>
Cc: "Oliver Upton" <oupton@kernel.org>,
kvmarm@lists.linux.dev, kvm@vger.kernel.org,
"Marc Zyngier" <maz@kernel.org>
Subject: Re: [PATCH 1/2] KVM: arm64: Return -EINVAL for an empty SMCCC filter range at base 0
Date: Sat, 29 Aug 2026 05:58:08 +0000 [thread overview]
Message-ID: <20260829055809.29AD31F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260829054856.70549-2-kmehltretter@gmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] Unprivileged userspace-reachable WARN_ON_ONCE can be triggered by memory pressure, potentially causing a host panic.
--
commit 7eae467c4f77ea62fe7302656a7c43a21cc35eb0
Author: Karl Mehltretter <kmehltretter@gmail.com>
KVM: arm64: Return -EINVAL for an empty SMCCC filter range at base 0
This commit fixes an issue where an empty SMCCC filter range at base 0
wraps around to U32_MAX, overlapping reserved ranges and incorrectly
returning -EEXIST. It explicitly rejects a zero function count instead.
> diff --git a/arch/arm64/kvm/hypercalls.c b/arch/arm64/kvm/hypercalls.c
> index b11b8821c9fbc..dfa25bb6f25d4 100644
> --- a/arch/arm64/kvm/hypercalls.c
> +++ b/arch/arm64/kvm/hypercalls.c
> @@ -185,7 +185,8 @@ static int kvm_smccc_set_filter(struct kvm *kvm, struct kvm_smccc_filter __user
> start = filter.base;
> end = start + filter.nr_functions - 1;
>
> - if (end < start || filter.action >= NR_SMCCC_FILTER_ACTIONS)
> + if (!filter.nr_functions || end < start ||
> + filter.action >= NR_SMCCC_FILTER_ACTIONS)
> return -EINVAL;
>
> mutex_lock(&kvm->arch.config_lock);
[Severity: High]
This isn't a bug introduced by this patch, but while looking at
kvm_smccc_set_filter(), is it possible for an unprivileged user to trigger
a kernel panic via the WARN_ON_ONCE lower down in this function?
A userspace process can call the KVM_ARM_VM_SMCCC_FILTER ioctl, which
requires /dev/kvm access. The kernel calls
kvm_smccc_filter_insert_reserved(), which in turn invokes
mtree_insert_range() with GFP_KERNEL_ACCOUNT.
If this maple tree node allocation fails due to memory pressure or cgroup
limits, it returns -ENOMEM.
The caller kvm_smccc_set_filter() then unconditionally executes the
warning check:
if (!kvm_smccc_filter_configured(kvm)) {
r = kvm_smccc_filter_insert_reserved(kvm);
if (WARN_ON_ONCE(r))
goto out_unlock;
}
Because KVM subsystem guidelines forbid host-userspace-reachable warnings,
could this lead to a host denial-of-service if panic_on_warn is enabled?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260829054856.70549-1-kmehltretter@gmail.com?part=1
next prev parent reply other threads:[~2026-08-29 5:58 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-29 5:48 [PATCH 0/2] KVM: arm64: Return -EINVAL for an empty SMCCC filter range at base 0 Karl Mehltretter
2026-08-29 5:48 ` [PATCH 1/2] " Karl Mehltretter
2026-08-29 5:58 ` sashiko-bot [this message]
2026-08-29 15:04 ` Fuad Tabba
2026-08-29 15:53 ` Karl Mehltretter
2026-08-29 15:55 ` Fuad Tabba
2026-09-01 7:38 ` Steffen Eiden
2026-08-29 5:48 ` [PATCH 2/2] KVM: arm64: selftests: Test " Karl Mehltretter
2026-08-29 15:04 ` Fuad Tabba
2026-09-01 7:39 ` Steffen Eiden
2026-09-15 22:25 ` [PATCH 0/2] KVM: arm64: Return -EINVAL for an " Oliver Upton
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=20260829055809.29AD31F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=kmehltretter@gmail.com \
--cc=kvm@vger.kernel.org \
--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.