All of lore.kernel.org
 help / color / mirror / Atom feed
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>,
	"Hendrik Brueckner" <brueckner@linux.ibm.com>,
	"Joshua Daley" <jdaley@linux.ibm.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Jared Rossi" <jrossi@linux.ibm.com>,
	"Zhuoying Cai" <zycai@linux.ibm.com>,
	"Marc-André Lureau" <marcandre.lureau@redhat.com>
Subject: [PATCH 1/5] hw/char/sclpconsole-lm: avoid guest triggerable assert
Date: Mon, 27 Jul 2026 13:50:48 +0200	[thread overview]
Message-ID: <20260727115052.24289-2-borntraeger@linux.ibm.com> (raw)
In-Reply-To: <20260727115052.24289-1-borntraeger@linux.ibm.com>

If a guest uses incorrect message length it can trigger an assert in
process_mbd which kills the guest instead of reporting an error.  Fix
this by adding the correct length check.

Fixes: 6a444f8507 ("s390/sclplmconsole: Add support for SCLP line-mode console")
Signed-off-by: Christian Borntraeger <borntraeger@linux.ibm.com>
---
 hw/char/sclpconsole-lm.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/hw/char/sclpconsole-lm.c b/hw/char/sclpconsole-lm.c
index 9a16896d22..f6ed282f1b 100644
--- a/hw/char/sclpconsole-lm.c
+++ b/hw/char/sclpconsole-lm.c
@@ -243,7 +243,8 @@ static int write_event_data(SCLPEvent *event, EventBufferHeader *ebh)
     SCLPConsoleLM *scon = SCLPLM_CONSOLE(event);
 
     len = be16_to_cpu(data->mdb.header.length);
-    if (len < sizeof(data->mdb.header)) {
+    if (len < sizeof(data->mdb.header) ||
+        len > be16_to_cpu(data->header.length) - sizeof(EventBufferHeader)) {
         return SCLP_RC_INCONSISTENT_LENGTHS;
     }
     len -= sizeof(data->mdb.header);
-- 
2.53.0



  reply	other threads:[~2026-07-27 11:52 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-27 11:50 [PATCH 0/5] more hardening fixes for s390 Christian Borntraeger
2026-07-27 11:50 ` Christian Borntraeger [this message]
2026-07-27 14:46   ` [PATCH 1/5] hw/char/sclpconsole-lm: avoid guest triggerable assert Matthew Rosato
2026-07-27 11:50 ` [PATCH 2/5] s390x/ipl: validate num_comp against iplb length before iterating Christian Borntraeger
2026-07-27 15:04   ` Matthew Rosato
2026-07-27 11:50 ` [PATCH 3/5] pc-bios/s390-ccw: fix out-of-bounds read in iso_get_file_size() Christian Borntraeger
2026-07-27 15:18   ` Matthew Rosato
2026-07-27 11:50 ` [PATCH 4/5] pc-bios/s390-ccw: bounds-check zipl menu entry index before array write Christian Borntraeger
2026-07-27 15:32   ` Matthew Rosato
2026-07-27 11:50 ` [PATCH 5/5] pc-bios/s390-ccw: bound zipl menu strlen and replace VLA in zipl_print_entry Christian Borntraeger
2026-07-27 15:51   ` Matthew Rosato
2026-07-27 16:02     ` Matthew Rosato
2026-07-27 17:32       ` Joshua Daley
2026-07-27 20:02         ` Eric Farman
2026-07-27 12:00 ` [PATCH 0/5] more hardening fixes for s390 Eric Farman
2026-07-27 12:14 ` Cornelia Huck
2026-07-27 12:17   ` Christian Borntraeger
2026-07-27 15:06     ` 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=20260727115052.24289-2-borntraeger@linux.ibm.com \
    --to=borntraeger@linux.ibm.com \
    --cc=brueckner@linux.ibm.com \
    --cc=cohuck@redhat.com \
    --cc=david@kernel.org \
    --cc=farman@linux.ibm.com \
    --cc=iii@linux.ibm.com \
    --cc=jdaley@linux.ibm.com \
    --cc=jjherne@linux.ibm.com \
    --cc=jrossi@linux.ibm.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=mjrosato@linux.ibm.com \
    --cc=pasic@linux.ibm.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-s390x@nongnu.org \
    --cc=richard.henderson@linaro.org \
    --cc=zycai@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 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.