* [PULL for-11.1 0/3] s390x fixes for 11.1-rc0
@ 2026-07-14 9:32 Cornelia Huck
2026-07-14 9:32 ` [PULL for-11.1 1/3] s390x/sclp: prevent re-reading the sclp header Cornelia Huck
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Cornelia Huck @ 2026-07-14 9:32 UTC (permalink / raw)
To: qemu-devel; +Cc: qemu-s390x, Cornelia Huck
The following changes since commit 499039798cdad7d86b787fec0eaf1da4151c0f05:
Merge tag 'pull-request-2026-07-12' of https://gitlab.com/huth/qemu into staging (2026-07-12 21:49:04 +0200)
are available in the Git repository at:
https://gitlab.com/cohuck/qemu tags/s390x-20260714
for you to fetch changes up to 33bece0fa121c0a85df4f0372145ca74b967e78e:
s390x/css: firm up handling of chained TIC CCWs (2026-07-14 11:19:34 +0200)
----------------------------------------------------------------
more s390x guest->host interface hardening (sclp, css)
----------------------------------------------------------------
Christian Borntraeger (2):
s390x/sclp: prevent re-reading the sclp header
s390x/sclpcpi: check event length field before reading from buffer
Eric Farman (1):
s390x/css: firm up handling of chained TIC CCWs
hw/s390x/css.c | 7 +++++++
hw/s390x/sclp.c | 4 +++-
hw/s390x/sclpcpi.c | 5 +++++
include/hw/s390x/css.h | 1 +
4 files changed, 16 insertions(+), 1 deletion(-)
--
2.55.0
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PULL for-11.1 1/3] s390x/sclp: prevent re-reading the sclp header
2026-07-14 9:32 [PULL for-11.1 0/3] s390x fixes for 11.1-rc0 Cornelia Huck
@ 2026-07-14 9:32 ` Cornelia Huck
2026-07-14 9:32 ` [PULL for-11.1 2/3] s390x/sclpcpi: check event length field before reading from buffer Cornelia Huck
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Cornelia Huck @ 2026-07-14 9:32 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-s390x, Christian Borntraeger, qemu-stable, Matthew Rosato,
Eric Farman, Collin Walling, Cornelia Huck
From: Christian Borntraeger <borntraeger@linux.ibm.com>
We verify the sccb length and then allocate based on that length. The
following access re-reads the sccb again. This can race against other
vCPUs overwriting the length field.
sclp_service_call_protected does not need a change as the ultravisor
provides a consistent snapshot.
Fixes: c1db53a5910f ("s390/sclp: read sccb from mem based on provided length")
Cc: qemu-stable@nongnu.org
Signed-off-by: Christian Borntraeger <borntraeger@linux.ibm.com>
Reviewed-by: Matthew Rosato <mjrosato@linux.ibm.com>
Reviewed-by: Eric Farman <farman@linux.ibm.com>
Reviewed-by: Collin Walling <walling@linux.ibm.com>
Message-ID: <20260709142906.197474-2-borntraeger@linux.ibm.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
---
hw/s390x/sclp.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/hw/s390x/sclp.c b/hw/s390x/sclp.c
index 2d2cde7803ff..3c8cb164888f 100644
--- a/hw/s390x/sclp.c
+++ b/hw/s390x/sclp.c
@@ -329,7 +329,8 @@ int sclp_service_call(S390CPU *cpu, uint64_t sccb, uint32_t code)
/*
* we want to work on a private copy of the sccb, to prevent guests
* from playing dirty tricks by modifying the memory content after
- * the host has checked the values
+ * the host has checked the values.
+ * Reuse the previously fetched header
*/
work_sccb = g_malloc0(be16_to_cpu(header.length));
ret = address_space_read(as, sccb, attrs,
@@ -337,6 +338,7 @@ int sclp_service_call(S390CPU *cpu, uint64_t sccb, uint32_t code)
if (ret != MEMTX_OK) {
return -PGM_ADDRESSING;
}
+ work_sccb->h = header;
if (!sclp_command_code_valid(code)) {
work_sccb->h.response_code = cpu_to_be16(SCLP_RC_INVALID_SCLP_COMMAND);
--
2.55.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PULL for-11.1 2/3] s390x/sclpcpi: check event length field before reading from buffer
2026-07-14 9:32 [PULL for-11.1 0/3] s390x fixes for 11.1-rc0 Cornelia Huck
2026-07-14 9:32 ` [PULL for-11.1 1/3] s390x/sclp: prevent re-reading the sclp header Cornelia Huck
@ 2026-07-14 9:32 ` Cornelia Huck
2026-07-14 9:33 ` [PULL for-11.1 3/3] s390x/css: firm up handling of chained TIC CCWs Cornelia Huck
2026-07-15 19:16 ` [PULL for-11.1 0/3] s390x fixes for 11.1-rc0 Stefan Hajnoczi
3 siblings, 0 replies; 5+ messages in thread
From: Cornelia Huck @ 2026-07-14 9:32 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-s390x, Christian Borntraeger, qemu-stable, Matthew Rosato,
Janosch Frank, Eric Farman, Cornelia Huck
From: Christian Borntraeger <borntraeger@linux.ibm.com>
A guest might send a too short SCCB with SCLP_EVENT_CTRL_PGM_ID. QEMU
would fill its data structures with garbage data. Check for the precise
length of the CBI data structure and reject otherwise.
Fixes: f345978f24be ("hw/s390x: add Control-Program Identification to QOM")
Cc: qemu-stable@nongnu.org
Signed-off-by: Christian Borntraeger <borntraeger@linux.ibm.com>
Reviewed-by: Matthew Rosato <mjrosato@linux.ibm.com>
Reviewed-by: Janosch Frank <frankja@linux.ibm.com>
Reviewed-by: Eric Farman <farman@linux.ibm.com>
Message-ID: <20260709142906.197474-3-borntraeger@linux.ibm.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
---
hw/s390x/sclpcpi.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/hw/s390x/sclpcpi.c b/hw/s390x/sclpcpi.c
index 68fc1b809bf3..ec4bdf23509b 100644
--- a/hw/s390x/sclpcpi.c
+++ b/hw/s390x/sclpcpi.c
@@ -97,6 +97,11 @@ static int write_event_data(SCLPEvent *event, EventBufferHeader *evt_buf_hdr)
ebh);
SCLPEventCPI *e = SCLP_EVENT_CPI(event);
+ /* Caller checks sccb length, buffer header checking is our duty */
+ if (be16_to_cpu(evt_buf_hdr->length) != sizeof(ControlProgramIdMsg)) {
+ return SCLP_RC_INCONSISTENT_LENGTHS;
+ }
+
ascii_put(e->system_type, (char *)cpim->data.system_type,
sizeof(cpim->data.system_type));
ascii_put(e->system_name, (char *)cpim->data.system_name,
--
2.55.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PULL for-11.1 3/3] s390x/css: firm up handling of chained TIC CCWs
2026-07-14 9:32 [PULL for-11.1 0/3] s390x fixes for 11.1-rc0 Cornelia Huck
2026-07-14 9:32 ` [PULL for-11.1 1/3] s390x/sclp: prevent re-reading the sclp header Cornelia Huck
2026-07-14 9:32 ` [PULL for-11.1 2/3] s390x/sclpcpi: check event length field before reading from buffer Cornelia Huck
@ 2026-07-14 9:33 ` Cornelia Huck
2026-07-15 19:16 ` [PULL for-11.1 0/3] s390x fixes for 11.1-rc0 Stefan Hajnoczi
3 siblings, 0 replies; 5+ messages in thread
From: Cornelia Huck @ 2026-07-14 9:33 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-s390x, Eric Farman, qemu-stable, Christian Borntraeger,
Farhan Ali, Cornelia Huck
From: Eric Farman <farman@linux.ibm.com>
The logic in css_interpret_ccw() correctly returns -EINVAL if a
Transfer-In-Channel (TIC) CCW is command chained to another TIC CCW.
The same routine also correctly returns -EINVAL if 256 CCWs do not
perform a data transfer as part of the I/O operation [0].
What is missing, however, is a combination of these two, where a loop
can be generated that will continue processing CCWs but without
providing an opportunity to catch a breath. Fix this by capping
the number of TIC CCWs in a channel program at the same limit as
the CCWs without data transfer.
[0] See "Invalid Sequence" in z/Architecture Principles of Operation
(SA22-7832-14), p16-27
Cc: qemu-stable@nongnu.org
Signed-off-by: Eric Farman <farman@linux.ibm.com>
Acked-by: Christian Borntraeger <borntraeger@linux.ibm.com>
Reviewed-by: Farhan Ali <alifm@linux.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@linux.ibm.com>
Message-ID: <20260713074708.884282-1-borntraeger@linux.ibm.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
---
hw/s390x/css.c | 7 +++++++
include/hw/s390x/css.h | 1 +
2 files changed, 8 insertions(+)
diff --git a/hw/s390x/css.c b/hw/s390x/css.c
index 29ba39f79ea1..3a67b6705319 100644
--- a/hw/s390x/css.c
+++ b/hw/s390x/css.c
@@ -1078,6 +1078,12 @@ static int css_interpret_ccw(SubchDev *sch, hwaddr ccw_addr,
ret = -EINVAL;
break;
}
+ /* Limit the number of TICs in a given channel program */
+ if (sch->ccw_tic_cnt == 255) {
+ ret = -EINVAL;
+ break;
+ }
+ sch->ccw_tic_cnt++;
sch->channel_prog = ccw.cda;
ret = -EAGAIN;
break;
@@ -1129,6 +1135,7 @@ static void sch_handle_start_func_virtual(SubchDev *sch)
sch->ccw_fmt_1 = !!(orb->ctrl0 & ORB_CTRL0_MASK_FMT);
schib->scsw.flags |= (sch->ccw_fmt_1) ? SCSW_FLAGS_MASK_FMT : 0;
sch->ccw_no_data_cnt = 0;
+ sch->ccw_tic_cnt = 0;
suspend_allowed = !!(orb->ctrl0 & ORB_CTRL0_MASK_SPND);
} else {
/* Start Function resumed via rsch */
diff --git a/include/hw/s390x/css.h b/include/hw/s390x/css.h
index d3326237c9f0..79b41f305e8c 100644
--- a/include/hw/s390x/css.h
+++ b/include/hw/s390x/css.h
@@ -132,6 +132,7 @@ struct SubchDev {
bool ccw_fmt_1;
bool thinint_active;
uint8_t ccw_no_data_cnt;
+ uint8_t ccw_tic_cnt;
uint16_t migrated_schid; /* used for mismatch detection */
CcwDataStream cds;
/* transport-provided data: */
--
2.55.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PULL for-11.1 0/3] s390x fixes for 11.1-rc0
2026-07-14 9:32 [PULL for-11.1 0/3] s390x fixes for 11.1-rc0 Cornelia Huck
` (2 preceding siblings ...)
2026-07-14 9:33 ` [PULL for-11.1 3/3] s390x/css: firm up handling of chained TIC CCWs Cornelia Huck
@ 2026-07-15 19:16 ` Stefan Hajnoczi
3 siblings, 0 replies; 5+ messages in thread
From: Stefan Hajnoczi @ 2026-07-15 19:16 UTC (permalink / raw)
To: Cornelia Huck; +Cc: qemu-devel, qemu-s390x, Cornelia Huck
[-- Attachment #1: Type: text/plain, Size: 116 bytes --]
Applied, thanks.
Please update the changelog at https://wiki.qemu.org/ChangeLog/11.1 for any user-visible changes.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-07-15 19:18 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-14 9:32 [PULL for-11.1 0/3] s390x fixes for 11.1-rc0 Cornelia Huck
2026-07-14 9:32 ` [PULL for-11.1 1/3] s390x/sclp: prevent re-reading the sclp header Cornelia Huck
2026-07-14 9:32 ` [PULL for-11.1 2/3] s390x/sclpcpi: check event length field before reading from buffer Cornelia Huck
2026-07-14 9:33 ` [PULL for-11.1 3/3] s390x/css: firm up handling of chained TIC CCWs Cornelia Huck
2026-07-15 19:16 ` [PULL for-11.1 0/3] s390x fixes for 11.1-rc0 Stefan Hajnoczi
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.