s390-ccw-bios: Skip bootmap signature entries
[Qemu-devel] [PULL SUBSYSTEM s390x 1/3] pc-bios/s390-ccw: Clean up harmless misuse of isdigit()
In reply to Thomas HuthFrom: Markus Armbruster <[email protected]>
atoui() and get_index() pass char values to isdigit(). With a standard isdigit(), we'd get undefined behavior when the value is negative. Can't happen as char is unsigned on s390x. Even if it ould, we're actually using isdigit() from pc-bios/s390-ccw/libc.h here, which works fine for negative values. Clean up anyway, just to avoid setting a bad example.
Message-Id: <[email protected]>
--- pc-bios/s390-ccw/libc.c | 2 +- pc-bios/s390-ccw/menu.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
pc-bios/s390-ccw/libc.c +1 -1
@@ -38,7 +38,7 @@ uint64_t atoui(const char *str) }while (*str) { -if (!isdigit (*str)) { +if (!isdigit (*(unsigned char *)str)) {break ; } val = val *10 + *str -'0' ;
pc-bios/s390-ccw/menu.c +1 -1
@@ -134,7 +134,7 @@ static int get_index(void)/* Check for erroneous input */ for (i =0 ; i < len; i++) { -if (!isdigit (buf[i])) { +if (!isdigit ((unsigned char )buf[i])) {return -1 ; } }
Signature · 1 line
2.21.0
This pull request is not for master.
Hi Cornelia,
the following changes since commit a6f6d24757a73f7176989134b97284a1a7df11e5:
Merge remote-tracking branch 'remotes/kraxel/tags/vga-20190507-pull-request' into staging (2019-05-07 21:39:28 +0100)
are available in the Git repository at:
https://gitlab.com/huth/qemu.git tags/s390-ccw-bios-2019-05-08
for you to fetch changes up to f7a339a5ba48a8a5c5bf4f1fdb1463bf8ac5f5bb:
pc-bios/s390: Update firmware image with "Skip bootmap signature entries" fix (2019-05-08 11:26:01 +0200)
----------------------------------------------------------------
Skip unsupported bootmap signature entries instead of aborting the boot process
----------------------------------------------------------------
Jason J. Herne (1):
s390-bios: Skip bootmap signature entries
Markus Armbruster (1):
pc-bios/s390-ccw: Clean up harmless misuse of isdigit()
Thomas Huth (1):
pc-bios/s390: Update firmware image with "Skip bootmap signature entries" fix
pc-bios/s390-ccw.img | Bin 42608 -> 42608 bytes pc-bios/s390-ccw/bootmap.c | 19 +++++++++++++++++-- pc-bios/s390-ccw/bootmap.h | 10 ++++++---- pc-bios/s390-ccw/libc.c | 2 +- pc-bios/s390-ccw/menu.c | 2 +- 5 files changed, 25 insertions(+), 8 deletions(-)
[Qemu-devel] [PULL SUBSYSTEM s390x 2/3] s390-bios: Skip bootmap signature entries
From: "Jason J. Herne" <[email protected]>
Newer versions of zipl have the ability to write signature entries to the boot script for secure boot. We don't yet support secure boot, but we need to skip over signature entries while reading the boot script in order to maintain our ability to boot guest operating systems that have a secure bootloader.
Message-Id: <[email protected]>
--- pc-bios/s390-ccw/bootmap.c | 19 +++++++++++++++++-- pc-bios/s390-ccw/bootmap.h | 10 ++++++---- 2 files changed, 23 insertions(+), 6 deletions(-)
pc-bios/s390-ccw/bootmap.c +17 -2
@@ -254,7 +254,14 @@ static void run_eckd_boot_script(block_number_t bmt_block_nr,memset (sec,FREE_SPACE_FILLER ,sizeof (sec));read_block (block_nr, sec,"Cannot read Boot Map Script" ); -for (i =0 ; bms->entry[i].type ==BOOT_SCRIPT_LOAD ; i++) { +for (i =0 ; bms->entry[i].type ==BOOT_SCRIPT_LOAD || + bms->entry[i].type ==BOOT_SCRIPT_SIGNATURE ; i++) { + +/* We don't support secure boot yet, so we skip signature entries */ +if (bms->entry[i].type ==BOOT_SCRIPT_SIGNATURE ) { +continue ; + } + address = bms->entry[i].address.load_address; block_nr =eckd_block_num (&bms->entry[i].blkptr.xeckd.bptr.chs);
@@ -489,7 +496,15 @@ static void zipl_run(ScsiBlockPtr *pte)/* Load image(s) into RAM */ entry = (ComponentEntry *)(&header[1 ]); -while (entry->component_type ==ZIPL_COMP_ENTRY_LOAD ) { +while (entry->component_type ==ZIPL_COMP_ENTRY_LOAD || + entry->component_type ==ZIPL_COMP_ENTRY_SIGNATURE ) { + +/* We don't support secure boot yet, so we skip signature entries */ +if (entry->component_type ==ZIPL_COMP_ENTRY_SIGNATURE ) { + entry++; +continue ; + } +zipl_load_segment (entry); entry++;
pc-bios/s390-ccw/bootmap.h +6 -4
@@ -98,8 +98,9 @@ typedef struct ScsiMbr {#define ZIPL_COMP_HEADER_IPL 0x00#define ZIPL_COMP_HEADER_DUMP 0x01 -#define ZIPL_COMP_ENTRY_LOAD 0x02 -#define ZIPL_COMP_ENTRY_EXEC 0x01 +#define ZIPL_COMP_ENTRY_EXEC 0x01 +#define ZIPL_COMP_ENTRY_LOAD 0x02 +#define ZIPL_COMP_ENTRY_SIGNATURE 0x03 typedef struct XEckdMbr { uint8_t magic[4]; /* == "xIPL" */
@@ -117,8 +118,9 @@ typedef struct BootMapScriptEntry {BootMapPointer blkptr;uint8_t pad[7 ];uint8_t type;/* == BOOT_SCRIPT_* */ -#define BOOT_SCRIPT_EXEC 0x01 -#define BOOT_SCRIPT_LOAD 0x02 +#define BOOT_SCRIPT_EXEC 0x01 +#define BOOT_SCRIPT_LOAD 0x02 +#define BOOT_SCRIPT_SIGNATURE 0x03union {uint64_t load_address;uint64_t load_psw;
Signature · 1 line
2.21.0
[Qemu-devel] [PULL SUBSYSTEM s390x 3/3] pc-bios/s390: Update firmware image with "Skip bootmap signature entries" fix
In reply to Thomas HuthFirmware now skips the unsupported signature entries instead of aborting the boot process.
--- pc-bios/s390-ccw.img | Bin 42608 -> 42608 bytes 1 file changed, 0 insertions(+), 0 deletions(-)
pc-bios/s390-ccw.img binary +0 -0
Signature · 1 line
2.21.0
Re: [Qemu-devel] [PULL SUBSYSTEM s390x 3/3] pc-bios/s390: Update firmware image with "Skip bootmap signature entries" fix
pc-bios/s390-ccw.img
Quoted 13 lines · Thomas Huth
Firmware now skips the unsupported signature entries instead of aborting the boot process.
Signed-off-by Thomas Huth <[email protected]>--- pc-bios/s390-ccw.img | Bin 42608 -> 42608 bytes 1 file changed, 0 insertions(+), 0 deletions(-)pc-bios/s390-ccw.img binary +0
-0
...
I've tested this build with signature entries in the bootmap and everything appears to work.
Signature · 1 line
-- Jason J. Herne ([email protected])
Shall we actually CC stable that feature?
Quoted 37 lines · Thomas Huth
This pull request is not for master.
Hi Cornelia,
the following changes since commit
a6f6d24757a73f7176989134b97284a1a7df11e5:Merge remote-tracking branch 'remotes/kraxel/tags/vga-20190507-pull-request' into staging (2019-05-07 21:39:28 +0100)
are available in the Git repository at:
https://gitlab.com/huth/qemu.git tags/s390-ccw-bios-2019-05-08
for you to fetch changes up to
f7a339a5ba48a8a5c5bf4f1fdb1463bf8ac5f5bb:pc-bios/s390: Update firmware image with "Skip bootmap signature entries" fix (2019-05-08 11:26:01 +0200)
----------------------------------------------------------------
Skip unsupported bootmap signature entries instead of aborting the boot process
----------------------------------------------------------------Jason J. Herne (1):
s390-bios: Skip bootmap signature entriesMarkus Armbruster (1):
pc-bios/s390-ccw: Clean up harmless misuse ofisdigit()Thomas Huth (1):
pc-bios/s390: Update firmware image with "Skip bootmap signature entries" fixpc-bios/s390-ccw.img | Bin 42608 -> 42608 bytes pc-bios/s390-ccw/bootmap.c | 19 +++++++++++++++++-- pc-bios/s390-ccw/bootmap.h | 10 ++++++---- pc-bios/s390-ccw/libc.c | 2 +- pc-bios/s390-ccw/menu.c | 2 +- 5 files changed, 25 insertions(+), 8 deletions(-)
Re: [Qemu-devel] [PULL SUBSYSTEM s390x 2/3] s390-bios: Skip bootmap signature entries
In reply to Thomas HuthShall we cc stable this?
Quoted 82 lines · Thomas Huth
From: "Jason J. Herne" <[email protected]>
Newer versions of zipl have the ability to write signature entries to the boot script for secure boot. We don't yet support secure boot, but we need to skip over signature entries while reading the boot script in order to maintain our ability to boot guest operating systems that have a secure bootloader.
Signed-off-by Jason J. Herne <[email protected]>Reviewed-by Farhan Ali <[email protected]>Message-Id: <[email protected]>
Signed-off-by Thomas Huth <[email protected]>--- pc-bios/s390-ccw/bootmap.c | 19 +++++++++++++++++-- pc-bios/s390-ccw/bootmap.h | 10 ++++++---- 2 files changed, 23 insertions(+), 6 deletions(-)pc-bios/s390-ccw/bootmap.c +17
-2@@ -254,7 +254,14 @@ static void run_eckd_boot_script(block_number_t bmt_block_nr,memset (sec,FREE_SPACE_FILLER ,sizeof (sec));read_block (block_nr, sec,"Cannot read Boot Map Script" ); -for (i =0 ; bms->entry[i].type ==BOOT_SCRIPT_LOAD ; i++) { +for (i =0 ; bms->entry[i].type ==BOOT_SCRIPT_LOAD || + bms->entry[i].type ==BOOT_SCRIPT_SIGNATURE ; i++) { + +/* We don't support secure boot yet, so we skip signature entries */ +if (bms->entry[i].type ==BOOT_SCRIPT_SIGNATURE ) { +continue ; + } + address = bms->entry[i].address.load_address; block_nr =eckd_block_num (&bms->entry[i].blkptr.xeckd.bptr.chs);@@ -489,7 +496,15 @@ static void zipl_run(ScsiBlockPtr *pte)/* Load image(s) into RAM */ entry = (ComponentEntry *)(&header[1 ]); -while (entry->component_type ==ZIPL_COMP_ENTRY_LOAD ) { +while (entry->component_type ==ZIPL_COMP_ENTRY_LOAD || + entry->component_type ==ZIPL_COMP_ENTRY_SIGNATURE ) { + +/* We don't support secure boot yet, so we skip signature entries */ +if (entry->component_type ==ZIPL_COMP_ENTRY_SIGNATURE ) { + entry++; +continue ; + } +zipl_load_segment (entry); entry++;pc-bios/s390-ccw/bootmap.h +6
-4@@ -98,8 +98,9 @@ typedef struct ScsiMbr {#define ZIPL_COMP_HEADER_IPL 0x00#define ZIPL_COMP_HEADER_DUMP 0x01 -#define ZIPL_COMP_ENTRY_LOAD 0x02 -#define ZIPL_COMP_ENTRY_EXEC 0x01 +#define ZIPL_COMP_ENTRY_EXEC 0x01 +#define ZIPL_COMP_ENTRY_LOAD 0x02 +#define ZIPL_COMP_ENTRY_SIGNATURE 0x03 typedef struct XEckdMbr { uint8_t magic[4]; /* == "xIPL" */@@ -117,8 +118,9 @@ typedef struct BootMapScriptEntry {BootMapPointer blkptr;uint8_t pad[7 ];uint8_t type;/* == BOOT_SCRIPT_* */ -#define BOOT_SCRIPT_EXEC 0x01 -#define BOOT_SCRIPT_LOAD 0x02 +#define BOOT_SCRIPT_EXEC 0x01 +#define BOOT_SCRIPT_LOAD 0x02 +#define BOOT_SCRIPT_SIGNATURE 0x03union {uint64_t load_address;uint64_t load_psw;
Re: [Qemu-devel] [qemu-s390x] [PULL SUBSYSTEM s390x 2/3] s390-bios: Skip bootmap signature entries
Quoted 1 line · Christian Borntraeger
Shall we cc stable this?
I think I'd rather not do it unless someone really speaks up that they urgently need it. If we could use the binary from the master branch, I'd say go for it, but in this case we'd need to build a separate s390-ccw.img for this (without the DASD passthrough patches), and since the stable branch does not get that much testing attention from all the s390x developers, you'd end up with a firmware binary in the stable branch that is not very well tested... This does not sound very appealing to me.
Thomas
Re: [Qemu-devel] [qemu-s390x] [PULL SUBSYSTEM s390x 2/3] s390-bios: Skip bootmap signature entries
Quoted 11 lines · On Sat, 11 May 2019 08:15:21 +0200 Thomas Huth <[email protected]> wrote:
Quoted 1 line · Christian Borntraeger
Shall we cc stable this?
I think I'd rather not do it unless someone really speaks up that they urgently need it. If we could use the binary from the master branch, I'd say go for it, but in this case we'd need to build a separate s390-ccw.img for this (without the DASD passthrough patches), and since the stable branch does not get that much testing attention from all the s390x developers, you'd end up with a firmware binary in the stable branch that is not very well tested... This does not sound very appealing to me.
FWIW, I have rebuilt the bios for the stable tree in the past, when a bios patch had been picked. In this case, however, I would need to rely on someone else to sanity-check the binary.
How likely are folks to run -stable QEMU with a bootmap containing signatures? It would be one more QEMU version with toleration for this, but I expect distros to pick up this one anyway?
Re: [Qemu-devel] [qemu-s390x] [PULL SUBSYSTEM s390x 2/3] s390-bios: Skip bootmap signature entries
Quoted 15 lines · Cornelia Huck
Quoted 11 lines · On Sat, 11 May 2019 08:15:21 +0200 Thomas Huth <[email protected]> wrote:
Quoted 1 line · Christian Borntraeger
Shall we cc stable this?
I think I'd rather not do it unless someone really speaks up that they urgently need it. If we could use the binary from the master branch, I'd say go for it, but in this case we'd need to build a separate s390-ccw.img for this (without the DASD passthrough patches), and since the stable branch does not get that much testing attention from all the s390x developers, you'd end up with a firmware binary in the stable branch that is not very well tested... This does not sound very appealing to me.
Quoted 7 lines
FWIW, I have rebuilt the bios for the stable tree in the past, when a bios patch had been picked. In this case, however, I would need to rely on someone else to sanity-check the binary.
How likely are folks to run -stable QEMU with a bootmap containing signatures? It would be one more QEMU version with toleration for this, but I expect distros to pick up this one anyway?
Yes, I will try to push this into distros. I usually try to push things also to stable, but this might be more important for the kernel.
Re: [Qemu-devel] [qemu-s390x] [PULL SUBSYSTEM s390x 2/3] s390-bios: Skip bootmap signature entries
Quoted 20 lines · On Mon, 13 May 2019 09:44:37 +0200 Christian Borntraeger…
Quoted 19 lines · Cornelia Huck
Quoted 11 lines · On Sat, 11 May 2019 08:15:21 +0200 Thomas Huth <[email protected]> wrote:
Quoted 1 line · Christian Borntraeger
Shall we cc stable this?
I think I'd rather not do it unless someone really speaks up that they urgently need it. If we could use the binary from the master branch, I'd say go for it, but in this case we'd need to build a separate s390-ccw.img for this (without the DASD passthrough patches), and since the stable branch does not get that much testing attention from all the s390x developers, you'd end up with a firmware binary in the stable branch that is not very well tested... This does not sound very appealing to me.
FWIW, I have rebuilt the bios for the stable tree in the past, when a bios patch had been picked. In this case, however, I would need to rely on someone else to sanity-check the binary.
Quoted 7 lines
Quoted 3 lines
How likely are folks to run -stable QEMU with a bootmap containing signatures? It would be one more QEMU version with toleration for this, but I expect distros to pick up this one anyway?
Yes, I will try to push this into distros. I usually try to push things also to stable, but this might be more important for the kernel.
Yes, while the QEMU stable branch is useful, the kernel stable backports cover a lot more.
Quoted 30 lines · On Wed, 8 May 2019 11:48:54 +0200 Thomas Huth <[email protected]> wrote:
This pull request is not for master.
Hi Cornelia,
the following changes since commit
a6f6d24757a73f7176989134b97284a1a7df11e5:Merge remote-tracking branch 'remotes/kraxel/tags/vga-20190507-pull-request' into staging (2019-05-07 21:39:28 +0100)
are available in the Git repository at:
https://gitlab.com/huth/qemu.git tags/s390-ccw-bios-2019-05-08
for you to fetch changes up to
f7a339a5ba48a8a5c5bf4f1fdb1463bf8ac5f5bb:pc-bios/s390: Update firmware image with "Skip bootmap signature entries" fix (2019-05-08 11:26:01 +0200)
----------------------------------------------------------------
Skip unsupported bootmap signature entries instead of aborting the boot process
----------------------------------------------------------------Jason J. Herne (1):
s390-bios: Skip bootmap signature entriesMarkus Armbruster (1):
pc-bios/s390-ccw: Clean up harmless misuse ofisdigit()Thomas Huth (1):
pc-bios/s390: Update firmware image with "Skip bootmap signature entries" fix
Quoted 6 lines
pc-bios/s390-ccw.img | Bin 42608 -> 42608 bytes pc-bios/s390-ccw/bootmap.c | 19 +++++++++++++++++-- pc-bios/s390-ccw/bootmap.h | 10 ++++++---- pc-bios/s390-ccw/libc.c | 2 +- pc-bios/s390-ccw/menu.c | 2 +- 5 files changed, 25 insertions(+), 8 deletions(-)
Thanks, pulled.