Skip to contentSkip to conversation

pc-bios/s390-ccw: fix sclp_get_loadparm_ascii

PATCH In review Claudio Imbrenda 7 participants 14 messages Nov 28, 2019 – Nov 29, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pc-bios/s390-ccw: fix sclp_get_loadparm_ascii

The existing s390 bios gets the LOADPARM information from the system using an SCLP call that specifies a buffer length too small to contain all the output.

The recent fixes in the SCLP code have exposed this bug, since now the SCLP call will return an error (as per architecture) instead of writing partially and completing successfully.

The solution is simply to specify the full page length as the SCCB length instead of a smaller size.

Fixes 832be0d8a3bb ("s390x: sclp: Report insufficient SCCB length")
Fixes 9a22473c70f3 ("pc-bios/s390-ccw: get LOADPARM stored in SCP Read Info")
---
 pc-bios/s390-ccw/sclp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
pc-bios/s390-ccw/sclp.c +1 -1
index c0223fa..7251f9a 100644
@@ -112,7 +112,7 @@ void sclp_get_loadparm_ascii(char *loadparm)
     ReadInfo *sccb = (void *)_sccb;
 
     memset((char *)_sccb, 0, sizeof(ReadInfo));
-    sccb->h.length = sizeof(ReadInfo);
+    sccb->h.length = SCCB_SIZE;
     if (!sclp_service_call(SCLP_CMDW_READ_SCP_INFO, sccb)) {
         ebcdic_to_ascii((char *) sccb->loadparm, loadparm, LOADPARM_LEN);
     }
Signature · 1 line
2.7.4
#1 lore raw

Ack.

Conny, I think this would be really nice to have for 4.2 (together with a bios rebuild) as this fixes a regression. Opinions?

Quoted 33 lines · Claudio Imbrenda

The existing s390 bios gets the LOADPARM information from the system using an SCLP call that specifies a buffer length too small to contain all the output.

The recent fixes in the SCLP code have exposed this bug, since now the SCLP call will return an error (as per architecture) instead of writing partially and completing successfully.

The solution is simply to specify the full page length as the SCCB length instead of a smaller size.

Fixes 832be0d8a3bb ("s390x: sclp: Report insufficient SCCB length")
Fixes 9a22473c70f3 ("pc-bios/s390-ccw: get LOADPARM stored in SCP Read Info")
---
 pc-bios/s390-ccw/sclp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
pc-bios/s390-ccw/sclp.c +1 -1
index c0223fa..7251f9a 100644
@@ -112,7 +112,7 @@ void sclp_get_loadparm_ascii(char *loadparm)
     ReadInfo *sccb = (void *)_sccb;
 
     memset((char *)_sccb, 0, sizeof(ReadInfo));
-    sccb->h.length = sizeof(ReadInfo);
+    sccb->h.length = SCCB_SIZE;
     if (!sclp_service_call(SCLP_CMDW_READ_SCP_INFO, sccb)) {
         ebcdic_to_ascii((char *) sccb->loadparm, loadparm, LOADPARM_LEN);
     }
#2 lore raw
Quoted 4 lines · On Thu, 28 Nov 2019 13:35:29 +0100 Christian Borntraeger…

Ack.

Conny, I think this would be really nice to have for 4.2 (together with a bios rebuild) as this fixes a regression. Opinions?

I fear that this is a bit late for 4.2... but this should get a cc:stable.

Quoted 30 lines · Claudio Imbrenda
Quoted 26 lines

The existing s390 bios gets the LOADPARM information from the system using an SCLP call that specifies a buffer length too small to contain all the output.

The recent fixes in the SCLP code have exposed this bug, since now the SCLP call will return an error (as per architecture) instead of writing partially and completing successfully.

The solution is simply to specify the full page length as the SCCB length instead of a smaller size.

