From: Christian Borntraeger <borntraeger@linux.ibm.com>
To: Cornelia Huck <cohuck@redhat.com>
Cc: qemu-devel <qemu-devel@nongnu.org>,
qemu-s390x <qemu-s390x@nongnu.org>,
Halil Pasic <pasic@linux.ibm.com>,
Matthew Rosato <mjrosato@linux.ibm.com>,
Eric Farman <farman@linux.ibm.com>,
Christian Borntraeger <borntraeger@linux.ibm.com>,
Jason Herne <jjherne@linux.ibm.com>,
Richard Henderson <richard.henderson@linaro.org>,
Ilya Leoshkevich <iii@linux.ibm.com>,
David Hildenbrand <david@kernel.org>,
qemu-stable@nongnu.org
Subject: [PATCH 5/5] s390x/css: limit number of CHPIDs in description
Date: Mon, 6 Jul 2026 11:19:09 +0200 [thread overview]
Message-ID: <20260706091909.864405-6-borntraeger@linux.ibm.com> (raw)
In-Reply-To: <20260706091909.864405-1-borntraeger@linux.ibm.com>
From: Eric Farman <farman@linux.ibm.com>
virtio-ccw uses a single virtual CHPID for all devices and
device-types, but vfio-ccw (passthrough) shares real CHPID
information with the guest. A sufficiently large passthrough
configuration would exceed the defined response payload.
Fix this by limiting the number of CHPID descriptions that
are returned based on the given response format.
Cc: qemu-stable@nongnu.org
Reviewed-by: Christian Borntraeger <borntraeger@linux.ibm.com>
Signed-off-by: Eric Farman <farman@linux.ibm.com>
---
hw/s390x/css.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/hw/s390x/css.c b/hw/s390x/css.c
index 96d5378f3c..29ba39f79e 100644
--- a/hw/s390x/css.c
+++ b/hw/s390x/css.c
@@ -1872,6 +1872,7 @@ int css_collect_chp_desc(int m, uint8_t cssid, uint8_t f_chpid, uint8_t l_chpid,
int i, desc_size;
uint32_t words[8];
uint32_t chpid_type_word;
+ uint32_t max_chpids, chpid_count = 0;
CssImage *css;
if (!m && !cssid) {
@@ -1882,9 +1883,25 @@ int css_collect_chp_desc(int m, uint8_t cssid, uint8_t f_chpid, uint8_t l_chpid,
if (!css) {
return 0;
}
+
+ if (rfmt == 0) {
+ max_chpids = 256;
+ } else if (rfmt == 1) {
+ max_chpids = 127;
+ } else {
+ /* Should be rejected by caller */
+ return 0;
+ }
+
desc_size = 0;
for (i = f_chpid; i <= l_chpid; i++) {
if (css->chpids[i].in_use) {
+ /* Limit number of CHPIDs sent back */
+ if (chpid_count == max_chpids) {
+ break;
+ }
+
+ chpid_count++;
chpid_type_word = 0x80000000 | (css->chpids[i].type << 8) | i;
if (rfmt == 0) {
words[0] = cpu_to_be32(chpid_type_word);
--
2.53.0
next prev parent reply other threads:[~2026-07-06 9:23 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-06 9:19 [PATCH 0/5] s390x: interface hardening fixes Christian Borntraeger
2026-07-06 9:19 ` [PATCH 1/5] s390x/sclp: reject invalid write event data headers Christian Borntraeger
2026-07-06 13:12 ` Matthew Rosato
2026-07-07 1:28 ` Eric Farman
2026-07-07 6:05 ` Philippe Mathieu-Daudé
2026-07-06 9:19 ` [PATCH 2/5] s390x/pci: Tighten region detection for BAR read/write Christian Borntraeger
2026-07-06 19:09 ` Farhan Ali
2026-07-06 9:19 ` [PATCH 3/5] s390x/pci: Shrink RPCIT ranges to registered window Christian Borntraeger
2026-07-06 19:07 ` Farhan Ali
2026-07-06 9:19 ` [PATCH 4/5] s390x/ioinst: Require strict length and format for SEI CHSC handler Christian Borntraeger
2026-07-06 19:08 ` Farhan Ali
2026-07-07 1:30 ` Eric Farman
2026-07-06 9:19 ` Christian Borntraeger [this message]
2026-07-06 17:49 ` [PATCH 5/5] s390x/css: limit number of CHPIDs in description Matthew Rosato
2026-07-06 15:13 ` [PATCH 0/5] s390x: interface hardening fixes Cornelia Huck
2026-07-06 16:31 ` Christian Borntraeger
2026-07-07 6:54 ` Cornelia Huck
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=20260706091909.864405-6-borntraeger@linux.ibm.com \
--to=borntraeger@linux.ibm.com \
--cc=cohuck@redhat.com \
--cc=david@kernel.org \
--cc=farman@linux.ibm.com \
--cc=iii@linux.ibm.com \
--cc=jjherne@linux.ibm.com \
--cc=mjrosato@linux.ibm.com \
--cc=pasic@linux.ibm.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-s390x@nongnu.org \
--cc=qemu-stable@nongnu.org \
--cc=richard.henderson@linaro.org \
/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.