Skip to content

Commit

Permalink
zipl/stage3: correctly handle diag308 response code
Browse files Browse the repository at this point in the history
In case diag308 gives a response code 0x102 the stage3 loader can
safely assume that no secure IPL is required since no IPL report
block exists.

Suggested-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Signed-off-by: Stefan Haberland <sth@linux.ibm.com>
Reviewed-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Reviewed-by: Philipp Rudo <prudo@linux.ibm.com>
Tested-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
  • Loading branch information
Stefan Haberland authored and hoeppnerj committed Jul 17, 2020
1 parent c367a6b commit 943c5dc
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 14 deletions.
1 change: 1 addition & 0 deletions include/boot/s390.h
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,7 @@ enum diag308_subcode {

enum diag308_rc {
DIAG308_RC_OK = 0x0001,
DIAG308_RC_NO_CONF = 0x0102,
};

static __always_inline unsigned long diag308(unsigned long subcode, void *addr)
Expand Down
25 changes: 11 additions & 14 deletions zipl/boot/stage3.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,18 +57,6 @@ static inline void __noreturn start_kernel(void)
while (1);
}

unsigned int store_ipl_parmblock(struct ipl_pl_hdr *pl_hdr)
{
int rc;

rc = diag308(DIAG308_STORE, pl_hdr);
if (rc == DIAG308_RC_OK &&
pl_hdr->version <= IPL_MAX_SUPPORTED_VERSION)
return 0;

return 1;
}

unsigned int
is_verified_address(unsigned long image_addr)
{
Expand Down Expand Up @@ -126,9 +114,18 @@ secure_boot_enabled()
unsigned int rc;

pl_hdr = (void *)get_zeroed_page();
if (!pl_hdr || store_ipl_parmblock(pl_hdr))
switch (diag308(DIAG308_STORE, pl_hdr)) {
case DIAG308_RC_OK:
rc = pl_hdr->version <= IPL_MAX_SUPPORTED_VERSION &&
!!(pl_hdr->flags & IPL_FLAG_SECURE);
break;
case DIAG308_RC_NO_CONF:
rc = 0;
break;
default:
panic(ESECUREBOOT, "%s", msg_sipl_noparm);
rc = !!(pl_hdr->flags & IPL_FLAG_SECURE);
break;
}
free_page((unsigned long) pl_hdr);

return rc;
Expand Down

0 comments on commit 943c5dc

Please sign in to comment.