Fixes 832be0d8a3bb ("s390x: sclp: Report insufficient SCCB length")
Fixes 9a22473c70f3 ("pc-bios/s390-ccw: get LOADPARM stored in SCP Read Info")
---
 pc-bios/s390-ccw/sclp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
pc-bios/s390-ccw/sclp.c +0 -0
index c0223fa..7251f9a 100644
@@ -112,7 +112,7 @@ void sclp_get_loadparm_ascii(char *loadparm)
     ReadInfo *sccb = (void *)_sccb;
 
Quoted 7 lines

pc-bios/s390-ccw/sclp.c void sclp_get_loadparm_ascii(char *loadparm) · line 118

Quoted 7 lines
pc-bios/s390-ccw/sclp.c +1 -1
     memset((char *)_sccb, 0, sizeof(ReadInfo));
-    sccb->h.length = sizeof(ReadInfo);
+    sccb->h.length = SCCB_SIZE;
     if (!sclp_service_call(SCLP_CMDW_READ_SCP_INFO, sccb)) {
         ebcdic_to_ascii((char *) sccb->loadparm, loadparm, LOADPARM_LEN);
     }

The change seems sane.

#3 lore raw
Quoted 10 lines · Cornelia Huck
Quoted 4 lines · On Thu, 28 Nov 2019 13:35:29 +0100 Christian Borntraeger…

Ack.

Conny, I think this would be really nice to have for 4.2 (together with a bios rebuild) as this fixes a regression. Opinions?

I fear that this is a bit late for 4.2... but this should get a cc:stable.

So we would rather ship a qemu regression instead of pushing a 1 line fixup? Peter, what is the current state of 4.2? does it look like we will have an rc4 or is everything else silent.

Quoted 41 lines
Quoted 31 lines · Claudio Imbrenda
Quoted 26 lines

The existing s390 bios gets the LOADPARM information from the system using an SCLP call that specifies a buffer length too small to contain all the output.

The recent fixes in the SCLP code have exposed this bug, since now the SCLP call will return an error (as per architecture) instead of writing partially and completing successfully.

The solution is simply to specify the full page length as the SCCB length instead of a smaller size.

Fixes 832be0d8a3bb ("s390x: sclp: Report insufficient SCCB length")
Fixes 9a22473c70f3 ("pc-bios/s390-ccw: get LOADPARM stored in SCP Read Info")
---
 pc-bios/s390-ccw/sclp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
pc-bios/s390-ccw/sclp.c +0 -0
index c0223fa..7251f9a 100644
@@ -112,7 +112,7 @@ void sclp_get_loadparm_ascii(char *loadparm)
     ReadInfo *sccb = (void *)_sccb;
 
Quoted 7 lines

pc-bios/s390-ccw/sclp.c void sclp_get_loadparm_ascii(char *loadparm) · line 118

Quoted 7 lines
pc-bios/s390-ccw/sclp.c +1 -1
     memset((char *)_sccb, 0, sizeof(ReadInfo));
-    sccb->h.length = sizeof(ReadInfo);
+    sccb->h.length = SCCB_SIZE;
     if (!sclp_service_call(SCLP_CMDW_READ_SCP_INFO, sccb)) {
         ebcdic_to_ascii((char *) sccb->loadparm, loadparm, LOADPARM_LEN);
     }

The change seems sane.

#4 lore raw
Quoted 12 lines · Christian Borntraeger
Quoted 8 lines · Cornelia Huck
Quoted 4 lines · On Thu, 28 Nov 2019 13:35:29 +0100 Christian Borntraeger…

Ack.

Conny, I think this would be really nice to have for 4.2 (together with a bios rebuild) as this fixes a regression. Opinions?

Quoted 6 lines
Quoted 2 lines

I fear that this is a bit late for 4.2... but this should get a cc:stable.

So we would rather ship a qemu regression instead of pushing a 1 line fixup? Peter, what is the current state of 4.2? does it look like we will have an rc4 or is everything else silent.

There isn't currently anything else that would need an rc4.

thanks
-- PMM

