qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Huth <thuth@redhat.com>
To: qemu-devel@nongnu.org
Cc: Stefan Hajnoczi <stefanha@redhat.com>,
	Jared Rossi <jrossi@linux.ibm.com>
Subject: [PULL 8/9] pc-bios/s390-ccw: Abort IPL on invalid loadparm
Date: Tue, 21 Jan 2025 11:56:10 +0100	[thread overview]
Message-ID: <20250121105613.1286672-9-thuth@redhat.com> (raw)
In-Reply-To: <20250121105613.1286672-1-thuth@redhat.com>

From: Jared Rossi <jrossi@linux.ibm.com>

Because the loadparm specifies an exact kernel the user wants to boot, if the
loadparm is invalid it must represent a misconfiguration of the guest. Thus we
should abort the IPL immediately, without attempting to use other devices, to
avoid booting into an unintended guest image.

Signed-off-by: Jared Rossi <jrossi@linux.ibm.com>
Message-ID: <20250117212235.1324063-2-jrossi@linux.ibm.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 pc-bios/s390-ccw/bootmap.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/pc-bios/s390-ccw/bootmap.c b/pc-bios/s390-ccw/bootmap.c
index 56f2f75640..0f8baa0198 100644
--- a/pc-bios/s390-ccw/bootmap.c
+++ b/pc-bios/s390-ccw/bootmap.c
@@ -336,8 +336,7 @@ static int run_eckd_boot_script(block_number_t bmt_block_nr,
 
     debug_print_int("loadparm", loadparm);
     if (loadparm >= MAX_BOOT_ENTRIES) {
-        puts("loadparm value greater than max number of boot entries allowed");
-        return -EINVAL;
+        panic("loadparm value greater than max number of boot entries allowed");
     }
 
     memset(sec, FREE_SPACE_FILLER, sizeof(sec));
@@ -348,8 +347,8 @@ static int run_eckd_boot_script(block_number_t bmt_block_nr,
 
     block_nr = gen_eckd_block_num(&bmt->entry[loadparm].xeckd, ldipl);
     if (block_nr == NULL_BLOCK_NR) {
-        puts("Cannot find Boot Map Table Entry");
-        return -EIO;
+        printf("The requested boot entry (%d) is invalid\n", loadparm);
+        panic("Invalid loadparm");
     }
 
     memset(sec, FREE_SPACE_FILLER, sizeof(sec));
@@ -792,8 +791,12 @@ static int ipl_scsi(void)
 
     debug_print_int("loadparm", loadparm);
     if (loadparm >= MAX_BOOT_ENTRIES) {
-        puts("loadparm value greater than max number of boot entries allowed");
-        return -EINVAL;
+        panic("loadparm value greater than max number of boot entries allowed");
+    }
+
+    if (!valid_entries[loadparm]) {
+        printf("The requested boot entry (%d) is invalid\n", loadparm);
+        panic("Invalid loadparm");
     }
 
     return zipl_run(&prog_table->entry[loadparm].scsi);
-- 
2.48.1



  parent reply	other threads:[~2025-01-21 10:58 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-21 10:56 [PULL 0/9] s390x and test patches 2025-01-21 Thomas Huth
2025-01-21 10:56 ` [PULL 1/9] tests/functional: Convert the kvm_xen_guest avocado test Thomas Huth
2025-01-21 10:56 ` [PULL 2/9] MAINTAINERS: Remove myself as Avocado Framework reviewer Thomas Huth
2025-01-21 10:56 ` [PULL 3/9] crypto: fix bogus error benchmarking pbkdf on fast machines Thomas Huth
2025-01-21 10:56 ` [PULL 4/9] hw/s390x: Fix crash that occurs when inspecting older versioned machines types Thomas Huth
2025-01-21 10:56 ` [PULL 5/9] pc-bios/s390-ccw/virtio: Add a function to reset a virtio device Thomas Huth
2025-01-21 10:56 ` [PULL 6/9] pc-bios/s390-ccw: Fix boot problem with virtio-net devices Thomas Huth
2025-01-21 10:56 ` [PULL 7/9] pc-bios/s390-ccw/netmain: Fix error messages with regards to the TFTP server Thomas Huth
2025-01-21 10:56 ` Thomas Huth [this message]
2025-01-21 10:56 ` [PULL 9/9] pc-bios: Update the s390 bios images with the recent changes Thomas Huth
2025-01-22  0:27 ` [PULL 0/9] s390x and test patches 2025-01-21 Stefan Hajnoczi
2025-01-22  6:25   ` Thomas Huth

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=20250121105613.1286672-9-thuth@redhat.com \
    --to=thuth@redhat.com \
    --cc=jrossi@linux.ibm.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.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;
as well as URLs for NNTP newsgroup(s).