From: sashiko-bot@kernel.org
To: "Claudio Imbrenda" <imbrenda@linux.ibm.com>
Cc: kvm@vger.kernel.org, "Alexander Gordeev" <agordeev@linux.ibm.com>,
"Heiko Carstens" <hca@linux.ibm.com>,
linux-s390@vger.kernel.org, "Vasily Gorbik" <gor@linux.ibm.com>
Subject: Re: [PATCH v1 4/8] KVM: s390: Fix return value of kvm_s390_set_cmma_bits()
Date: Thu, 02 Jul 2026 15:37:21 +0000 [thread overview]
Message-ID: <20260702153722.4320C1F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <20260702152406.204782-5-imbrenda@linux.ibm.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] Leaked positive error codes (e.g., PGM_ADDRESSING) to userspace in KVM storage key ioctls.
--
commit 9e2ad138adcf0c89db7df7095fa7b5199afab279
Author: Claudio Imbrenda <imbrenda@linux.ibm.com>
KVM: s390: Fix return value of kvm_s390_set_cmma_bits()
If kvm_s390_set_cmma_bits() is asked to set CMMA values outside of a
memslot, PGM_ADDRESSING (5) is returned, instead of a negative error
value. Fix by returning -EFAULT whenever the return value would be > 0.
> diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
> --- a/arch/s390/kvm/kvm-s390.c
> +++ b/arch/s390/kvm/kvm-s390.c
> @@ -2384,7 +2384,7 @@ static int kvm_s390_set_cmma_bits(struct kvm *kvm,
>
> set_bit(GMAP_FLAG_USES_CMM, &kvm->arch.gmap->flags);
>
> - return r;
> + return r <= 0 ? r : -EFAULT;
[Severity: High]
This isn't a bug introduced by this patch, but since you are fixing the
leaked PGM_ADDRESSING error code here, should we also fix the same issue
in the storage key ioctls?
If userspace calls KVM_S390_GET_SKEYS or KVM_S390_SET_SKEYS with an
out-of-bounds guest address, do they also return the positive error code
directly?
arch/s390/kvm/kvm-s390.c:kvm_s390_get_skeys() {
...
r = dat_get_storage_key(kvm->arch.gmap->asce, args->start_gfn + i, keys + i);
if (r)
break;
...
return r;
}
arch/s390/kvm/kvm-s390.c:kvm_s390_set_skeys() {
...
r = dat_set_storage_key(mc, kvm->arch.gmap->asce, args->start_gfn + i, keys[i], 0);
if (r)
break;
...
return r;
}
Furthermore, for KVM_S390_KEYOP, does it falsely report success and assign
the error code to the output key?
arch/s390/kvm/kvm-s390.c:kvm_arch_vm_ioctl() {
case KVM_S390_KEYOP: {
...
r = kvm_s390_keyop(mc, kvm, kop.operation, kop.guest_addr, skey);
...
if (r < 0)
break;
kop.key = r;
r = 0;
...
}
Should these functions also be updated to return -EFAULT for positive errors,
just like kvm_s390_set_cmma_bits() does here?
> }
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260702152406.204782-1-imbrenda@linux.ibm.com?part=4
next prev parent reply other threads:[~2026-07-02 15:37 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-02 15:23 [PATCH v1 0/8] KVM: s390: Misc fixes Claudio Imbrenda
2026-07-02 15:23 ` [PATCH v1 1/8] KVM: s390: vsie: Avoid potential deadlock with real spaces Claudio Imbrenda
2026-07-02 15:24 ` [PATCH v1 2/8] KVM: s390: Fix unlikely NULL gmap dereference Claudio Imbrenda
2026-07-02 15:43 ` sashiko-bot
2026-07-02 15:24 ` [PATCH v1 3/8] KVM: s390: Fix unlikely race with KVM_CAP_S390_USER_OPEREXEC Claudio Imbrenda
2026-07-02 15:42 ` sashiko-bot
2026-07-02 17:08 ` Eric Farman
2026-07-02 15:24 ` [PATCH v1 4/8] KVM: s390: Fix return value of kvm_s390_set_cmma_bits() Claudio Imbrenda
2026-07-02 15:37 ` sashiko-bot [this message]
2026-07-02 15:24 ` [PATCH v1 5/8] KVM: s390: Fix race in __do_essa() Claudio Imbrenda
2026-07-02 15:34 ` sashiko-bot
2026-07-02 15:24 ` [PATCH v1 6/8] KVM: s390: cmma: Fix dirty tracking when removing memslot Claudio Imbrenda
2026-07-02 15:48 ` sashiko-bot
2026-07-02 15:24 ` [PATCH v1 7/8] KVM: s390: Fix dat_crste_walk_range() early return Claudio Imbrenda
2026-07-02 15:24 ` [PATCH v1 8/8] KVM: s390: Improve kvm_s390_vm_stop_migration() Claudio Imbrenda
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=20260702153722.4320C1F00A3A@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=agordeev@linux.ibm.com \
--cc=gor@linux.ibm.com \
--cc=hca@linux.ibm.com \
--cc=imbrenda@linux.ibm.com \
--cc=kvm@vger.kernel.org \
--cc=linux-s390@vger.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.