#5 lore raw
Quoted 14 lines · Peter Maydell
Quoted 12 lines · Christian Borntraeger
Quoted 8 lines · Cornelia Huck
Quoted 4 lines · On Thu, 28 Nov 2019 13:35:29 +0100 Christian Borntraeger…

Ack.

Conny, I think this would be really nice to have for 4.2 (together with a bios rebuild) as this fixes a regression. Opinions?

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

I fear that this is a bit late for 4.2... but this should get a cc:stable.

So we would rather ship a qemu regression instead of pushing a 1 line fixup? Peter, what is the current state of 4.2? does it look like we will have an rc4 or is everything else silent.

There isn't currently anything else that would need an rc4.

I would vote for getting this patch still in. And I think we probably do not need an rc4 for that, the fix seems pretty straight forward.

#6 lore raw
Quoted 20 lines · Christian Borntraeger
Quoted 17 lines · Peter Maydell
Quoted 15 lines · Christian Borntraeger
Quoted 10 lines · Cornelia Huck
Quoted 4 lines · On Thu, 28 Nov 2019 13:35:29 +0100 Christian Borntraeger…

Ack.

Conny, I think this would be really nice to have for 4.2 (together with a bios rebuild) as this fixes a regression. Opinions?

I fear that this is a bit late for 4.2... but this should get a cc:stable.

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

So we would rather ship a qemu regression instead of pushing a 1 line fixup? Peter, what is the current state of 4.2? does it look like we will have an rc4 or is everything else silent.

There isn't currently anything else that would need an rc4.

I would vote for getting this patch still in. And I think we probably do not need an rc4 for that, the fix seems pretty straight forward.

Ok, I'm going to build the binaries and send a pull request today.

Thomas

Tested-by
#7 lore raw
In reply to Christian Borntraeger
Quoted 4 lines · Christian Borntraeger

Ack.

Conny, I think this would be really nice to have for 4.2 (together with a bios rebuild) as this fixes a regression. Opinions?

If we do another rc of 4.2, I think we definitely want this to be included, otherwise quite a bunch of things don't work anymore as expected, e.g. "-boot menu=on"...

Quoted 7 lines
Quoted 7 lines
pc-bios/s390-ccw/sclp.c +0 -0
index c0223fa..7251f9a 100644
@@ -112,7 +112,7 @@ void sclp_get_loadparm_ascii(char *loadparm)
      ReadInfo *sccb = (void *)_sccb;
 
Quoted 6 lines

pc-bios/s390-ccw/sclp.c void sclp_get_loadparm_ascii(char *loadparm) · line 118

Quoted 6 lines
pc-bios/s390-ccw/sclp.c +1 -1
      memset((char *)_sccb, 0, sizeof(ReadInfo));
-    sccb->h.length = sizeof(ReadInfo);
+    sccb->h.length = SCCB_SIZE;
      if (!sclp_service_call(SCLP_CMDW_READ_SCP_INFO, sccb)) {
          ebcdic_to_ascii((char *) sccb->loadparm, loadparm, LOADPARM_LEN);
      }

I gave it a quick try, and this fixes "-boot menu=on" for me, so:

#8 lore raw
Quoted 9 lines · On Thu, 28 Nov 2019 14:11:38 +0100 Thomas Huth <[email protected]> wrote:
Quoted 4 lines · Christian Borntraeger

Ack.

Conny, I think this would be really nice to have for 4.2 (together with a bios rebuild) as this fixes a regression. Opinions?

If we do another rc of 4.2, I think we definitely want this to be included, otherwise quite a bunch of things don't work anymore as expected, e.g. "-boot menu=on"...

I do agree we want this if possible; the question is really the "possible" part...

Quoted 17 lines
Quoted 8 lines
Quoted 8 lines
pc-bios/s390-ccw/sclp.c +0 -0
index c0223fa..7251f9a 100644
@@ -112,7 +112,7 @@ void sclp_get_loadparm_ascii(char *loadparm)
      ReadInfo *sccb = (void *)_sccb;
 
