From: sashiko-bot@kernel.org
To: "Christoph Schlameuss" <schlameuss@linux.ibm.com>
Cc: linux-s390@vger.kernel.org,
"Alexander Gordeev" <agordeev@linux.ibm.com>,
"Vasily Gorbik" <gor@linux.ibm.com>,
"Heiko Carstens" <hca@linux.ibm.com>,
kvm@vger.kernel.org
Subject: Re: [PATCH 21/21] KVM: s390: vsie: Enable VSIE SIGPI
Date: Thu, 09 Jul 2026 15:44:30 +0000 [thread overview]
Message-ID: <20260709154430.F363E1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260709-vsie-sigpi-v1-21-ea9f12066408@linux.ibm.com>
Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
- [Critical] The guest-controlled `icpua` field is used as an array index into `vsie_sca->pages` without bounds checking, allowing an attacker to corrupt arbitrary host kernel memory.
- [High] A guest can permanently leak vsie_sca structures by providing an invalid SCAO, eventually exhausting the vsie_sca pool and breaking nested virtualization.
- [High] A malicious guest can intentionally trigger host kernel warnings (WARN_ON_ONCE) by supplying unmapped guest physical addresses in the System Control Area (SCA) structures.
--
--- Patch [21]: [PATCH 21/21] KVM: s390: vsie: Enable VSIE SIGPI ---
commit ea08ed257ee1485d9e9b61914b578f7cc9773f7a
Author: Christoph Schlameuss <schlameuss@linux.ibm.com>
KVM: s390: vsie: Enable VSIE SIGPI
Finally enable code paths actually configuring and using VSIE SIGPI.
SIGP can be globally disabled in the KVM module configuration but will
be enabled by default if the machine (IBM z16 onwards) supports it.
> diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
> index 481e566fe228b..854de405d08c7 100644
> --- a/arch/s390/kvm/kvm-s390.c
> +++ b/arch/s390/kvm/kvm-s390.c
[ ... ]
> @@ -476,6 +481,8 @@ static void __init kvm_s390_cpu_feat_init(void)
> allow_cpu_feat(KVM_S390_VM_CPU_FEAT_KSS);
> if (sclp.has_astfleie2)
> allow_cpu_feat(KVM_S390_VM_CPU_FEAT_ASTFLEIE2);
> + if (sclp.has_vsie_sigpif && vsie_sigpi)
> + allow_cpu_feat(KVM_S390_VM_CPU_FEAT_SIGPIF);
[Severity: High]
Does enabling this feature expose a resource leak when providing an invalid
SCAO address?
Looking at get_vsie_sca() in arch/s390/kvm/vsie.c, if a guest provides an
unmapped SCAO address, pin_sca() fails and returns an error:
arch/s390/kvm/vsie.c:get_vsie_sca() {
...
rc = pin_sca(kvm, vsie_sca);
if (rc) {
vsie_sca = ERR_PTR(rc);
goto out;
}
...
}
It appears the newly added vsie_sca object is left in the kvm->arch.vsie.scas
array with an undecremented ref_count, permanently leaking it from the
reusable pool.
[Severity: High]
Can a guest intentionally trigger host kernel warnings by supplying unmapped
guest physical addresses in the System Control Area structures?
When a guest provides an unbacked SCA address, pin_guest_pages() in pin_sca()
returns -EFAULT, which directly triggers the host WARN_ON_ONCE:
arch/s390/kvm/vsie.c:pin_sca() {
...
vsie_sca->sca_o_nr_pages = pin_guest_pages(kvm, vsie_sca->sca_gpa, nr_pages,
vsie_sca->sca_o_pages);
if (WARN_ON_ONCE(vsie_sca->sca_o_nr_pages != nr_pages))
return -EIO;
...
}
Similarly, in get_vsie_page_cpu_nr(), if the SCB address is unmapped,
vsie_page_init() returns -ENOMEM and also triggers a WARN_ON_ONCE:
arch/s390/kvm/vsie.c:get_vsie_page_cpu_nr() {
...
scoped_guard(mutex, &vcpu->kvm->arch.vsie.mutex) {
unpin_scb(vcpu->kvm, vsie_page);
rc = vsie_page_init(vcpu, vsie_page, scb_gpa);
}
if (WARN_ON_ONCE(rc)) {
...
}
[Severity: Critical]
Does this enablement allow an out-of-bounds array access in
get_vsie_page_cpu_nr()?
In get_vsie_page_cpu_nr(), the guest-controlled cpu_nr (which comes from
icpua and can be up to 65535) is used as an index to read from and write to
the pages array, which is only sized to 256:
arch/s390/kvm/vsie.c:get_vsie_page_cpu_nr() {
...
vsie_page = vsie_sca->pages[cpu_nr];
if (!vsie_page) {
vsie_page_new = alloc_vsie_page(vcpu->kvm);
...
scoped_guard(mutex, &vsie_sca->mutex) {
vsie_page = vsie_sca->pages[cpu_nr];
if (!vsie_page) {
WRITE_ONCE(vsie_sca->pages[cpu_nr], vsie_page_new);
...
}
Could this corrupt adjacent host kernel memory structures?
> /*
> * KVM_S390_VM_CPU_FEAT_SKEY: Wrong shadow of PTE.I bits will make
> * all skey handling functions read/set the skey from the PGSTE
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260709-vsie-sigpi-v1-0-ea9f12066408@linux.ibm.com?part=21
prev parent reply other threads:[~2026-07-09 15:44 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-09 15:15 [PATCH 00/21] KVM: s390: vsie: Add VSIE SIGP Interpretation (vsie_sigpi) Christoph Schlameuss
2026-07-09 15:15 ` [PATCH 01/21] KVM: s390: Remove double 64bscao feature check Christoph Schlameuss
2026-07-09 15:15 ` [PATCH 02/21] KVM: s390: vsie: Remove duplicate assertion Christoph Schlameuss
2026-07-09 15:15 ` [PATCH 03/21] KVM: s390: vsie: Convert shift to phys_to_pfn() Christoph Schlameuss
2026-07-09 15:15 ` [PATCH 04/21] KVM: s390: vsie: Add SCAO read and write helpers Christoph Schlameuss
2026-07-09 15:24 ` sashiko-bot
2026-07-09 15:15 ` [PATCH 05/21] KVM: s390: vsie: Move SCAO validation into a function Christoph Schlameuss
2026-07-09 15:26 ` sashiko-bot
2026-07-09 15:15 ` [PATCH 06/21] KVM: s390: vsie: Add vsie_sigpif detection Christoph Schlameuss
2026-07-09 15:32 ` sashiko-bot
2026-07-09 15:15 ` [PATCH 07/21] KVM: s390: vsie: Add ssca_block and ssca_entry structs for vsie_ie Christoph Schlameuss
2026-07-09 15:24 ` sashiko-bot
2026-07-09 15:15 ` [PATCH 08/21] KVM: s390: vsie: Move pin/unpin_scb methods Christoph Schlameuss
2026-07-09 15:15 ` [PATCH 09/21] KVM: s390: vsie: Move pin/unpin guest page Christoph Schlameuss
2026-07-09 15:15 ` [PATCH 10/21] KVM: s390: vsie: Move release/acquire gmap shadow Christoph Schlameuss
2026-07-09 15:15 ` [PATCH 11/21] KVM: s390: vsie: Create helpers to alloc and free vsie_pages Christoph Schlameuss
2026-07-09 15:23 ` sashiko-bot
2026-07-09 15:15 ` [PATCH 12/21] KVM: s390: vsie: Replace radix_tree with xarray addr_to_page Christoph Schlameuss
2026-07-09 15:25 ` sashiko-bot
2026-07-09 15:15 ` [PATCH 13/21] KVM: s390: vsie: Add helper to pin multiple guest pages Christoph Schlameuss
2026-07-09 15:28 ` sashiko-bot
2026-07-09 15:15 ` [PATCH 14/21] KVM: s390: vsie: Add helper to release gmap shadow Christoph Schlameuss
2026-07-09 15:30 ` sashiko-bot
2026-07-09 15:15 ` [PATCH 15/21] KVM: s390: vsie: Add struct vsie_sca with pin and unpin Christoph Schlameuss
2026-07-09 15:31 ` sashiko-bot
2026-07-09 15:15 ` [PATCH 16/21] KVM: s390: vsie: Shadow VSIE SCA in guest-1 Christoph Schlameuss
2026-07-09 15:37 ` sashiko-bot
2026-07-09 15:15 ` [PATCH 17/21] KVM: s390: vsie: Allow guest-3 cpu add and remove with vsie sigpif Christoph Schlameuss
2026-07-09 15:35 ` sashiko-bot
2026-07-09 15:15 ` [PATCH 18/21] KVM: s390: vsie: Add VSIE max shadow configuration Christoph Schlameuss
2026-07-09 15:35 ` sashiko-bot
2026-07-09 15:15 ` [PATCH 19/21] KVM: s390: vsie: Add VSIE shadow stat counters Christoph Schlameuss
2026-07-09 15:30 ` sashiko-bot
2026-07-09 15:15 ` [PATCH 20/21] KVM: s390: vsie: Create minimal scb shadows for not running g3 blocks Christoph Schlameuss
2026-07-09 15:47 ` sashiko-bot
2026-07-09 15:15 ` [PATCH 21/21] KVM: s390: vsie: Enable VSIE SIGPI Christoph Schlameuss
2026-07-09 15:44 ` sashiko-bot [this message]
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=20260709154430.F363E1F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=agordeev@linux.ibm.com \
--cc=gor@linux.ibm.com \
--cc=hca@linux.ibm.com \
--cc=kvm@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=schlameuss@linux.ibm.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