Quoted 6 lines

pc-bios/s390-ccw/sclp.c void sclp_get_loadparm_ascii(char *loadparm) · line 118

Quoted 6 lines
pc-bios/s390-ccw/sclp.c +1 -1
      memset((char *)_sccb, 0, sizeof(ReadInfo));
-    sccb->h.length = sizeof(ReadInfo);
+    sccb->h.length = SCCB_SIZE;
      if (!sclp_service_call(SCLP_CMDW_READ_SCP_INFO, sccb)) {
          ebcdic_to_ascii((char *) sccb->loadparm, loadparm, LOADPARM_LEN);
      }  

I gave it a quick try, and this fixes "-boot menu=on" for me, so:

Quoted 1 line

Thanks.

FWIW, I'm currently working to put this + the rebuild on my s390-fixes branch.

#9 lore raw
Quoted 9 lines · Cornelia Huck
Quoted 6 lines · On Thu, 28 Nov 2019 14:11:38 +0100 Thomas Huth <[email protected]> wrote:
Quoted 4 lines · Christian Borntraeger

Ack.

Conny, I think this would be really nice to have for 4.2 (together with a bios rebuild) as this fixes a regression. Opinions?

Quoted 6 lines
Quoted 3 lines

If we do another rc of 4.2, I think we definitely want this to be included, otherwise quite a bunch of things don't work anymore as expected, e.g. "-boot menu=on"...

I do agree we want this if possible; the question is really the "possible" part...

Given the issues that we see without that fix, I think this would qualify do an rc4 (or even to apply it on top of rc3 to become 4.2)
Maybe just do a pull request?

Quoted 25 lines
Quoted 18 lines
Quoted 9 lines
Quoted 9 lines
pc-bios/s390-ccw/sclp.c +0 -0
index c0223fa..7251f9a 100644
@@ -112,7 +112,7 @@ void sclp_get_loadparm_ascii(char *loadparm)
      ReadInfo *sccb = (void *)_sccb;
 
Quoted 6 lines

pc-bios/s390-ccw/sclp.c void sclp_get_loadparm_ascii(char *loadparm) · line 118

Quoted 6 lines
pc-bios/s390-ccw/sclp.c +1 -1
      memset((char *)_sccb, 0, sizeof(ReadInfo));
-    sccb->h.length = sizeof(ReadInfo);
+    sccb->h.length = SCCB_SIZE;
      if (!sclp_service_call(SCLP_CMDW_READ_SCP_INFO, sccb)) {
          ebcdic_to_ascii((char *) sccb->loadparm, loadparm, LOADPARM_LEN);
      }  

I gave it a quick try, and this fixes "-boot menu=on" for me, so:

Quoted 1 line

Thanks.

FWIW, I'm currently working to put this + the rebuild on my s390-fixes branch.

Reviewed-by on v1 1/1
#10 lore raw
In reply to Claudio Imbrenda
Quoted 8 lines · Claudio Imbrenda

The existing s390 bios gets the LOADPARM information from the system using an SCLP call that specifies a buffer length too small to contain all the output.

The recent fixes in the SCLP code have exposed this bug, since now the SCLP call will return an error (as per architecture) instead of writing partially and completing successfully.

Quoted 5 lines

The solution is simply to specify the full page length as the SCCB length instead of a smaller size.

Fixes 832be0d8a3bb ("s390x: sclp: Report insufficient SCCB length")
Fixes 9a22473c70f3 ("pc-bios/s390-ccw: get LOADPARM stored in SCP Read Info")

"pc-bios/s390-ccw: fix sclp readinfo buffer length indication"?

Quoted 20 lines
---
 pc-bios/s390-ccw/sclp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
pc-bios/s390-ccw/sclp.c +1 -1
index c0223fa..7251f9a 100644
@@ -112,7 +112,7 @@ void sclp_get_loadparm_ascii(char *loadparm)
     ReadInfo *sccb = (void *)_sccb;
 
     memset((char *)_sccb, 0, sizeof(ReadInfo));
-    sccb->h.length = sizeof(ReadInfo);
+    sccb->h.length = SCCB_SIZE;
     if (!sclp_service_call(SCLP_CMDW_READ_SCP_INFO, sccb)) {
         ebcdic_to_ascii((char *) sccb->loadparm, loadparm, LOADPARM_LEN);
     }
Acked-by on v1 1/1
#12 lore raw
In reply to Claudio Imbrenda
Quoted 24 lines · On Thu, 28 Nov 2019 13:33:57 +0100 Claudio Imbrenda <[email protected]>…

The existing s390 bios gets the LOADPARM information from the system using an SCLP call that specifies a buffer length too small to contain all the output.

The recent fixes in the SCLP code have exposed this bug, since now the SCLP call will return an error (as per architecture) instead of writing partially and completing successfully.

The solution is simply to specify the full page length as the SCCB length instead of a smaller size.

Fixes 832be0d8a3bb ("s390x: sclp: Report insufficient SCCB length")
Fixes 9a22473c70f3 ("pc-bios/s390-ccw: get LOADPARM stored in SCP Read Info")
---
 pc-bios/s390-ccw/sclp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
pc-bios/s390-ccw/sclp.c +0 -0
index c0223fa..7251f9a 100644

pc-bios/s390-ccw/sclp.c void sclp_get_loadparm_ascii(char *loadparm) · line 118

Quoted 8 lines
pc-bios/s390-ccw/sclp.c +1 -1
@@ -112,7 +112,7 @@ void sclp_get_loadparm_ascii(char *loadparm)
     ReadInfo *sccb = (void *)_sccb;
 
     memset((char *)_sccb, 0, sizeof(ReadInfo));
-    sccb->h.length = sizeof(ReadInfo);
+    sccb->h.length = SCCB_SIZE;
     if (!sclp_service_call(SCLP_CMDW_READ_SCP_INFO, sccb)) {
         ebcdic_to_ascii((char *) sccb->loadparm, loadparm, LOADPARM_LEN);
     }
Tested-by on v1 1/1
#13 lore raw
In reply to Claudio Imbrenda
Quoted 34 lines · Claudio Imbrenda

The existing s390 bios gets the LOADPARM information from the system using an SCLP call that specifies a buffer length too small to contain all the output.

The recent fixes in the SCLP code have exposed this bug, since now the SCLP call will return an error (as per architecture) instead of writing partially and completing successfully.

The solution is simply to specify the full page length as the SCCB length instead of a smaller size.

Fixes 832be0d8a3bb ("s390x: sclp: Report insufficient SCCB length")
Fixes 9a22473c70f3 ("pc-bios/s390-ccw: get LOADPARM stored in SCP Read Info")
---
 pc-bios/s390-ccw/sclp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
pc-bios/s390-ccw/sclp.c +1 -1
index c0223fa..7251f9a 100644
@@ -112,7 +112,7 @@ void sclp_get_loadparm_ascii(char *loadparm)
     ReadInfo *sccb = (void *)_sccb;
 
     memset((char *)_sccb, 0, sizeof(ReadInfo));
-    sccb->h.length = sizeof(ReadInfo);
+    sccb->h.length = SCCB_SIZE;
     if (!sclp_service_call(SCLP_CMDW_READ_SCP_INFO, sccb)) {
         ebcdic_to_ascii((char *) sccb->loadparm, loadparm, LOADPARM_LEN);
     }
Signature · 1 line
2.7.4

Kind regards / Beste Grüße
Marc Hartmayer

IBM Deutschland Research & Development GmbH Vorsitzende des Aufsichtsrats: Matthias Hartmann Geschäftsführung: Dirk Wittkopp
Sitz der Gesellschaft: Böblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294